Compare commits

..

No commits in common. 'master' and 'master' have entirely different histories.

@ -1,27 +1,27 @@
# 手语翻译软件
### 工程简介:
### mediapipe_hands
#### 工程包括PC端以及android端其中PC端包括AI运算部分以及Web服务部分android端包括app以及网页部分。上述除Web服务部分均具有手语翻译功能且均可实现本地运算与云上运算。
![](https://mediapipe.dev/images/mobile/hand_tracking_3d_android_gpu.gif)
#### android端包括app及网页部分在设备算力足够的情况下进行本地运算如果算力不足则可选择云上运算。如果您想为本项目贡献更多可以分享您的算力为他人提供运算。android端主要模块如下
通过使用mediapipe来获取手部结点信息具体信息如下
```
media_camera()//获取摄像头的视频流
media_pipe()//获取云上视频流,为他人提供运算
hands_recegnation()//对手语进行识别,转化为自然语言
word_show()//在本地输出转化后的自然语言
word_send()//向云端发送转化后的自然语言,为他人提供运算
word_input()//本地输入自然语言转化为手语动画
word_recv()//接收云端的数据转化为手语
hands_translation()//将输入的自然语言转化为手语数据
hands_3d()//根据数据生成3d手语动画
```
![](https://mediapipe.dev/images/mobile/hand_landmarks.png)
#### PC端包括AI运算部分以及Web服务部分AI部分为其它设备提供算力支持Web服务部分则进行提供android端网页链接及设备算力共享服务。PC端主要模块如下
每个手分为21个结点每个结点右分x,y,z三个坐标值由于再android手机上z值很小并无意义故而不考虑z轴数据。下图为不同手势效果展示
```
包含android所有算力共享服务
nginx-rtmp()//提供视频流传输服务
load_alancing()//负载均衡,为算力共享设备选择提供服务
Webserver()//为网页提供后端支持
```
![](https://mediapipe.dev/images/mobile/hand_crops.png)
### 具体使用方法:
#### 手语翻译:
进入手语翻译界面,通过摄像头捕获手势,翻译为文字,可点击DESTROY清除。
![](./image/img1.png)
#### 动画生成:
通过输入文字,生成对应动画。
![](./image/img2.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Binary file not shown.

@ -1,201 +0,0 @@
(function() {
/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
function h(a) {
var c = 0;
return function() {
return c < a.length ? {
done: !1,
value: a[c++]
} : {
done: !0
}
}
}
var l = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, c, b) {
if (a == Array.prototype || a == Object.prototype) return a;
a[c] = b.value;
return a
};
function m(a) {
a = ["object" == typeof globalThis && globalThis, a, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global];
for (var c = 0; c < a.length; ++c) {
var b = a[c];
if (b && b.Math == Math) return b
}
throw Error("Cannot find global object");
}
var n = m(this);
function p(a, c) {
if (c) a: {
var b = n;a = a.split(".");
for (var d = 0; d < a.length - 1; d++) {
var e = a[d];
if (!(e in b)) break a;
b = b[e]
}
a = a[a.length - 1];d = b[a];c = c(d);c != d && null != c && l(b, a, {
configurable: !0,
writable: !0,
value: c
})
}
}
function q(a) {
var c = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator];
return c ? c.call(a) : {
next: h(a)
}
}
var r = "function" == typeof Object.assign ? Object.assign : function(a, c) {
for (var b = 1; b < arguments.length; b++) {
var d = arguments[b];
if (d)
for (var e in d) Object.prototype.hasOwnProperty.call(d, e) && (a[e] = d[e])
}
return a
};
p("Object.assign", function(a) {
return a || r
});
p("Array.prototype.fill", function(a) {
return a ? a : function(c, b, d) {
var e = this.length || 0;
0 > b && (b = Math.max(0, e + b));
if (null == d || d > e) d = e;
d = Number(d);
0 > d && (d = Math.max(0, e + d));
for (b = Number(b || 0); b < d; b++) this[b] = c;
return this
}
});
function t(a) {
return a ? a : Array.prototype.fill
}
p("Int8Array.prototype.fill", t);
p("Uint8Array.prototype.fill", t);
p("Uint8ClampedArray.prototype.fill", t);
p("Int16Array.prototype.fill", t);
p("Uint16Array.prototype.fill", t);
p("Int32Array.prototype.fill", t);
p("Uint32Array.prototype.fill", t);
p("Float32Array.prototype.fill", t);
p("Float64Array.prototype.fill", t);
var u = this || self;
function v(a, c) {
a = a.split(".");
var b = u;
a[0] in b || "undefined" == typeof b.execScript || b.execScript("var " + a[0]);
for (var d; a.length && (d = a.shift());) a.length || void 0 === c ? b[d] && b[d] !== Object.prototype[d] ? b = b[d] : b = b[d] = {} : b[d] = c
};
var w = {
color: "white",
lineWidth: 4,
radius: 6,
visibilityMin: .5
};
function x(a) {
a = a || {};
return Object.assign(Object.assign(Object.assign({}, w), {
fillColor: a.color
}), a)
}
function y(a, c) {
return a instanceof Function ? a(c) : a
}
function z(a, c, b) {
return Math.max(Math.min(c, b), Math.min(Math.max(c, b), a))
}
v("clamp", z);
v("drawLandmarks", function(a, c, b) {
if (c) {
b = x(b);
a.save();
var d = a.canvas,
e = 0;
c = q(c);
for (var f = c.next(); !f.done; f = c.next())
if (f = f.value, void 0 !== f && (void 0 === f.visibility || f.visibility > b.visibilityMin)) {
a.fillStyle = y(b.fillColor, {
index: e,
from: f
});
a.strokeStyle = y(b.color, {
index: e,
from: f
});
a.lineWidth = y(b.lineWidth, {
index: e,
from: f
});
var g = new Path2D;
g.arc(f.x * d.width, f.y * d.height, y(b.radius, {
index: e,
from: f
}), 0, 2 * Math.PI);
a.fill(g);
a.stroke(g);
++e
} a.restore()
}
});
v("drawConnectors", function(a, c, b, d) {
if (c && b) {
d = x(d);
a.save();
var e = a.canvas,
f = 0;
b = q(b);
for (var g = b.next(); !g.done; g = b.next()) {
var k = g.value;
a.beginPath();
g = c[k[0]];
k = c[k[1]];
g && k && (void 0 === g.visibility || g.visibility > d.visibilityMin) && (void 0 === k.visibility || k.visibility > d.visibilityMin) && (a.strokeStyle = y(d.color, {
index: f,
from: g,
to: k
}), a.lineWidth = y(d.lineWidth, {
index: f,
from: g,
to: k
}), a.moveTo(g.x * e.width, g.y * e.height), a.lineTo(k.x * e.width, k.y * e.height));
++f;
a.stroke()
}
a.restore()
}
});
v("drawRectangle", function(a, c, b) {
b = x(b);
a.save();
var d = a.canvas;
a.beginPath();
a.lineWidth = y(b.lineWidth, {});
a.strokeStyle = y(b.color, {});
a.fillStyle = y(b.fillColor, {});
a.translate(c.xCenter * d.width, c.yCenter * d.height);
a.rotate(c.rotation * Math.PI / 180);
a.rect(-c.width / 2 * d.width, -c.height / 2 * d.height, c.width * d.width, c.height * d.height);
a.translate(-c.xCenter * d.width, -c.yCenter * d.height);
a.stroke();
a.fill();
a.restore()
});
v("lerp", function(a, c, b, d, e) {
return z(d * (1 - (a - c) / (b - c)) + e * (1 - (b - a) / (b - c)), d, e)
});
}).call(this);

@ -1,194 +0,0 @@
var Module = typeof createMediapipeSolutionsPackedAssets !== 'undefined' ? createMediapipeSolutionsPackedAssets : {};
if (!Module.expectedDataFileDownloads) {
Module.expectedDataFileDownloads = 0;
}
Module.expectedDataFileDownloads++;
(function() {
// When running as a pthread, FS operations are proxied to the main thread, so we don't need to
// fetch the .data bundle on the worker
if (Module['ENVIRONMENT_IS_PTHREAD']) return;
var loadPackage = function(metadata) {
var PACKAGE_PATH = '';
if (typeof window === 'object') {
PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/');
} else if (typeof process === 'undefined' && typeof location !== 'undefined') {
// web worker
PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/');
}
var PACKAGE_NAME = 'blaze-out/k8-opt/genfiles/third_party/mediapipe/web/solutions/hands/hands_solution_packed_assets.data';
var REMOTE_PACKAGE_BASE = 'hands_solution_packed_assets.data';
if (typeof Module['locateFilePackage'] === 'function' && !Module['locateFile']) {
Module['locateFile'] = Module['locateFilePackage'];
err('warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)');
}
var REMOTE_PACKAGE_NAME = Module['locateFile'] ? Module['locateFile'](REMOTE_PACKAGE_BASE, '') : REMOTE_PACKAGE_BASE;
var REMOTE_PACKAGE_SIZE = metadata['remote_package_size'];
var PACKAGE_UUID = metadata['package_uuid'];
function fetchRemotePackage(packageName, packageSize, callback, errback) {
if (typeof process === 'object' && typeof process.versions === 'object' && typeof process.versions.node === 'string') {
require('fs').readFile(packageName, function(err, contents) {
if (err) {
errback(err);
} else {
callback(contents.buffer);
}
});
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', packageName, true);
xhr.responseType = 'arraybuffer';
xhr.onprogress = function(event) {
var url = packageName;
var size = packageSize;
if (event.total) size = event.total;
if (event.loaded) {
if (!xhr.addedTotal) {
xhr.addedTotal = true;
if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
Module.dataFileDownloads[url] = {
loaded: event.loaded,
total: size
};
} else {
Module.dataFileDownloads[url].loaded = event.loaded;
}
var total = 0;
var loaded = 0;
var num = 0;
for (var download in Module.dataFileDownloads) {
var data = Module.dataFileDownloads[download];
total += data.total;
loaded += data.loaded;
num++;
}
total = Math.ceil(total * Module.expectedDataFileDownloads/num);
if (Module['setStatus']) Module['setStatus']('Downloading data... (' + loaded + '/' + total + ')');
} else if (!Module.dataFileDownloads) {
if (Module['setStatus']) Module['setStatus']('Downloading data...');
}
};
xhr.onerror = function(event) {
throw new Error("NetworkError for: " + packageName);
}
xhr.onload = function(event) {
if (xhr.status == 200 || xhr.status == 304 || xhr.status == 206 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
var packageData = xhr.response;
callback(packageData);
} else {
throw new Error(xhr.statusText + " : " + xhr.responseURL);
}
};
xhr.send(null);
};
function handleError(error) {
console.error('package error:', error);
};
var fetchedCallback = null;
var fetched = Module['getPreloadedPackage'] ? Module['getPreloadedPackage'](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) : null;
if (!fetched) fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
if (fetchedCallback) {
fetchedCallback(data);
fetchedCallback = null;
} else {
fetched = data;
}
}, handleError);
function runWithFS() {
function assert(check, msg) {
if (!check) throw msg + new Error().stack;
}
Module['FS_createPath']("/", "third_party", true, true);
Module['FS_createPath']("/third_party", "mediapipe", true, true);
Module['FS_createPath']("/third_party/mediapipe", "modules", true, true);
Module['FS_createPath']("/third_party/mediapipe/modules", "palm_detection", true, true);
Module['FS_createPath']("/third_party/mediapipe/modules", "hand_landmark", true, true);
/** @constructor */
function DataRequest(start, end, audio) {
this.start = start;
this.end = end;
this.audio = audio;
}
DataRequest.prototype = {
requests: {},
open: function(mode, name) {
this.name = name;
this.requests[name] = this;
Module['addRunDependency']('fp ' + this.name);
},
send: function() {},
onload: function() {
var byteArray = this.byteArray.subarray(this.start, this.end);
this.finish(byteArray);
},
finish: function(byteArray) {
var that = this;
Module['FS_createPreloadedFile'](this.name, null, byteArray, true, true, function() {
Module['removeRunDependency']('fp ' + that.name);
}, function() {
if (that.audio) {
Module['removeRunDependency']('fp ' + that.name); // workaround for chromium bug 124926 (still no audio with this, but at least we don't hang)
} else {
err('Preloading file ' + that.name + ' failed');
}
}, false, true); // canOwn this data in the filesystem, it is a slide into the heap that will never change
this.requests[this.name] = null;
}
};
var files = metadata['files'];
for (var i = 0; i < files.length; ++i) {
new DataRequest(files[i]['start'], files[i]['end'], files[i]['audio'] || 0).open('GET', files[i]['filename']);
}
function processPackageData(arrayBuffer) {
assert(arrayBuffer, 'Loading data file failed.');
assert(arrayBuffer instanceof ArrayBuffer, 'bad input to processPackageData');
var byteArray = new Uint8Array(arrayBuffer);
var curr;
// Reuse the bytearray from the XHR as the source for file reads.
DataRequest.prototype.byteArray = byteArray;
var files = metadata['files'];
for (var i = 0; i < files.length; ++i) {
DataRequest.prototype.requests[files[i].filename].onload();
} Module['removeRunDependency']('datafile_blaze-out/k8-opt/genfiles/third_party/mediapipe/web/solutions/hands/hands_solution_packed_assets.data');
};
Module['addRunDependency']('datafile_blaze-out/k8-opt/genfiles/third_party/mediapipe/web/solutions/hands/hands_solution_packed_assets.data');
if (!Module.preloadResults) Module.preloadResults = {};
Module.preloadResults[PACKAGE_NAME] = {fromCache: false};
if (fetched) {
processPackageData(fetched);
fetched = null;
} else {
fetchedCallback = processPackageData;
}
}
if (Module['calledRun']) {
runWithFS();
} else {
if (!Module['preRun']) Module['preRun'] = [];
Module["preRun"].push(runWithFS); // FS is not initialized yet, wait for it
}
}
loadPackage({"files": [{"filename": "/third_party/mediapipe/modules/palm_detection/palm_detection_lite.tflite", "start": 0, "end": 1985440}, {"filename": "/third_party/mediapipe/modules/palm_detection/palm_detection_full.tflite", "start": 1985440, "end": 4326720}, {"filename": "/third_party/mediapipe/modules/hand_landmark/handedness.txt", "start": 4326720, "end": 4326731}], "remote_package_size": 4326731, "package_uuid": "f2b11ac8-0259-41a9-b49f-d0fb8d91f87d"});
})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,27 +0,0 @@
{
"name": "@mediapipe/hands",
"version": "0.4.1646424915",
"description": "Mediapipe Hands Solution",
"main": "hands.js",
"module": "hands.js",
"jsdelivr": "hands.js",
"unpkg": "hands.js",
"types": "index.d.ts",
"author": "mhays@google.com",
"license": "Apache-2.0",
"homepage": "https://google.github.io/mediapipe/solutions/hands",
"keywords": [ "AR", "ML", "Augmented" ],
"devDependencies": {
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
},
"browser": {
"node-fetch": false,
"util": false,
"crypto": false
},
"sideEffects" : []
}

@ -1,162 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/static/hand/camera_utils.js" crossorigin="anonymous"></script>
<script src="/static/hand/control_utils.js" crossorigin="anonymous"></script>
<script src="/static/hand/drawing_utils.js" crossorigin="anonymous"></script>
<script src="/static/hand/hands.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<canvas class="output_canvas" width="1280px" height="720px"></canvas>
</div>
<button id="clean" onclick="clean()">清空</button>
<div id="txtHint"></div>
<script>
function clean() {
var obj = document.getElementById("txtHint");
obj.innerHTML="";
}
</script>
<script type="module">
function ajax(str) {
var xmlhttp;
if (str.length==0)
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var xml = xmlhttp.responseText
xml = xml.slice(33,xml.length-2);
document.getElementById("txtHint").innerHTML+=xml;
num=0
}
}
xmlhttp.open("GET","/trans?str="+str,true)
xmlhttp.send();
}
const videoElement = document.createElement("video");
const canvasElement = document.getElementsByClassName('output_canvas')[0];
const canvasCtx = canvasElement.getContext('2d');
var str =""
var pre=str
var num=2
function onResults(results) {
canvasCtx.save();
canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height);
canvasCtx.drawImage(results.image, 0, 0, canvasElement.width, canvasElement.height);
if (results.multiHandLandmarks) {
var Left=[0,0,0,0,0,0,0,0,0]
var Right=[0,0,0,0,0,0,0,0,0]
for (let i = 0; i < results.multiHandLandmarks.length; i++) {
var hand_lable=results.multiHandedness[i].label
if (hand_lable=="Left"){
Left[0]=1
var wrist=results.multiHandLandmarks[i][0]
var index_finger_mcp=results.multiHandLandmarks[i][5]
var index_finger_tip=results.multiHandLandmarks[i][8]
var middle_finger_mcp=results.multiHandLandmarks[i][9]
var middle_finger_tip=results.multiHandLandmarks[i][12]
var ring_finger_mcp=results.multiHandLandmarks[i][13]
var ring_finger_tip=results.multiHandLandmarks[i][16]
var pinky_mcp=results.multiHandLandmarks[i][17]
var pinky_tip=results.multiHandLandmarks[i][20]
var one_x = index_finger_mcp.x-pinky_mcp.x
var one_y = index_finger_mcp.y-pinky_mcp.y
if (Math.abs(one_x)>Math.abs(one_y)) {
Left[3]=1;//平
if (one_x>0) Left[1]=1;//正
var tow = index_finger_mcp.y-wrist.y;
if (tow<0) Left[2]=1;//
var length = Math.abs(middle_finger_mcp.y-wrist.y)/3;
if (Math.abs(index_finger_tip.y-index_finger_mcp.y)>length) Left[5]=1;
if (Math.abs(middle_finger_tip.y-middle_finger_mcp.y)>length) Left[6]=1;
if (Math.abs(ring_finger_tip.y-ring_finger_mcp.y)>length) Left[7]=1;
if (Math.abs(pinky_tip.y-pinky_mcp.y)>length) Left[8]=1;
} else {
var length = Math.abs(one_y)/3;
if (Math.abs(index_finger_mcp.x-index_finger_tip.x)>length) Left[5]=1;
if (Math.abs(middle_finger_mcp.x-middle_finger_tip.x)>length) Left[6]=1;
if (Math.abs(ring_finger_mcp.x-ring_finger_tip.x)>length) Left[7]=1;
if (Math.abs(pinky_mcp.x-pinky_tip.x)>length) Left[8]=1;
}
} else {
Right[0]=1
var wrist=results.multiHandLandmarks[i][0]
var index_finger_mcp=results.multiHandLandmarks[i][5]
var index_finger_tip=results.multiHandLandmarks[i][8]
var middle_finger_mcp=results.multiHandLandmarks[i][9]
var middle_finger_tip=results.multiHandLandmarks[i][12]
var ring_finger_mcp=results.multiHandLandmarks[i][13]
var ring_finger_tip=results.multiHandLandmarks[i][16]
var pinky_mcp=results.multiHandLandmarks[i][17]
var pinky_tip=results.multiHandLandmarks[i][20]
var one_x = index_finger_mcp.x-pinky_mcp.x
var one_y = index_finger_mcp.y-pinky_mcp.y
if (Math.abs(one_x)>Math.abs(one_y)) {
Right[3]=1;//平
if (one_x>0) Right[1]=1;//正
var tow = index_finger_mcp.y-wrist.y;
if (tow<0) Right[2]=1;//
var length = Math.abs(middle_finger_mcp.y-wrist.y)/3;
if (Math.abs(index_finger_tip.y-index_finger_mcp.y)>length) Right[5]=1;
if (Math.abs(middle_finger_tip.y-middle_finger_mcp.y)>length) Right[6]=1;
if (Math.abs(ring_finger_tip.y-ring_finger_mcp.y)>length) Right[7]=1;
if (Math.abs(pinky_tip.y-pinky_mcp.y)>length) Right[8]=1;
} else {
var length = Math.abs(one_y)/3;
if (Math.abs(index_finger_mcp.x-index_finger_tip.x)>length) Right[5]=1;
if (Math.abs(middle_finger_mcp.x-middle_finger_tip.x)>length) Right[6]=1;
if (Math.abs(ring_finger_mcp.x-ring_finger_tip.x)>length) Right[7]=1;
if (Math.abs(pinky_mcp.x-pinky_tip.x)>length) Right[8]=1;
}
}
pre=str
str=''
for (let j = 0; j < Left.length; j++) str+=Left[j]
str+='|'
for (let j = 0; j < Right.length; j++) str+=Right[j]
if (pre==str) num=num+1
console.log(pre,str,num)
if (num==20) ajax(str)
drawConnectors(canvasCtx, results.multiHandLandmarks[i], HAND_CONNECTIONS,
{color: '#00FF00', lineWidth: 5});
drawLandmarks(canvasCtx, results.multiHandLandmarks[i], {color: '#FF0000', lineWidth: 2});
}
}
canvasCtx.restore();
}
const hands = new Hands({locateFile: (file) => {
return `/static/hand/${file}`;
}});
hands.setOptions({
maxNumHands: 2,
modelComplexity: 1,
minDetectionConfidence: 0.5,
minTrackingConfidence: 0.5
});
hands.onResults(onResults);
const camera = new Camera(videoElement, {
onFrame: async () => {
await hands.send({image: videoElement});
},
width: 1280,
height: 720
});
camera.start();
</script>
</body>
</html>

@ -1,746 +0,0 @@
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 950px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
.output_canvas{
width: 950px;
height: 415px;
}
.container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 950px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position:relative;
top: 20%;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输出框*/
.output{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
position: relative;
top: 10%;
}
/*输入框*/
.input{
position: relative;
top: 10%;
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
/*普通笔记本电脑900px<屏幕宽<950px高小于800px*/
@media screen and (max-width:950px) and (min-width:900px) and (max-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 900px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
.output_canvas{
width: 900px;
height: 415px;
}
.container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 900px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position:relative;
top: 20%;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输出框*/
.output{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
position: relative;
top: 10%;
}
/*输入框*/
.input{
position: relative;
top: 10%;
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}
/*普通移动手机屏幕高大于800px*/
@media screen and (min-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 950px;
height: 1200px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
.output_canvas{
width: 950px;
height: 1200px;
}
.container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 950px;
height: 1200px;
}
.button1{
position: absolute;
}
.button2{
position:relative;
top: 20%;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输出框*/
.output{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
position: relative;
top: 10%;
}
/*输入框*/
.input{
position: relative;
top: 10%;
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}
/*普通笔记本电脑850px<屏幕宽<900px高小于800px*/
@media screen and (max-width:900px) and (min-width:850px) and (max-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 850px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
.output_canvas{
width: 850px;
height: 415px;
}
.container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 850px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position:relative;
top: 20%;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输出框*/
.output{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
position: relative;
top: 10%;
}
/*输入框*/
.input{
position: relative;
top: 10%;
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}

@ -1,81 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/control_utils/control_utils.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js" crossorigin="anonymous"></script>
<title>手语翻译</title>
<link rel="stylesheet" type="text/css" href="./main/test1.css">
</head>
<body>
<div class="box">
<div class="top">
</div>
<div class="container">
<canvas class="output_canvas"></canvas>
</div>
<div class="container1">
<script type="module">
const videoElement = document.createElement("video");
const canvasElement = document.getElementsByClassName('output_canvas')[0];
const canvasCtx = canvasElement.getContext('2d');
function onResults(results) {
canvasCtx.save();
canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height);
canvasCtx.drawImage(results.image, 0, 0, canvasElement.width, canvasElement.height);
if (results.multiHandLandmarks) {
for (const landmarks of results.multiHandLandmarks) {
console.log(landmarks)
drawConnectors(canvasCtx, landmarks, HAND_CONNECTIONS,
{color: '#00FF00', lineWidth: 5});
drawLandmarks(canvasCtx, landmarks, {color: '#FF0000', lineWidth: 2});
}
}
canvasCtx.restore();
}
const hands = new Hands({locateFile: (file) => {
return `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`;
}});
hands.setOptions({
maxNumHands: 2,
modelComplexity: 1,
minDetectionConfidence: 0.5,
minTrackingConfidence: 0.5
});
hands.onResults(onResults);
const camera = new Camera(videoElement, {
onFrame: async () => {
await hands.send({image: videoElement});
},
width: 1280,
height: 720
});
camera.start();
</script>
</div>
<div class="button1">
<button>START</button>
<button>DESTORY</button>
<button>SUMIT</button>
</div>
<div class="output">
<output name = "shuchu" type = "text"></output>
</div>
<div class="button2">
<a href="./test1.html">
<button id="btn4" class="btn">VIDEO</button>
</a>
<a href="./test2.html">
<button id="btn5" class="btn">WORD</button>
</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands_solution_packed_assets_loader.js" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands_solution_simd_wasm_bin.js" crossorigin="anonymous">
</script>
</div>
</body>
</html>

@ -1,659 +0,0 @@
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 950px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
#container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 950px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position: absolute;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输入框*/
.input{
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
/*普通笔记本电脑900px<屏幕宽<950px高小于800px*/
@media screen and (max-width:950px) and (min-width:900px) and (max-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 900px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
#container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 900px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position: absolute;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输入框*/
.input{
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}
/*普通移动手机屏幕高大于800px*/
@media screen and (min-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 950px;
height: 1500px;
position:absolute;
top: 50%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
#container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 950px;
height: 1200px;
}
.button1{
position: absolute;
}
.button2{
position: absolute;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输入框*/
.input{
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}
/*普通笔记本电脑850px<屏幕宽<900px高小于800px*/
@media screen and (max-width:900px) and (min-width:850px) and (max-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 850px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
#container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 850px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position: absolute;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输入框*/
.input{
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}

@ -1,36 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>手语翻译</title>
<link rel="stylesheet" type="text/css" href="./main/test2.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="importmap">
{
"imports":{
"three":"./main/three.module.js",
"three/addons/":"./main/"
}
}
</script>
</head>
<body>
<div class="box">
<div id="container">
</div>
<div class="input">
<input id="txt" type="text">
<button type="button" id="btn" onclick="loadXMLDoc(txt.value)">start</button>
</div>
<div class="button2">
<a href="./test1.html">
<button id="btn4" class="btn4" onclick="add">VIDEO</button>
</a>
<a href="./test2.html">
<button id="btn5" class="btn5">WORD</button>
</a>
</div>
</div>
</body>
<script type="module" src="./main/main2_class2.js" ></script>
</html>

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>手语翻译</title>
<link rel="stylesheet" type="text/css" href="/static/1.css">
<script src="/static/three.js-r122/build/three.js"></script>
<script src="/static/three.js-r122/examples/jsm/controls/OrbitControls.js" type="module"></script>
</head>
<body>
<div class="box">
<div id="container">
</div>
<div class="input">
<input type="text">
</div>
<div class="button2">
<a href="./test1.html">
<button id="btn4" class="btn4">VIDEO</button>
</a>
<a href="./test2.html">
<button id="btn5" class="btn5">WORD</button>
</a>
<a href="./test3.html">
<button id="btn6" class="btn6">SETTING</button>
</a>
</div>
<script type="module" src="/static/three.js" ></script>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -1,263 +0,0 @@
import * as THREE from 'three';
import {OrbitControls} from 'three/addons/controls/OrbitControls.js';
//定义全局变量
var geometry = new THREE.BoxGeometry( 1, 1, 1 );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
var material1 = new THREE.MeshBasicMaterial({color:0x800080})
var progress = 0;
var velocity = 0.001;
var a = [new THREE.Vector3(10,10,0),
new THREE.Vector3(10,0,2),
new THREE.Vector3(0,15,20)];
var curve;
var scene ;
var camera ;
var renderer;
var controls ;
var hands=[Lhand,Rhand];
var Lhand = [Lcube,Lcube1,Lcube2,Lcube3,Lcube4,Lcube5,Lcube6,Lcube7,Lcube8,Lcube9,Lcube10,Lcube11,Lcube12,Lcube13,Lcube14,Lcube15,Lcube16,Lcube17,Lcube18,Lcube19,Lcube20];
var Rhand = [Rcube,Rcube1,Rcube2,Rcube3,Rcube4,Rcube5,Rcube6,Rcube7,Rcube8,Rcube9,Rcube10,Rcube11,Rcube12,Rcube13,Rcube14,Rcube15,Rcube16,Rcube17,Rcube18,Rcube19,Rcube20];
var Lcube = new THREE.Mesh( geometry, material );
Lcube.position.set(-10,10,10);
var Lcube1 = new THREE.Mesh( geometry, material );
Lcube1.position.set(-5,10,0);
var Lcube2 = new THREE.Mesh( geometry, material );
Lcube2.position.set(0,10,0);
var Lcube3 = new THREE.Mesh( geometry, material );
Lcube3.position.set(5,10,0);
var Lcube4 = new THREE.Mesh( geometry, material );
Lcube4.position.set(10,10,0);
var Lcube5 = new THREE.Mesh( geometry, material );
Lcube5.position.set(5,10,3);
var Lcube6 = new THREE.Mesh( geometry, material );
Lcube6.position.set(10,10,3);
var Lcube7 = new THREE.Mesh( geometry, material );
Lcube7.position.set(15,10,3);
var Lcube8 = new THREE.Mesh( geometry, material );
Lcube8.position.set(20,10,3);
var Lcube9 = new THREE.Mesh( geometry, material );
Lcube9.position.set(5,10,6);
var Lcube10 = new THREE.Mesh( geometry, material );
Lcube10.position.set(10,10,6);
var Lcube11 = new THREE.Mesh( geometry, material );
Lcube11.position.set(15,10,6);
var Lcube12 = new THREE.Mesh( geometry, material );
Lcube12.position.set(20,10,6);
var Lcube13 = new THREE.Mesh( geometry, material );
Lcube13.position.set(5,10,9);
var Lcube14 = new THREE.Mesh( geometry, material );
Lcube14.position.set(10,10,9);
var Lcube15 = new THREE.Mesh( geometry, material );
Lcube15.position.set(15,10,9);
var Lcube16 = new THREE.Mesh( geometry, material );
Lcube16.position.set(20,10,9);
var Lcube17 = new THREE.Mesh( geometry, material );
Lcube17.position.set(5,10,12);
var Lcube18 = new THREE.Mesh( geometry, material );
Lcube18.position.set(10,10,12);
var Lcube19 = new THREE.Mesh( geometry, material );
Lcube19.position.set(15,10,12);
var Lcube20 = new THREE.Mesh( geometry, material );
Lcube20.position.set(20,10,12);
var Rcube = new THREE.Mesh( geometry, material );
Rcube.position.set(-10,0,10);
var Rcube1 = new THREE.Mesh( geometry, material );
Rcube1.position.set(-5,0,0);
var Rcube2 = new THREE.Mesh( geometry, material );
Rcube2.position.set(0,0,0);
var Rcube3 = new THREE.Mesh( geometry, material );
Rcube3.position.set(5,0,0);
var Rcube4 = new THREE.Mesh( geometry, material );
Rcube4.position.set(10,0,0);
var Rcube5 = new THREE.Mesh( geometry, material );
Rcube5.position.set(5,0,3);
var Rcube6 = new THREE.Mesh( geometry, material );
Rcube6.position.set(10,0,3);
var Rcube7 = new THREE.Mesh( geometry, material );
Rcube7.position.set(15,0,3);
var Rcube8 = new THREE.Mesh( geometry, material );
Rcube8.position.set(20,0,3);
var Rcube9 = new THREE.Mesh( geometry, material );
Rcube9.position.set(5,0,6);
var Rcube10 = new THREE.Mesh( geometry, material );
Rcube10.position.set(10,0,6);
var Rcube11 = new THREE.Mesh( geometry, material );
Rcube11.position.set(15,0,6);
var Rcube12 = new THREE.Mesh( geometry, material );
Rcube12.position.set(20,0,6);
var Rcube13 = new THREE.Mesh( geometry, material );
Rcube13.position.set(5,0,9);
var Rcube14 = new THREE.Mesh( geometry, material );
Rcube14.position.set(10,0,9);
var Rcube15 = new THREE.Mesh( geometry, material );
Rcube15.position.set(15,0,9);
var Rcube16 = new THREE.Mesh( geometry, material );
Rcube16.position.set(20,0,9);
var Rcube17 = new THREE.Mesh( geometry, material );
Rcube17.position.set(5,0,12);
var Rcube18 = new THREE.Mesh( geometry, material );
Rcube18.position.set(10,0,12);
var Rcube19 = new THREE.Mesh( geometry, material );
Rcube19.position.set(15,0,12);
var Rcube20 = new THREE.Mesh( geometry, material );
Rcube20.position.set(20,0,12);
init();
finger(Lcube1,Lcube2,Lcube3,Lcube4);
finger(Lcube5,Lcube6,Lcube7,Lcube8);
finger(Lcube9,Lcube10,Lcube11,Lcube12);
finger(Lcube13,Lcube14,Lcube15,Lcube16);
finger(Lcube17,Lcube18,Lcube19,Lcube20);
finger(Rcube1,Rcube2,Rcube3,Rcube4);
finger(Rcube5,Rcube6,Rcube7,Rcube8);
finger(Rcube9,Rcube10,Rcube11,Rcube12);
finger(Rcube13,Rcube14,Rcube15,Rcube16);
finger(Rcube17,Rcube18,Rcube19,Rcube20);
link();
makeCurve()
animate();
//-----------------------------------------------------
function makeCurve(){
curve = new THREE.CatmullRomCurve3(a);
curve.curveType = "catmullrom";
curve.closed = false;//设置闭环
curve.tension = 0.7//设置弧度
}
function moveOnCurve(){
if(curve==null){
console.log("Loading");
}
else{
if(progress<=1-velocity){
const point = curve.getPointAt(progress);
const pointBox = curve.getPointAt(progress+velocity);
if(point && pointBox){
Lcube4.position.set(point.x,point.y,point.z);
finger(Lcube1,Lcube2,Lcube3,Lcube4);
}
progress+=velocity;
}
else{
progress = 0;
}
}
}
//-----------------------------------------------------
function init(){
// 初始化场景
scene = new THREE.Scene();
//初始化相机
camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000);
camera.position.set(30, 30, 30);//设置相机位置
camera.lookAt(0,0,0); //设置相机方向(指向的场景对象)
//初始化渲染器
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor(0xb9d3ff, 1); //设置背景颜色
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMapEnabled = true;//开启阴影,加上阴影渲染
document.body.appendChild(renderer.domElement);//渲染到浏览器
controls = new OrbitControls(camera, renderer.domElement);
controls.update();
}
function link(){
scene.add(Lcube);
var points = [];
points.push( new THREE.Vector3( Lcube1.position.x,Lcube1.position.y,Lcube1.position.z ) );
points.push( new THREE.Vector3( Lcube.position.x,Lcube.position.y,Lcube.position.z ) );
points.push( new THREE.Vector3( Lcube5.position.x,Lcube5.position.y,Lcube5.position.z ) );
points.push( new THREE.Vector3( Lcube9.position.x,Lcube9.position.y,Lcube9.position.z ) );
points.push( new THREE.Vector3( Lcube13.position.x,Lcube13.position.y,Lcube13.position.z ) );
points.push( new THREE.Vector3( Lcube17.position.x,Lcube17.position.y,Lcube17.position.z ) );
points.push( new THREE.Vector3( Lcube.position.x,Lcube.position.y,Lcube.position.z ) );
var geometry1 = new THREE.BufferGeometry().setFromPoints( points );
var line1 = new THREE.Line( geometry1, material );
scene.add( line1 );
scene.add(Rcube);
var points = [];
points.push( new THREE.Vector3( Rcube1.position.x,Rcube1.position.y,Rcube1.position.z ) );
points.push( new THREE.Vector3( Rcube.position.x,Rcube.position.y,Rcube.position.z ) );
points.push( new THREE.Vector3( Rcube5.position.x,Rcube5.position.y,Rcube5.position.z ) );
points.push( new THREE.Vector3( Rcube9.position.x,Rcube9.position.y,Rcube9.position.z ) );
points.push( new THREE.Vector3( Rcube13.position.x,Rcube13.position.y,Rcube13.position.z ) );
points.push( new THREE.Vector3( Rcube17.position.x,Rcube17.position.y,Rcube17.position.z ) );
points.push( new THREE.Vector3( Rcube.position.x,Rcube.position.y,Rcube.position.z ) );
var geometry2 = new THREE.BufferGeometry().setFromPoints( points );
var line2 = new THREE.Line( geometry2, material1 );
scene.add( line2 );
}
function finger(value,value1,value2,value3){
scene.add( value );
scene.add( value1 );
scene.add( value2 );
scene.add( value3 );
var points = [];
points.push( new THREE.Vector3( value.position.x,value.position.y,value.position.z ) );
points.push( new THREE.Vector3( value1.position.x,value1.position.y,value1.position.z ) );
points.push( new THREE.Vector3( value2.position.x,value2.position.y,value2.position.z ) );
points.push( new THREE.Vector3( value3.position.x,value3.position.y,value3.position.z ) );
var geometry1 = new THREE.BufferGeometry().setFromPoints( points );
var line = new THREE.Line( geometry1, material );
scene.add( line );
}
function animate() {
requestAnimationFrame( animate );
moveOnCurve();
// required if controls.enableDamping or controls.autoRotate are set to true
controls.update();
renderer.render( scene, camera );
}

@ -1,335 +0,0 @@
import * as THREE from 'three';
import { Line, Material } from 'three';
import {OrbitControls} from 'three/addons/OrbitControls.js';
//定义全局变量
var geometry = new THREE.BoxGeometry(0.1,0.1,0.1);
var Boxmaterial = new THREE.MeshBasicMaterial({color:0x00ff00});
var Lmaterial = new THREE.MeshBasicMaterial({color:0x800080});
var Rmaterial = new THREE.MeshBasicMaterial({color:0x800080});
var velocity = 0.01;
var progress;
var scene;
var camera;
var renderer;
var controls;
var animateID;
var Lcube = new THREE.Mesh( geometry, Boxmaterial );
//Lcube.position.set(-10,10,10);
var Lcube1 = new THREE.Mesh( geometry, Boxmaterial );
//Lcube1.position.set(-5,10,0);
var Lcube2 = new THREE.Mesh( geometry, Boxmaterial );
//Lcube2.position.set(0,10,0);
var Lcube3 = new THREE.Mesh( geometry, Boxmaterial );
Lcube3.position.set(5,10,0);
var Lcube4 = new THREE.Mesh( geometry, Boxmaterial );
Lcube4.position.set(10,10,0);
var Lcube5 = new THREE.Mesh( geometry, Boxmaterial );
Lcube5.position.set(5,10,3);
var Lcube6 = new THREE.Mesh( geometry, Boxmaterial );
Lcube6.position.set(10,10,3);
var Lcube7 = new THREE.Mesh( geometry, Boxmaterial );
Lcube7.position.set(15,10,3);
var Lcube8 = new THREE.Mesh( geometry, Boxmaterial );
Lcube8.position.set(20,10,3);
var Lcube9 = new THREE.Mesh( geometry, Boxmaterial );
Lcube9.position.set(5,10,6);
var Lcube10 = new THREE.Mesh( geometry, Boxmaterial );
Lcube10.position.set(10,10,6);
var Lcube11 = new THREE.Mesh( geometry, Boxmaterial );
Lcube11.position.set(15,10,6);
var Lcube12 = new THREE.Mesh( geometry, Boxmaterial );
Lcube12.position.set(20,10,6);
var Lcube13 = new THREE.Mesh( geometry, Boxmaterial );
Lcube13.position.set(5,10,9);
var Lcube14 = new THREE.Mesh( geometry, Boxmaterial );
Lcube14.position.set(10,10,9);
var Lcube15 = new THREE.Mesh( geometry, Boxmaterial );
Lcube15.position.set(15,10,9);
var Lcube16 = new THREE.Mesh( geometry, Boxmaterial );
Lcube16.position.set(20,10,9);
var Lcube17 = new THREE.Mesh( geometry, Boxmaterial );
Lcube17.position.set(5,10,12);
var Lcube18 = new THREE.Mesh( geometry, Boxmaterial );
Lcube18.position.set(10,10,12);
var Lcube19 = new THREE.Mesh( geometry, Boxmaterial );
Lcube19.position.set(15,10,12);
var Lcube20 = new THREE.Mesh( geometry, Boxmaterial );
Lcube20.position.set(20,10,12);
var Rcube = new THREE.Mesh( geometry, Boxmaterial );
Rcube.position.set(-10,0,10);
var Rcube1 = new THREE.Mesh( geometry, Boxmaterial );
Rcube1.position.set(-5,0,0);
var Rcube2 = new THREE.Mesh( geometry, Boxmaterial );
Rcube2.position.set(0,0,0);
var Rcube3 = new THREE.Mesh( geometry, Boxmaterial );
Rcube3.position.set(5,0,0);
var Rcube4 = new THREE.Mesh( geometry, Boxmaterial );
Rcube4.position.set(10,0,0);
var Rcube5 = new THREE.Mesh( geometry, Boxmaterial );
Rcube5.position.set(5,0,3);
var Rcube6 = new THREE.Mesh( geometry, Boxmaterial );
Rcube6.position.set(10,0,3);
var Rcube7 = new THREE.Mesh( geometry, Boxmaterial );
Rcube7.position.set(15,0,3);
var Rcube8 = new THREE.Mesh( geometry, Boxmaterial );
Rcube8.position.set(20,0,3);
var Rcube9 = new THREE.Mesh( geometry, Boxmaterial );
Rcube9.position.set(5,0,6);
var Rcube10 = new THREE.Mesh( geometry, Boxmaterial );
Rcube10.position.set(10,0,6);
var Rcube11 = new THREE.Mesh( geometry, Boxmaterial );
Rcube11.position.set(15,0,6);
var Rcube12 = new THREE.Mesh( geometry, Boxmaterial );
Rcube12.position.set(20,0,6);
var Rcube13 = new THREE.Mesh( geometry, Boxmaterial );
Rcube13.position.set(5,0,9);
var Rcube14 = new THREE.Mesh( geometry, Boxmaterial );
Rcube14.position.set(10,0,9);
var Rcube15 = new THREE.Mesh( geometry, Boxmaterial );
Rcube15.position.set(15,0,9);
var Rcube16 = new THREE.Mesh( geometry, Boxmaterial );
Rcube16.position.set(20,0,9);
var Rcube17 = new THREE.Mesh( geometry, Boxmaterial );
Rcube17.position.set(5,0,12);
var Rcube18 = new THREE.Mesh( geometry, Boxmaterial );
Rcube18.position.set(10,0,12);
var Rcube19 = new THREE.Mesh( geometry, Boxmaterial );
Rcube19.position.set(15,0,12);
var Rcube20 = new THREE.Mesh( geometry, Boxmaterial );
Rcube20.position.set(20,0,12);
var Lhand = [Lcube,Lcube1,Lcube2,Lcube3,Lcube4,Lcube5,Lcube6,Lcube7,Lcube8,Lcube9,Lcube10,Lcube11,Lcube12,Lcube13,Lcube14,Lcube15,Lcube16,Lcube17,Lcube18,Lcube19,Lcube20];
var Rhand = [Rcube,Rcube1,Rcube2,Rcube3,Rcube4,Rcube5,Rcube6,Rcube7,Rcube8,Rcube9,Rcube10,Rcube11,Rcube12,Rcube13,Rcube14,Rcube15,Rcube16,Rcube17,Rcube18,Rcube19,Rcube20];
var hands = [Lhand,Rhand];
var Lline;
var Rline;
var values;
var curves;
var p;
var Strings;
//鼠标点击事件
var oBtn = document.getElementById("btn");
//var animateID = requestAnimationFrame(animate);
//-------------------------------------------------
function init(){
//初始化场景
scene = new THREE.Scene();
//初始化相机
camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000);
camera.position.set(10, 15, 10);//设置相机位置
camera.lookAt(0,0,0); //设置相机方向(指向的场景对象)
//初始化渲染器
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor(0xb9d3ff, 1); //设置背景颜色
renderer.setSize(950, 415);
renderer.shadowMapEnabled = true;//开启阴影,加上阴影渲染
document.getElementById("container").appendChild(renderer.domElement);//渲染到浏览器
controls = new OrbitControls(camera, renderer.domElement);
//controls.enableDamping = true;//阻尼
controls.update();
}
function add(){
for(let i = 0;i<21;i++){
scene.add(Lhand[i]);
}
for(let i = 0;i<21;i++){
scene.add(Rhand[i]);
}
let geometry = new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0,0,0)]);
let geometry1 = new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0,0,0)]);
Lline = new THREE.Line(geometry,Lmaterial);
Rline = new THREE.Line(geometry1,Rmaterial);
scene.add(Lline);
scene.add(Rline);
const axesHelper = new THREE.AxesHelper( 500 );
scene.add( axesHelper );
}
function animate(){
moveOnCurve();
//console.log(Lcube);
controls.update;
updateLine();
//获取屏幕宽度
var htmlWidth = document.documentElement.clientWidth;
var htmlHeight = document.documentElement.clientHeight;
//窗口自适应
if(htmlWidth>900&&htmlWidth<950&&htmlHeight<1200){
renderer.setSize(900, 415);
}
else if(htmlWidth>950&&htmlHeight>1200){
renderer.setSize(950, 1200);
}
else if(htmlWidth>850&&htmlWidth<900&&htmlHeight<1200){
renderer.setSize(850, 415);
}
else{
renderer.setSize(950, 415);
}
renderer.render(scene,camera);
animateID = window.requestAnimationFrame(animate);
if(progress[0][0]>1-velocity&&p!=Strings.length){
progress = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];
makeValue(Strings[p]);
makeCurve();
p++;
}
};
function makeValue(string){
values = [[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]
,[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]];
var value = [[],[]];
string = string.split(',');
console.log(string.length);
for(let i = 0;i<2;i++){
for(let j = 0;j<string.length/2;j++){
value[i][j] = parseFloat(string[i*(string.length/2)+j])*10;
}
}
for(let k=0;k<value[0].length/63;k++){
for(let i=0;i<21;i++){
if(i==0){
var x = value[0][0+i*3+k*63];
var y = value[0][1+i*3+k*63];
var z = 0.5;
}
else{
var x = value[0][0+i*3+k*63];
var y = value[0][1+i*3+k*63];
var z = value[0][2+i*3+k*63];
}
values[0][i].push(new THREE.Vector3(x,y,z));
}}
for(let k=0;k<value[1].length/63;k++){
for(let i=0;i<21;i++){
if(i==0){
var x = value[1][0+i*3+k*63];
var y = value[1][1+i*3+k*63];
var z = 0.5;
}
else{
var x = value[1][0+i*3+k*63];
var y = value[1][1+i*3+k*63];
var z = value[1][2+i*3+k*63];
}
values[1][i].push(new THREE.Vector3(x,y,z));
}}
}
function makeCurve(){
curves = [[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]],[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]];
for(let i = 0;i<2;i++){
for(let j=0;j<21;j++){
if(values[i][j].length!=0){
values[i][j].push(values[i][j][values[i][j].length-1]);
curves[i][j] = new THREE.CatmullRomCurve3(values[i][j]);
curves[i][j].curveType = "catmullrom";
curves[i][j].closed = false;
curves[i][j].tension = 0.7;
}
}
}
}
function moveOnCurve(){
let point;
let pointBox;
for(let i=0;i<2;i++){
for(let j=0;j<21;j++){
if(curves[i][j].length==0){
console.log("Loading");
}
else{
if(progress[i][j]<=1-velocity){
point = curves[i][j].getPointAt(progress[i][j]);
pointBox = curves[i][j].getPointAt(progress[i][j]+velocity);
if(point && pointBox){
hands[i][j].position.set(point.x,point.y,point.z);
//console.log(Lcube20);
}
progress[i][j]+=velocity;
}
}
}
}
}
function updateLine(){
let Lpoints=[new THREE.Vector3(Lcube4.position.x,Lcube4.position.y,Lcube4.position.z),new THREE.Vector3(Lcube3.position.x,Lcube3.position.y,Lcube3.position.z),new THREE.Vector3(Lcube2.position.x,Lcube2.position.y,Lcube2.position.z),new THREE.Vector3(Lcube1.position.x,Lcube1.position.y,Lcube1.position.z)
,new THREE.Vector3(Lcube.position.x,Lcube.position.y,Lcube.position.z),new THREE.Vector3(Lcube5.position.x,Lcube5.position.y,Lcube5.position.z),new THREE.Vector3(Lcube6.position.x,Lcube6.position.y,Lcube6.position.z),new THREE.Vector3(Lcube7.position.x,Lcube7.position.y,Lcube7.position.z)
,new THREE.Vector3(Lcube8.position.x,Lcube8.position.y,Lcube8.position.z),new THREE.Vector3(Lcube7.position.x,Lcube7.position.y,Lcube7.position.z),new THREE.Vector3(Lcube6.position.x,Lcube6.position.y,Lcube6.position.z),new THREE.Vector3(Lcube5.position.x,Lcube5.position.y,Lcube5.position.z)
,new THREE.Vector3(Lcube9.position.x,Lcube9.position.y,Lcube9.position.z),new THREE.Vector3(Lcube10.position.x,Lcube10.position.y,Lcube10.position.z),new THREE.Vector3(Lcube11.position.x,Lcube11.position.y,Lcube11.position.z),new THREE.Vector3(Lcube12.position.x,Lcube12.position.y,Lcube12.position.z)
,new THREE.Vector3(Lcube11.position.x,Lcube11.position.y,Lcube11.position.z),new THREE.Vector3(Lcube10.position.x,Lcube10.position.y,Lcube10.position.z),new THREE.Vector3(Lcube9.position.x,Lcube9.position.y,Lcube9.position.z),new THREE.Vector3(Lcube13.position.x,Lcube13.position.y,Lcube13.position.z)
,new THREE.Vector3(Lcube14.position.x,Lcube14.position.y,Lcube14.position.z),new THREE.Vector3(Lcube15.position.x,Lcube15.position.y,Lcube15.position.z),new THREE.Vector3(Lcube16.position.x,Lcube16.position.y,Lcube16.position.z),new THREE.Vector3(Lcube15.position.x,Lcube15.position.y,Lcube15.position.z)
,new THREE.Vector3(Lcube14.position.x,Lcube14.position.y,Lcube14.position.z),new THREE.Vector3(Lcube13.position.x,Lcube13.position.y,Lcube13.position.z),new THREE.Vector3(Lcube17.position.x,Lcube17.position.y,Lcube17.position.z),new THREE.Vector3(Lcube18.position.x,Lcube18.position.y,Lcube18.position.z)
,new THREE.Vector3(Lcube19.position.x,Lcube19.position.y,Lcube19.position.z),new THREE.Vector3(Lcube20.position.x,Lcube20.position.y,Lcube20.position.z),new THREE.Vector3(Lcube19.position.x,Lcube19.position.y,Lcube19.position.z),new THREE.Vector3(Lcube18.position.x,Lcube18.position.y,Lcube18.position.z)
,new THREE.Vector3(Lcube17.position.x,Lcube17.position.y,Lcube17.position.z),new THREE.Vector3(Lcube.position.x,Lcube.position.y,Lcube.position.z)
];
let Rpoints=[new THREE.Vector3(Rcube4.position.x,Rcube4.position.y,Rcube4.position.z),new THREE.Vector3(Rcube3.position.x,Rcube3.position.y,Rcube3.position.z),new THREE.Vector3(Rcube2.position.x,Rcube2.position.y,Rcube2.position.z),new THREE.Vector3(Rcube1.position.x,Rcube1.position.y,Rcube1.position.z)
,new THREE.Vector3(Rcube.position.x,Rcube.position.y,Rcube.position.z),new THREE.Vector3(Rcube5.position.x,Rcube5.position.y,Rcube5.position.z),new THREE.Vector3(Rcube6.position.x,Rcube6.position.y,Rcube6.position.z),new THREE.Vector3(Rcube7.position.x,Rcube7.position.y,Rcube7.position.z)
,new THREE.Vector3(Rcube8.position.x,Rcube8.position.y,Rcube8.position.z),new THREE.Vector3(Rcube7.position.x,Rcube7.position.y,Rcube7.position.z),new THREE.Vector3(Rcube6.position.x,Rcube6.position.y,Rcube6.position.z),new THREE.Vector3(Rcube5.position.x,Rcube5.position.y,Rcube5.position.z)
,new THREE.Vector3(Rcube9.position.x,Rcube9.position.y,Rcube9.position.z),new THREE.Vector3(Rcube10.position.x,Rcube10.position.y,Rcube10.position.z),new THREE.Vector3(Rcube11.position.x,Rcube11.position.y,Rcube11.position.z),new THREE.Vector3(Rcube12.position.x,Rcube12.position.y,Rcube12.position.z)
,new THREE.Vector3(Rcube11.position.x,Rcube11.position.y,Rcube11.position.z),new THREE.Vector3(Rcube10.position.x,Rcube10.position.y,Rcube10.position.z),new THREE.Vector3(Rcube9.position.x,Rcube9.position.y,Rcube9.position.z),new THREE.Vector3(Rcube13.position.x,Rcube13.position.y,Rcube13.position.z)
,new THREE.Vector3(Rcube14.position.x,Rcube14.position.y,Rcube14.position.z),new THREE.Vector3(Rcube15.position.x,Rcube15.position.y,Rcube15.position.z),new THREE.Vector3(Rcube16.position.x,Rcube16.position.y,Rcube16.position.z),new THREE.Vector3(Rcube15.position.x,Rcube15.position.y,Rcube15.position.z)
,new THREE.Vector3(Rcube14.position.x,Rcube14.position.y,Rcube14.position.z),new THREE.Vector3(Rcube13.position.x,Rcube13.position.y,Rcube13.position.z),new THREE.Vector3(Rcube17.position.x,Rcube17.position.y,Rcube17.position.z),new THREE.Vector3(Rcube18.position.x,Rcube18.position.y,Rcube18.position.z)
,new THREE.Vector3(Rcube19.position.x,Rcube19.position.y,Rcube19.position.z),new THREE.Vector3(Rcube20.position.x,Rcube20.position.y,Rcube20.position.z),new THREE.Vector3(Rcube19.position.x,Rcube19.position.y,Rcube19.position.z),new THREE.Vector3(Rcube18.position.x,Rcube18.position.y,Rcube18.position.z)
,new THREE.Vector3(Rcube17.position.x,Rcube17.position.y,Rcube17.position.z),new THREE.Vector3(Rcube.position.x,Rcube.position.y,Rcube.position.z)
];
let Lgeometry = new THREE.BufferGeometry().setFromPoints(Lpoints);
let Rgeometry = new THREE.BufferGeometry().setFromPoints(Rpoints);
scene.remove(Lline);
scene.remove(Rline);
Lline = new THREE.Line(Lgeometry,Lmaterial);
Rline = new THREE.Line(Rgeometry,Rmaterial);
scene.add(Lline);
scene.add(Rline);
}
function live(string){
p =1;
progress = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];
makeValue(string[0]);
makeCurve();
animate();
}
//清空场景中的物体
// 清空场景,包括 scene 场景下的动画子物体renderer,camera,control以及自己使用过的变量置空处理 等
//----------------------------------------------------------------------------
init();
add();
window.loadXMLDoc = function(str){
$.ajax({
url: "./main/txt.json",
type: "GET",
dataType: "json",
success:
function (data) {
var xmlhttp = "{\"code\":200,\"msg\":\"true\",\"data\":\"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.92152,0.82832,7.19508,0.91422,0.70989,0.059,0.86444,0.63217,0.07683,0.80353,0.60658,0.09287,0.75961,0.61367,0.10752,0.8165,0.5938,-0.0237,0.74865,0.4809,-0.0127,0.70593,0.41139,0.00995,0.67176,0.35838,0.02861,0.7751,0.64559,-0.0391,0.69415,0.57205,-0.0023,0.71578,0.58941,0.05731,0.74748,0.61375,0.09593,0.75177,0.70432,-0.0454,0.68256,0.63228,0.0003,0.70669,0.64129,0.05872,0.73504,0.66019,0.09037,0.73843,0.75981,-0.0484,0.68423,0.69001,-0.011,0.70404,0.68652,0.02841,0.72984,0.69979,0.05441|0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.85641,1.02485,1.16535,0.8954,0.8997,0.00402,0.88374,0.75663,-0.0293,0.85438,0.65826,-0.0554,0.81215,0.62125,-0.0766,0.81636,0.76506,-0.1419,0.73064,0.59787,-0.1836,0.68437,0.50185,-0.1973,0.6453,0.4279,-0.2058,0.76673,0.82161,-0.1485,0.68657,0.62056,-0.1963,0.64403,0.48735,-0.1946,0.61414,0.39204,-0.1932,0.72261,0.88146,-0.1401,0.64574,0.72052,-0.1448,0.67316,0.73747,-0.0836,0.70971,0.7799,-0.0434,0.68738,0.93987,-0.1342,0.63865,0.80311,-0.1182,0.66929,0.81369,-0.0684,0.70579,0.85604,-0.0332|\"}";
xmlhttp = xmlhttp.slice(33,xmlhttp.length-3);
xmlhttp = xmlhttp.split('|');
Strings = xmlhttp;
console.log(Strings);
cancelAnimationFrame(animateID);
live(Strings);
}
});
}

@ -1,230 +0,0 @@
import * as THREE from "/static/three.js-r122/build/three.module.js"
import {OrbitControls} from "/static/three.js-r122/examples/jsm/controls/OrbitControls.js";
//定义全局变量
//定义全局变量
var geometry = new THREE.BoxGeometry(0.1,0.1,0.1);
var Boxmaterial = new THREE.MeshBasicMaterial({color:0x00ff00});
var Lmaterial = new THREE.MeshBasicMaterial({color:0x800080});
var Rmaterial = new THREE.MeshBasicMaterial({color:0x800080});
var progress = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];
var velocity = 0.01;
var scene;
var camera;
var renderer;
var controls;
var Lhands=[]
var Rhands=[]
var hands = [Lhands,Rhands];
var Lline;
var Rline;
var value1;
var curve ;
var strings=[];
var string0 =[];
"议案速度"
var a="0.1925947666168213,0.5473065376281738,2.3206620625160213e-08,0.3033226728439331,0.5114372372627258,0.04651688411831856,0.41777345538139343,0.5392630696296692,0.027217578142881393,0.4958229064941406,0.6215819716453552,-0.010156922042369843,0.544066309928894,0.7091509103775024,-0.04631917551159859,0.48519444465637207,0.4558757543563843,0.0012310644378885627,0.6001424193382263,0.4919063448905945,-0.02964494377374649,0.6723194122314453,0.4914349913597107,-0.05351248010993004,0.7327231764793396,0.48740360140800476,-0.07321580499410629,0.4649563729763031,0.4880273640155792,-0.05196492746472359,0.5244404673576355,0.6586609482765198,-0.07859423011541367,0.4717526137828827,0.6705580949783325,-0.07350102812051773,0.44495320320129395,0.636782169342041,-0.06894036382436752,0.42801740765571594,0.542985737323761,-0.10230648517608643,0.4637511670589447,0.7040750980377197,-0.10944212228059769,0.41616007685661316,0.6964676380157471,-0.08283781260251999,0.39777180552482605,0.6557613611221313,-0.06995978206396103,0.3863465487957001,0.6023310422897339,-0.1533883661031723,0.41023093461990356,0.7209582328796387,-0.14129549264907837,0.3680790066719055,0.7129360437393188,-0.11648382246494293,0.3500169515609741,0.6766629219055176,-0.10399384796619415"
var b="0.3074747920036316,0.9019898772239685,1.0195339683605198e-08,0.25297945737838745,0.741093635559082,0.11882976442575455,0.2568987011909485,0.6188923120498657,0.15985067188739777,0.2994866967201233,0.5347099900245667,0.18189513683319092,0.34198740124702454,0.4815441370010376,0.208918958902359,0.2663106322288513,0.5142314434051514,0.08551575988531113,0.3212432861328125,0.38244909048080444,0.1309291571378708,0.3601645231246948,0.3609071969985962,0.17727282643318176,0.38025137782096863,0.35570672154426575,0.20493900775909424,0.33115246891975403,0.5110653042793274,0.03439659997820854,0.34486210346221924,0.31776756048202515,0.06974716484546661,0.362997829914093,0.23869016766548157,0.11691167950630188,0.37287649512290955,0.1874750852584839,0.14666494727134705,0.395782470703125,0.5395836234092712,-0.003572869813069701,0.44010263681411743,0.4286065399646759,0.05928943678736687,0.4411655068397522,0.4772379696369171,0.13026396930217743,0.4254198670387268,0.5230597853660583,0.17077606916427612,0.4580012559890747,0.5990009903907776,-0.03686628118157387,0.4788168966770172,0.5118088126182556,0.027214739471673965,0.47198575735092163,0.5557542443275452,0.08088598400354385,0.45820629596710205,0.5955811142921448,0.1158442348241806"
var c="0.4523501992225647,0.1942148208618164,1.7096501991886726e-08,0.4074195623397827,0.29815971851348877,-0.08865319937467575,0.3774319887161255,0.42925089597702026,-0.1571134626865387,0.33004724979400635,0.5312825441360474,-0.22099411487579346,0.267127126455307,0.6064754724502563,-0.2902185618877411,0.5546683669090271,0.5435442328453064,-0.1285058706998825,0.5916881561279297,0.7007477283477783,-0.20100270211696625,0.6193171739578247,0.7940925359725952,-0.25689464807510376,0.6485602855682373,0.8795797228813171,-0.2977239191532135,0.6190973520278931,0.4962724447250366,-0.1330675482749939,0.6876095533370972,0.6502389311790466,-0.19820000231266022,0.7323645353317261,0.7488104701042175,-0.25582656264305115,0.7742902040481567,0.8370606899261475,-0.30281922221183777,0.6567232012748718,0.4195241332054138,-0.14580829441547394,0.7421215176582336,0.5388163328170776,-0.20962446928024292,0.7959713935852051,0.6220346093177795,-0.268515020608902,0.8430056571960449,0.7013962864875793,-0.3116633892059326,0.6741085052490234,0.32284364104270935,-0.1664796620607376,0.756801187992096,0.39365607500076294,-0.22251586616039276,0.8009949922561646,0.44722166657447815,-0.2642620801925659,0.840006411075592,0.5034887790679932,-0.29797473549842834"
var string = "0.3540383279323578,0.8863077163696289,5.255019974725883e-09,0.42504027485847473,0.8655926585197449,-0.03437764570116997,0.48042523860931396,0.806210994720459,-0.05496273189783096,0.5089290738105774,0.7344641089439392,-0.07449766248464584,0.5281661748886108,0.673363447189331,-0.09565073251724243,0.4463174641132355,0.6658893823623657,-0.031486935913562775,0.4772888720035553,0.5715258717536926,-0.05420501157641411,0.49460917711257935,0.5125950574874878,-0.07035552710294724,0.5082244873046875,0.4608921408653259,-0.0821903645992279,0.4041683077812195,0.6421458125114441,-0.03437076508998871,0.42221447825431824,0.5334337949752808,-0.054231300950050354,0.4320411682128906,0.46971893310546875,-0.07292795926332474,0.43996569514274597,0.41378194093704224,-0.08764351159334183,0.361648291349411,0.6407799124717712,-0.04192019999027252,0.3719751238822937,0.5392971038818359,-0.06619732081890106,0.37998464703559875,0.4714270234107971,-0.08831380307674408,0.38868609070777893,0.4155805706977844,-0.10313612222671509,0.3165479898452759,0.6576754450798035,-0.05323990061879158,0.31218597292900085,0.577325165271759,-0.0751069039106369,0.3108590245246887,0.5289334058761597,-0.09076160192489624,0.312467098236084,0.4876782298088074,-0.10198315232992172,0.3044047951698303,0.9663895964622498,6.9287020565411694e-09,0.38538458943367004,0.9433897733688354,-0.009958998300135136,0.4416201412677765,0.8743448257446289,-0.019099092110991478,0.4695747494697571,0.795817494392395,-0.021065426990389824,0.4836556017398834,0.7308721542358398,-0.019284158945083618,0.39677807688713074,0.7579846382141113,-0.04791314899921417,0.42566627264022827,0.6467018723487854,-0.04389629140496254,0.43870189785957336,0.5789888501167297,-0.03294100612401962,0.4477599859237671,0.5318640470504761,-0.02457273006439209,0.34907078742980957,0.7333060503005981,-0.03398894891142845,0.37949085235595703,0.6184651851654053,-0.02437933348119259,0.39749619364738464,0.553763747215271,-0.006116447038948536,0.4120081663131714,0.5092087984085083,0.004803979303687811,0.30696022510528564,0.7298744320869446,-0.014533798210322857,0.336764395236969,0.6606125235557556,0.009672199375927448,0.35517191886901855,0.6632943749427795,0.041734661906957626,0.36504673957824707,0.6806830167770386,0.06082293391227722,0.27332603931427,0.740144670009613,0.0023831308353692293,0.2884930372238159,0.6849370002746582,0.02794426493346691,0.29987964034080505,0.6789973974227905,0.05210520327091217,0.3059382438659668,0.68449467420578,0.06873659789562225";
strings.push(string);
// strings.push(a);
// strings.push(a);
// strings.push(c);
strings.push(string)
strings.push(string)
strings.push(string);
var p=0;
var Rpoints=[new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)
,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)];
//-------------------------------------------------
function creat(){
for (let i = 0; i < 21; i++) {
Lhands.push(new THREE.Mesh( geometry, Boxmaterial ))
Rhands.push(new THREE.Mesh( geometry, Boxmaterial ))
}
init()
add();
makeValue(string);
console.log(value1);
makeCurve();
animate();
}
function init(){
//初始化场景
scene = new THREE.Scene();
//初始化相机
camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000);
camera.position.set(10, 15, 10);//设置相机位置
camera.lookAt(0,0,0); //设置相机方向(指向的场景对象)
//初始化渲染器
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor(0xb9d3ff, 1); //设置背景颜色
renderer.setSize(950, 415);
renderer.shadowMapEnabled = true;//开启阴影,加上阴影渲染
document.getElementById("container").appendChild(renderer.domElement);//渲染到浏览器
controls = new OrbitControls(camera, renderer.domElement);
//controls.enableDamping = true;//阻尼
controls.update();
}
function add(){
for(let i = 0;i<21;i++){
scene.add(Lhands[i]);
}
/*for(let i = 0;i<21;i++){
scene.add(Rhand[i]);
}*/
let geometry = new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0,0,0)]);
let geometry1 = new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0,0,0)]);
Lline = new THREE.Line(geometry,Lmaterial);
Rline = new THREE.Line(geometry1,Rmaterial);
scene.add(Lline);
scene.add(Rline);
}
function animate(){
requestAnimationFrame(animate);
moveOnCurve();
//console.log(Lhands);
controls.update;
updateLine();
//获取屏幕宽度
var htmlWidth = document.documentElement.clientWidth;
var htmlHeight = document.documentElement.clientHeight;
//窗口自适应
console.log(htmlWidth);
if(htmlWidth>900&&htmlWidth<950&&htmlHeight<1200){
renderer.setSize(900, 415);
}
else if(htmlWidth>950&&htmlHeight>1200){
renderer.setSize(950, 1200);
}
else if(htmlWidth>850&&htmlWidth<900&&htmlHeight<1200){
renderer.setSize(850, 415);
}
else{
renderer.setSize(950, 415);
}
if(progress[0][0]>1-velocity&&p!=strings.length-1){
progress = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];
makeValue(strings[p]);
makeCurve();
p++;
}
renderer.render(scene,camera);
}
function makeValue(value){
value1 = [[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]
,[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]];
var value = value.split(',');
for(let i=0;i<value.length;i++){
value[i] =parseFloat(value[i])*10;
}
for(let k=0;k<value.length/63;k++){
for(let i=0;i<21;i++){
var x = value[0+i*3+k*63];
var y = value[1+i*3+k*63];
var z = value[2+i*3+k*63];
value1[0][i].push(new THREE.Vector3(x,y,z));
}}
}
function makeCurve(){
curve = [[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]],[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]];
for(let i = 0;i<1;i++){
for(let j=0;j<21;j++){
if(value1[i][j].length!=0){
curve[i][j] = new THREE.CatmullRomCurve3(value1[i][j]);
curve[i][j].curveType = "catmullrom";
curve[i][j].closed = false;
curve[i][j].tension = 0.7;
}
}
}
}
function moveOnCurve(){
let point;
let pointBox;
for(let i=0;i<1;i++){
for(let j=0;j<21;j++){
if(curve[i][j].length==0){
console.log("Loading");
}
else{
if(progress[i][j]<=1-velocity){
point = curve[i][j].getPointAt(progress[i][j]);
pointBox = curve[i][j].getPointAt(progress[i][j]+velocity);
if(point && pointBox){
hands[i][j].position.set(point.x,point.y,point.z);
//console.log(Lhands20);
}
progress[i][j]+=velocity;
}
}
}
}
}
function updateLine(){
let Lpoints=[new THREE.Vector3(Lhands[4].position.x,Lhands[4].position.y,Lhands[4].position.z),new THREE.Vector3(Lhands[3].position.x,Lhands[3].position.y,Lhands[3].position.z),new THREE.Vector3(Lhands[2].position.x,Lhands[2].position.y,Lhands[2].position.z),new THREE.Vector3(Lhands[1].position.x,Lhands[1].position.y,Lhands[1].position.z)
,new THREE.Vector3(Lhands[0].position.x,Lhands[0].position.y,Lhands[0].position.z),new THREE.Vector3(Lhands[5].position.x,Lhands[5].position.y,Lhands[5].position.z),new THREE.Vector3(Lhands[6].position.x,Lhands[6].position.y,Lhands[6].position.z),new THREE.Vector3(Lhands[7].position.x,Lhands[7].position.y,Lhands[7].position.z)
,new THREE.Vector3(Lhands[8].position.x,Lhands[8].position.y,Lhands[8].position.z),new THREE.Vector3(Lhands[7].position.x,Lhands[7].position.y,Lhands[7].position.z),new THREE.Vector3(Lhands[6].position.x,Lhands[6].position.y,Lhands[6].position.z),new THREE.Vector3(Lhands[5].position.x,Lhands[5].position.y,Lhands[5].position.z)
,new THREE.Vector3(Lhands[9].position.x,Lhands[9].position.y,Lhands[9].position.z),new THREE.Vector3(Lhands[10].position.x,Lhands[10].position.y,Lhands[10].position.z),new THREE.Vector3(Lhands[11].position.x,Lhands[11].position.y,Lhands[11].position.z),new THREE.Vector3(Lhands[12].position.x,Lhands[12].position.y,Lhands[12].position.z)
,new THREE.Vector3(Lhands[11].position.x,Lhands[11].position.y,Lhands[11].position.z),new THREE.Vector3(Lhands[10].position.x,Lhands[10].position.y,Lhands[10].position.z),new THREE.Vector3(Lhands[9].position.x,Lhands[9].position.y,Lhands[9].position.z),new THREE.Vector3(Lhands[13].position.x,Lhands[13].position.y,Lhands[13].position.z)
,new THREE.Vector3(Lhands[14].position.x,Lhands[14].position.y,Lhands[14].position.z),new THREE.Vector3(Lhands[15].position.x,Lhands[15].position.y,Lhands[15].position.z),new THREE.Vector3(Lhands[16].position.x,Lhands[16].position.y,Lhands[16].position.z),new THREE.Vector3(Lhands[15].position.x,Lhands[15].position.y,Lhands[15].position.z)
,new THREE.Vector3(Lhands[14].position.x,Lhands[14].position.y,Lhands[14].position.z),new THREE.Vector3(Lhands[13].position.x,Lhands[13].position.y,Lhands[13].position.z),new THREE.Vector3(Lhands[17].position.x,Lhands[17].position.y,Lhands[17].position.z),new THREE.Vector3(Lhands[18].position.x,Lhands[18].position.y,Lhands[18].position.z)
,new THREE.Vector3(Lhands[19].position.x,Lhands[19].position.y,Lhands[19].position.z),new THREE.Vector3(Lhands[20].position.x,Lhands[20].position.y,Lhands[20].position.z),new THREE.Vector3(Lhands[19].position.x,Lhands[19].position.y,Lhands[19].position.z),new THREE.Vector3(Lhands[18].position.x,Lhands[18].position.y,Lhands[18].position.z)
,new THREE.Vector3(Lhands[17].position.x,Lhands[17].position.y,Lhands[17].position.z),new THREE.Vector3(Lhands[0].position.x,Lhands[0].position.y,Lhands[0].position.z)
];
let geometry = new THREE.BufferGeometry().setFromPoints(Lpoints);
let geometry1 = new THREE.BufferGeometry().setFromPoints(Rpoints);
scene.remove(Lline);
Lline = new THREE.Line(geometry,Lmaterial);
Rline = new THREE.Line(geometry1,Rmaterial);
scene.add(Lline);
}
//----------------------------------------------------------------------------
creat()
function ajax(str) {
var xmlhttp;
if (str.length==0)
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML+=xmlhttp.responseText;
num=0
}
}
xmlhttp.open("GET","/xyz?="+str,true)
xmlhttp.send();
}
document.getElementById("btn").onclick = function(){
var input=document.getElementById("input")
var str = input.innerText
ajax(str)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,26 @@
/*
* Copyright (C) 2002-2019 Igor Sysoev
* Copyright (C) 2011-2019 Nginx, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/

@ -0,0 +1,23 @@
default: build
clean:
rm -rf Makefile objs
build:
$(MAKE) -f objs/Makefile
install:
$(MAKE) -f objs/Makefile install
modules:
$(MAKE) -f objs/Makefile modules
upgrade:
./build/sbin/nginx -t
kill -USR2 `cat ./build/logs/nginx.pid`
sleep 1
test -f ./build/logs/nginx.pid.oldbin
kill -QUIT `cat ./build/logs/nginx.pid.oldbin`

@ -0,0 +1,3 @@
Documentation is available at http://nginx.org

@ -0,0 +1,14 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# aCC: HP ANSI C++ B3910B A.03.55.02
# C89 mode
CFLAGS="$CFLAGS -Ae"
CC_TEST_FLAGS="-Ae"
PCRE_OPT="$PCRE_OPT -Ae"
ZLIB_OPT="$ZLIB_OPT -Ae"

@ -0,0 +1,71 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Borland C++ 5.5
# optimizations
# maximize speed
CFLAGS="$CFLAGS -O2"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-5"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-6"
;;
esac
# __stdcall
#CPU_OPT="$CPU_OPT -ps"
# __fastcall
#CPU_OPT="$CPU_OPT -pr"
CFLAGS="$CFLAGS $CPU_OPT"
# multithreaded
CFLAGS="$CFLAGS -tWM"
# stop on warning
CFLAGS="$CFLAGS -w!"
# disable logo
CFLAGS="$CFLAGS -q"
# precompiled headers
CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.csm"
NGX_PCH="$NGX_OBJS/ngx_config.csm"
NGX_BUILD_PCH="-H=$NGX_OBJS/ngx_config.csm"
NGX_USE_PCH="-Hu -H=$NGX_OBJS/ngx_config.csm"
# Win32 GUI mode application
#LINK="\$(CC) -laa"
# the resource file
NGX_RES="$NGX_OBJS/nginx.res"
NGX_RCC="brcc32 -fo$NGX_OBJS/nginx.res \$(CORE_INCS) $NGX_WIN32_RC"
# the pragma allows to link the resource file using bcc32 and
# to avoid the direct ilink32 calling and the c0w32.obj's WinMain/main problem
NGX_PRAGMA="#pragma resource \"$NGX_OBJS/nginx.res\""
ngx_include_opt="-I"
ngx_objout="-o"
ngx_binout="-e"
ngx_objext="obj"
ngx_long_start='@&&|
'
ngx_long_end='|'
ngx_regex_dirsep='\\'
ngx_dirsep="\\"

@ -0,0 +1,46 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Compaq C V6.5-207
ngx_include_opt="-I"
# warnings
CFLAGS="$CFLAGS -msg_enable level6 -msg_fatal level6"
CFLAGS="$CFLAGS -msg_disable unknownmacro"
CFLAGS="$CFLAGS -msg_disable unusedincl"
CFLAGS="$CFLAGS -msg_disable unnecincl"
CFLAGS="$CFLAGS -msg_disable nestincl"
CFLAGS="$CFLAGS -msg_disable strctpadding"
CFLAGS="$CFLAGS -msg_disable ansialiascast"
CFLAGS="$CFLAGS -msg_disable inlinestoclsmod"
CFLAGS="$CFLAGS -msg_disable cxxkeyword"
CFLAGS="$CFLAGS -msg_disable longlongsufx"
CFLAGS="$CFLAGS -msg_disable valuepres"
# STUB
CFLAGS="$CFLAGS -msg_disable truncintcast"
CFLAGS="$CFLAGS -msg_disable trunclongcast"
CFLAGS="$CFLAGS -msg_disable truncintasn"
CFLAGS="$CFLAGS -msg_disable trunclongint"
CFLAGS="$CFLAGS -msg_disable intconcastsgn"
CFLAGS="$CFLAGS -msg_disable intconstsign"
CFLAGS="$CFLAGS -msg_disable switchlong"
CFLAGS="$CFLAGS -msg_disable subscrbounds2"
CFLAGS="$CFLAGS -msg_disable hexoctunsign"
CFLAGS="$CFLAGS -msg_disable ignorecallval"
CFLAGS="$CFLAGS -msg_disable nonstandcast"
CFLAGS="$CFLAGS -msg_disable embedcomment"
CFLAGS="$CFLAGS -msg_disable unreachcode"
CFLAGS="$CFLAGS -msg_disable questcompare2"
CFLAGS="$CFLAGS -msg_disable unusedtop"
CFLAGS="$CFLAGS -msg_disable unrefdecl"
CFLAGS="$CFLAGS -msg_disable bitnotint"

@ -0,0 +1,99 @@
# Copyright (C) Nginx, Inc.
# clang
NGX_CLANG_VER=`$CC -v 2>&1 | grep 'version' 2>&1 \
| sed -n -e 's/^.*clang version \(.*\)/\1/p' \
-e 's/^.*LLVM version \(.*\)/\1/p'`
echo " + clang version: $NGX_CLANG_VER"
have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define
CC_TEST_FLAGS="-pipe"
# optimizations
#NGX_CLANG_OPT="-O2"
#NGX_CLANG_OPT="-Oz"
NGX_CLANG_OPT="-O"
case $CPU in
pentium)
# optimize for Pentium
CPU_OPT="-march=pentium"
NGX_CPU_CACHE_LINE=32
;;
pentiumpro | pentium3)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-march=pentiumpro"
NGX_CPU_CACHE_LINE=32
;;
pentium4)
# optimize for Pentium 4
CPU_OPT="-march=pentium4"
NGX_CPU_CACHE_LINE=128
;;
athlon)
# optimize for Athlon
CPU_OPT="-march=athlon"
NGX_CPU_CACHE_LINE=64
;;
opteron)
# optimize for Opteron
CPU_OPT="-march=opteron"
NGX_CPU_CACHE_LINE=64
;;
esac
CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT"
CFLAGS="$CFLAGS -pipe $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="-O2 -pipe $CPU_OPT"
else
PCRE_OPT="$PCRE_OPT -pipe"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O2 -pipe $CPU_OPT"
else
ZLIB_OPT="$ZLIB_OPT -pipe"
fi
# warnings
CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith"
CFLAGS="$CFLAGS -Wconditional-uninitialized"
#CFLAGS="$CFLAGS -Wmissing-prototypes"
# we have a lot of unused function arguments
CFLAGS="$CFLAGS -Wno-unused-parameter"
# deprecated system OpenSSL library on OS X
if [ "$NGX_SYSTEM" = "Darwin" ]; then
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
fi
# stop on warning
CFLAGS="$CFLAGS -Werror"
# debug
CFLAGS="$CFLAGS -g"
if [ ".$CPP" = "." ]; then
CPP="$CC -E"
fi

@ -0,0 +1,254 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
LINK="\$(CC)"
MAIN_LINK=
MODULE_LINK="-shared"
ngx_include_opt="-I "
ngx_compile_opt="-c"
ngx_pic_opt="-fPIC"
ngx_objout="-o "
ngx_binout="-o "
ngx_objext="o"
ngx_binext=
ngx_modext=".so"
ngx_long_start=
ngx_long_end=
ngx_regex_dirsep="\/"
ngx_dirsep='/'
ngx_regex_cont=' \\\
'
ngx_cont=' \
'
ngx_tab=' \
'
ngx_spacer=
ngx_long_regex_cont=$ngx_regex_cont
ngx_long_cont=$ngx_cont
. auto/cc/name
if test -n "$CFLAGS"; then
CC_TEST_FLAGS="$CFLAGS $NGX_CC_OPT"
case $NGX_CC_NAME in
ccc)
# Compaq C V6.5-207
ngx_include_opt="-I"
;;
sunc)
MAIN_LINK=
MODULE_LINK="-G"
case "$NGX_MACHINE" in
i86pc)
NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
;;
sun4u | sun4v)
NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
;;
esac
case $CPU in
amd64)
NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
;;
esac
;;
esac
else
case $NGX_CC_NAME in
gcc)
# gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
# 4.0.0, 4.0.1, 4.1.0
. auto/cc/gcc
;;
clang)
# Clang C compiler
. auto/cc/clang
;;
icc)
# Intel C++ compiler 7.1, 8.0, 8.1
. auto/cc/icc
;;
sunc)
# Sun C 5.7 Patch 117837-04 2005/05/11
. auto/cc/sunc
;;
ccc)
# Compaq C V6.5-207
. auto/cc/ccc
;;
acc)
# aCC: HP ANSI C++ B3910B A.03.55.02
. auto/cc/acc
;;
msvc*)
# MSVC++ 6.0 SP2, MSVC++ Toolkit 2003
. auto/cc/msvc
;;
owc)
# Open Watcom C 1.0, 1.2
. auto/cc/owc
;;
bcc)
# Borland C++ 5.5
. auto/cc/bcc
;;
esac
CC_TEST_FLAGS="$CC_TEST_FLAGS $NGX_CC_OPT"
fi
CFLAGS="$CFLAGS $NGX_CC_OPT"
NGX_TEST_LD_OPT="$NGX_LD_OPT"
if [ "$NGX_PLATFORM" != win32 ]; then
if test -n "$NGX_LD_OPT"; then
ngx_feature=--with-ld-opt=\"$NGX_LD_OPT\"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test=
. auto/feature
if [ $ngx_found = no ]; then
echo $0: error: the invalid value in --with-ld-opt=\"$NGX_LD_OPT\"
echo
exit 1
fi
fi
ngx_feature="-Wl,-E switch"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=-Wl,-E
ngx_feature_test=
. auto/feature
if [ $ngx_found = yes ]; then
MAIN_LINK="-Wl,-E"
fi
if [ "$NGX_CC_NAME" = "sunc" ]; then
echo "checking for gcc builtin atomic operations ... disabled"
else
ngx_feature="gcc builtin atomic operations"
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
ngx_feature_run=yes
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="long n = 0;
if (!__sync_bool_compare_and_swap(&n, 0, 1))
return 1;
if (__sync_fetch_and_add(&n, 1) != 1)
return 1;
if (n != 2)
return 1;
__sync_synchronize();"
. auto/feature
fi
if [ "$NGX_CC_NAME" = "ccc" ]; then
echo "checking for C99 variadic macros ... disabled"
else
ngx_feature="C99 variadic macros"
ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS"
ngx_feature_run=yes
ngx_feature_incs="#include <stdio.h>
#define var(dummy, ...) sprintf(__VA_ARGS__)"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[30]; buf[0] = '0';
var(0, buf, \"%d\", 1);
if (buf[0] != '1') return 1"
. auto/feature
fi
ngx_feature="gcc variadic macros"
ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
ngx_feature_run=yes
ngx_feature_incs="#include <stdio.h>
#define var(dummy, args...) sprintf(args)"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[30]; buf[0] = '0';
var(0, buf, \"%d\", 1);
if (buf[0] != '1') return 1"
. auto/feature
ngx_feature="gcc builtin 64 bit byteswap"
ngx_feature_name="NGX_HAVE_GCC_BSWAP64"
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="if (__builtin_bswap64(0)) return 1"
. auto/feature
# ngx_feature="inline"
# ngx_feature_name=
# ngx_feature_run=no
# ngx_feature_incs="int inline f(void) { return 1 }"
# ngx_feature_path=
# ngx_feature_libs=
# ngx_feature_test=
# . auto/feature
#
# if [ $ngx_found = yes ]; then
# fi
fi

@ -0,0 +1,179 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
# 4.0.0, 4.0.1, 4.1.0
NGX_GCC_VER=`$CC -v 2>&1 | grep 'gcc version' 2>&1 \
| sed -e 's/^.* version \(.*\)/\1/'`
echo " + gcc version: $NGX_GCC_VER"
have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define
# Solaris 7's /usr/ccs/bin/as does not support "-pipe"
CC_TEST_FLAGS="-pipe"
ngx_feature="gcc -pipe switch"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test=
. auto/feature
CC_TEST_FLAGS=
if [ $ngx_found = yes ]; then
PIPE="-pipe"
fi
case "$NGX_MACHINE" in
sun4u | sun4v | sparc | sparc64 )
# "-mcpu=v9" enables the "casa" assembler instruction
CFLAGS="$CFLAGS -mcpu=v9"
;;
esac
# optimizations
#NGX_GCC_OPT="-O2"
#NGX_GCC_OPT="-Os"
NGX_GCC_OPT="-O"
#CFLAGS="$CFLAGS -fomit-frame-pointer"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-march=pentium"
NGX_CPU_CACHE_LINE=32
;;
pentiumpro | pentium3)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-march=pentiumpro"
NGX_CPU_CACHE_LINE=32
;;
pentium4)
# optimize for Pentium 4, gcc 3.x
CPU_OPT="-march=pentium4"
NGX_CPU_CACHE_LINE=128
;;
athlon)
# optimize for Athlon, gcc 3.x
CPU_OPT="-march=athlon"
NGX_CPU_CACHE_LINE=64
;;
opteron)
# optimize for Opteron, gcc 3.x
CPU_OPT="-march=opteron"
NGX_CPU_CACHE_LINE=64
;;
sparc32)
# build 32-bit UltraSparc binary
CPU_OPT="-m32"
CORE_LINK="$CORE_LINK -m32"
NGX_CPU_CACHE_LINE=64
;;
sparc64)
# build 64-bit UltraSparc binary
CPU_OPT="-m64"
CORE_LINK="$CORE_LINK -m64"
NGX_CPU_CACHE_LINE=64
;;
ppc64)
# build 64-bit PowerPC binary
CPU_OPT="-m64"
CPU_OPT="$CPU_OPT -falign-functions=32 -falign-labels=32"
CPU_OPT="$CPU_OPT -falign-loops=32 -falign-jumps=32"
CORE_LINK="$CORE_LINK -m64"
NGX_CPU_CACHE_LINE=128
;;
esac
CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT"
case "$NGX_GCC_VER" in
2.7*)
# batch build
CPU_OPT=
;;
esac
CFLAGS="$CFLAGS $PIPE $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
else
PCRE_OPT="$PCRE_OPT $PIPE"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
else
ZLIB_OPT="$ZLIB_OPT $PIPE"
fi
# warnings
# -W requires at least -O
CFLAGS="$CFLAGS ${NGX_GCC_OPT:--O} -W"
CFLAGS="$CFLAGS -Wall -Wpointer-arith"
#CFLAGS="$CFLAGS -Wconversion"
#CFLAGS="$CFLAGS -Winline"
#CFLAGS="$CFLAGS -Wmissing-prototypes"
case "$NGX_GCC_VER" in
2.*)
# we have a lot of the unused function arguments
CFLAGS="$CFLAGS -Wno-unused"
;;
*)
# we have a lot of the unused function arguments
CFLAGS="$CFLAGS -Wno-unused-parameter"
# 4.2.1 shows the warning in wrong places
#CFLAGS="$CFLAGS -Wunreachable-code"
# deprecated system OpenSSL library on OS X
if [ "$NGX_SYSTEM" = "Darwin" ]; then
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
fi
;;
esac
# stop on warning
CFLAGS="$CFLAGS -Werror"
# debug
CFLAGS="$CFLAGS -g"
# DragonFly's gcc3 generates DWARF
#CFLAGS="$CFLAGS -g -gstabs"
if [ ".$CPP" = "." ]; then
CPP="$CC -E"
fi

@ -0,0 +1,117 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Intel C++ compiler 7.1, 8.0, 8.1, 9.0, 11.1
NGX_ICC_VER=`$CC -V 2>&1 | grep 'Version' 2>&1 \
| sed -e 's/^.* Version \([^ ]*\) *Build.*$/\1/'`
echo " + icc version: $NGX_ICC_VER"
have=NGX_COMPILER value="\"Intel C Compiler $NGX_ICC_VER\"" . auto/define
# optimizations
CFLAGS="$CFLAGS -O"
CORE_LINK="$CORE_LINK -opt_report_file=$NGX_OBJS/opt_report_file"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-march=pentium"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-mcpu=pentiumpro -march=pentiumpro"
;;
pentium4)
# optimize for Pentium 4, default
CPU_OPT="-march=pentium4"
;;
esac
CFLAGS="$CFLAGS $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="-O $CPU_OPT"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O $CPU_OPT"
fi
# warnings
CFLAGS="$CFLAGS -w2"
# disable some warnings
# invalid type conversion: "int" to "char *"
CFLAGS="$CFLAGS -wd171"
# argument is incompatible with corresponding format string conversion
CFLAGS="$CFLAGS -wd181"
# zero used for undefined preprocessing identifier
CFLAGS="$CFLAGS -wd193"
# the format string ends before this argument
CFLAGS="$CFLAGS -wd268"
# invalid format string conversion
CFLAGS="$CFLAGS -wd269"
# conversion from "long long" to "size_t" may lose significant bits
CFLAGS="$CFLAGS -wd810"
# parameter was never referenced
CFLAGS="$CFLAGS -wd869"
# attribute "unused" is only allowed in a function definition, warning on pTHX_
CFLAGS="$CFLAGS -wd1301"
# STUB
# enumerated type mixed with another type
CFLAGS="$CFLAGS -wd188"
# controlling expression is constant
CFLAGS="$CFLAGS -wd279"
# operands are evaluated in unspecified order
CFLAGS="$CFLAGS -wd981"
# external definition with no prior declaration
CFLAGS="$CFLAGS -wd1418"
# external declaration in primary source file
CFLAGS="$CFLAGS -wd1419"
case "$NGX_ICC_VER" in
9.*)
# "cc" clobber ignored, warnings for Linux's htonl()/htons()
CFLAGS="$CFLAGS -wd1469"
# explicit conversion of a 64-bit integral type to a smaller
# integral type
CFLAGS="$CFLAGS -wd1683"
# conversion from pointer to same-sized integral type,
# warning on offsetof()
CFLAGS="$CFLAGS -wd1684"
# floating-point equality and inequality comparisons are unreliable,
# warning on SvTRUE()
CFLAGS="$CFLAGS -wd1572"
;;
8.*)
# "cc" clobber ignored, warnings for Linux's htonl()/htons()
CFLAGS="$CFLAGS -wd1469"
# floating-point equality and inequality comparisons are unreliable,
# warning on SvTRUE()
CFLAGS="$CFLAGS -wd1572"
;;
*)
;;
esac
# stop on warning
CFLAGS="$CFLAGS -Werror"
# debug
CFLAGS="$CFLAGS -g"

@ -0,0 +1,156 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# MSVC 6.0 SP2 cl 12.00
# MSVC Toolkit 2003 (7.1) cl 13.10
# MSVC 2005 Express Edition SP1 (8.0) cl 14.00
# MSVC 2008 Express Edition (9.0) cl 15.00
# MSVC 2010 (10.0) cl 16.00
# MSVC 2015 (14.0) cl 19.00
NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'Compiler Version' 2>&1 \
| sed -e 's/^.* Version \(.*\)/\1/'`
echo " + cl version: $NGX_MSVC_VER"
have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/define
ngx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'`
# optimizations
# maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy
CFLAGS="$CFLAGS -O2"
# enable global optimization
#CFLAGS="$CFLAGS -Og"
# enable intrinsic functions
#CFLAGS="$CFLAGS -Oi"
# disable inline expansion
#CFLAGS="$CFLAGS -Ob0"
# explicit inline expansion
#CFLAGS="$CFLAGS -Ob1"
# explicit and implicit inline expansion
#CFLAGS="$CFLAGS -Ob2"
# enable frame pointer omission
#CFLAGS="$CFLAGS -Oy"
# disable stack checking calls
#CFLAGS="$CFLAGS -Gs"
# pools strings as read/write
#CFLAGS="$CFLAGS -Gf"
# pools strings as read-only
#CFLAGS="$CFLAGS -GF"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-G5"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-G6"
;;
pentium4)
# optimize for Pentium 4, MSVC 7
CPU_OPT="-G7"
;;
esac
# __cdecl, default, must be used with OpenSSL, md5 asm, and sha1 asm
#CPU_OPT="$CPU_OPT -Gd"
# __stdcall
#CPU_OPT="$CPU_OPT -Gz"
# __fastcall
#CPU_OPT="$CPU_OPT -Gr"
CFLAGS="$CFLAGS $CPU_OPT"
# warnings
CFLAGS="$CFLAGS -W4"
# stop on warning
CFLAGS="$CFLAGS -WX"
# disable logo
CFLAGS="$CFLAGS -nologo"
# the link flags
CORE_LINK="$CORE_LINK -link -verbose:lib"
# link with libcmt.lib, multithreaded
LIBC="-MT"
# link with msvcrt.dll
# however, MSVC Toolkit 2003 has no MSVCRT.LIB
#LIBC="-MD"
CFLAGS="$CFLAGS $LIBC"
CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib"
# Win32 GUI mode application
#CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"
# debug
# msvc under Wine issues
# C1902: Program database manager mismatch; please check your installation
if [ -z "$NGX_WINE" ]; then
CFLAGS="$CFLAGS -Zi -Fd$NGX_OBJS/nginx.pdb"
CORE_LINK="$CORE_LINK -debug"
fi
# MSVC 2005 supports C99 variadic macros
if [ "$ngx_msvc_ver" -ge 14 ]; then
have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
fi
# precompiled headers
CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
CORE_LINK="$CORE_LINK $NGX_OBJS/ngx_pch.obj"
NGX_PCH="$NGX_OBJS/ngx_config.pch"
NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch"
NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch"
# the resource file
NGX_RES="$NGX_OBJS/nginx.res"
NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC"
CORE_LINK="$NGX_RES $CORE_LINK"
# dynamic modules
#MAIN_LINK="-link -def:$NGX_OBJS/nginx.def"
#MODULE_LINK="-LD $NGX_OBJS/nginx.lib"
ngx_pic_opt=
ngx_objout="-Fo"
ngx_binout="-Fe"
ngx_objext="obj"
ngx_long_start='@<<
'
ngx_long_end='<<'
ngx_long_regex_cont=' \
'
ngx_long_cont='
'
# MSVC understand / in path
#ngx_regex_dirsep='\\'
#ngx_dirsep="\\"

@ -0,0 +1,70 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ "$NGX_PLATFORM" != win32 ]; then
ngx_feature="C compiler"
ngx_feature_name=
ngx_feature_run=yes
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test=
. auto/feature
if [ $ngx_found = no ]; then
echo
echo $0: error: C compiler $CC is not found
echo
exit 1
fi
fi
if [ "$CC" = cl ]; then
NGX_CC_NAME=msvc
echo " + using Microsoft Visual C++ compiler"
elif [ "$CC" = wcl386 ]; then
NGX_CC_NAME=owc
echo " + using Open Watcom C compiler"
elif [ "$CC" = bcc32 ]; then
NGX_CC_NAME=bcc
echo " + using Borland C++ compiler"
elif `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then
NGX_CC_NAME=icc
echo " + using Intel C++ compiler"
elif `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then
NGX_CC_NAME=gcc
echo " + using GNU C compiler"
elif `$CC -v 2>&1 | grep 'clang version' >/dev/null 2>&1`; then
NGX_CC_NAME=clang
echo " + using Clang C compiler"
elif `$CC -v 2>&1 | grep 'LLVM version' >/dev/null 2>&1`; then
NGX_CC_NAME=clang
echo " + using Clang C compiler"
elif `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then
NGX_CC_NAME=sunc
echo " + using Sun C compiler"
elif `$CC -V 2>&1 | grep '^Compaq C' >/dev/null 2>&1`; then
NGX_CC_NAME=ccc
echo " + using Compaq C compiler"
elif `$CC -V 2>&1 | grep '^aCC: ' >/dev/null 2>&1`; then
NGX_CC_NAME=acc
echo " + using HP aC++ compiler"
else
NGX_CC_NAME=unknown
fi

@ -0,0 +1,103 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Open Watcom C 1.0, 1.2, 1.3
# optimizations
# maximize speed
CFLAGS="$CFLAGS -ot"
# reorder instructions for best pipeline usage
CFLAGS="$CFLAGS -op"
# inline intrinsic functions
CFLAGS="$CFLAGS -oi"
# inline expansion
CFLAGS="$CFLAGS -oe"
# disable stack checking calls
CFLAGS="$CFLAGS -s"
case $CPU in
pentium)
# optimize for Pentium and Athlon
# register-based arguments passing conventions
CPU_OPT="-5r"
# stack-based arguments passing conventions
#CPU_OPT="-5s"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II and Pentium III
# register-based arguments passing conventions
CPU_OPT="-6r"
# stack-based arguments passing conventions
#CPU_OPT="-6s"
;;
esac
CFLAGS="$CFLAGS $CPU_OPT"
# warnings
# maximum level
CFLAGS="$CFLAGS -wx"
#CFLAGS="$CFLAGS -w3"
# stop on warning
CFLAGS="$CFLAGS -we"
# built target is NT
CFLAGS="$CFLAGS -bt=nt"
# multithreaded
CFLAGS="$CFLAGS -bm"
# debug
CFLAGS="$CFLAGS -d2"
# quiet
CFLAGS="$CFLAGS -zq"
# Open Watcom C 1.2
have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
# the precompiled headers
#CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
#NGX_PCH="$NGX_OBJS/ngx_config.pch"
#NGX_BUILD_PCH="-fhq=$NGX_OBJS/ngx_config.pch"
#NGX_USE_PCH="-fh=$NGX_OBJS/ngx_config.pch"
# the link flags, built target is NT GUI mode application
#CORE_LINK="$CORE_LINK -l=nt_win"
# the resource file
NGX_RCC="wrc \$(CORE_INCS) -fo=$NGX_OBJS/nginx.res "
NGX_RCC="$NGX_RCC $NGX_WIN32_RC $NGX_OBJS/nginx.exe"
ngx_include_opt="-i="
ngx_objout="-fo"
ngx_binout="-fe="
ngx_objext="obj"
ngx_regex_dirsep='\\'
ngx_dirsep="\\"
ngx_long_start=' '
ngx_long_end=' '
ngx_long_regex_cont=' \&\
'
ngx_long_cont=' &
'
ngx_regex_cont=' \&\
'
ngx_cont=' &
'
ngx_tab=' &
'

@ -0,0 +1,163 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Sun C 5.7 Patch 117837-04 2005/05/11 Sun Studio 10
# Sun C 5.8 2005/10/13 Sun Studio 11
# Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12
# Sun C 5.9 SunOS_sparc 2007/05/03
# Sun C 5.10 SunOS_i386 2009/06/03 Sun Studio 12.1
# Sun C 5.11 SunOS_i386 2010/08/13 Oracle Solaris Studio 12.2
# Sun C 5.12 SunOS_i386 2011/11/16 Oracle Solaris Studio 12.3
# Sun C 5.13 SunOS_i386 2014/10/20 Oracle Solaris Studio 12.4
# Sun C 5.14 SunOS_i386 2016/05/31 Oracle Developer Studio 12.5
NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
| sed -e 's/^.* Sun C \(.*\)/\1/'`
echo " + Sun C version: $NGX_SUNC_VER"
have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define
cat << END > $NGX_AUTOTEST.c
int main(void) {
printf("%d", __SUNPRO_C);
return 0;
}
END
eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
ngx_sunc_ver=`$NGX_AUTOTEST`
fi
rm -rf $NGX_AUTOTEST*
# 1424 == 0x590, Sun Studio 12
if [ "$ngx_sunc_ver" -ge 1424 ]; then
ngx_sparc32="-m32"
ngx_sparc64="-m64"
ngx_amd64="-m64"
else
ngx_sparc32="-xarch=v8plus"
ngx_sparc64="-xarch=v9"
ngx_amd64="-xarch=amd64"
fi
case "$NGX_MACHINE" in
i86pc)
NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
;;
sun4u | sun4v)
NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
;;
esac
MAIN_LINK=
MODULE_LINK="-G"
# optimizations
# 20736 == 0x5100, Sun Studio 12.1
if [ "$ngx_sunc_ver" -ge 20736 ]; then
ngx_fast="-fast"
else
# older versions had problems with bit-fields
ngx_fast="-fast -xalias_level=any"
fi
IPO=-xipo
CFLAGS="$CFLAGS $ngx_fast $IPO"
CORE_LINK="$CORE_LINK $ngx_fast $IPO"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-xchip=pentium"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II
CPU_OPT="-xchip=pentium_pro"
;;
pentium3)
# optimize for Pentium III
CPU_OPT="-xchip=pentium3"
#CPU_OPT="$CPU_OPT -xarch=sse"
CPU_OPT="$CPU_OPT -xcache=16/32/4:256/32/4"
;;
pentium4)
# optimize for Pentium 4
CPU_OPT="-xchip=pentium4"
#CPU_OPT="$CPU_OPT -xarch=sse2"
CPU_OPT="$CPU_OPT -xcache=8/64/4:256/128/8"
;;
opteron)
# optimize for Opteron
CPU_OPT="-xchip=opteron"
#CPU_OPT="$CPU_OPT -xarch=sse2"
CPU_OPT="$CPU_OPT -xcache=64/64/2:1024/64/16"
;;
sparc32)
# build 32-bit UltraSparc binary
CPU_OPT="$ngx_sparc32"
CORE_LINK="$CORE_LINK $ngx_sparc32"
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc32"
NGX_CPU_CACHE_LINE=64
;;
sparc64)
# build 64-bit UltraSparc binary
CPU_OPT="$ngx_sparc64"
CORE_LINK="$CORE_LINK $ngx_sparc64"
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc64"
NGX_CPU_CACHE_LINE=64
;;
amd64)
# build 64-bit amd64 binary
CPU_OPT="$ngx_amd64"
CORE_LINK="$CORE_LINK $ngx_amd64"
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_amd64"
NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
NGX_CPU_CACHE_LINE=64
;;
esac
CFLAGS="$CFLAGS $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="$ngx_fast $IPO $CPU_OPT"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="$ngx_fast $IPO $CPU_OPT"
fi
# stop on warning
CFLAGS="$CFLAGS -errwarn=%all"
# debug
CFLAGS="$CFLAGS -g"

@ -0,0 +1,12 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $have
#define $have $value
#endif
END

@ -0,0 +1,50 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
echo $ngx_n "checking for system byte ordering ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
----------------------------------------
checking for system byte ordering
END
cat << END > $NGX_AUTOTEST.c
int main(void) {
int i = 0x11223344;
char *p;
p = (char *) &i;
if (*p == 0x44) return 0;
return 1;
}
END
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
-o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
if $NGX_AUTOTEST >/dev/null 2>&1; then
echo " little endian"
have=NGX_HAVE_LITTLE_ENDIAN . auto/have
else
echo " big endian"
fi
rm -rf $NGX_AUTOTEST*
else
rm -rf $NGX_AUTOTEST*
echo
echo "$0: error: cannot detect system byte ordering"
exit 1
fi

@ -0,0 +1,123 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
echo $ngx_n "checking for $ngx_feature ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
----------------------------------------
checking for $ngx_feature
END
ngx_found=no
if test -n "$ngx_feature_name"; then
ngx_have_feature=`echo $ngx_feature_name \
| tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
fi
if test -n "$ngx_feature_path"; then
for ngx_temp in $ngx_feature_path; do
ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp"
done
fi
cat << END > $NGX_AUTOTEST.c
#include <sys/types.h>
$NGX_INCLUDE_UNISTD_H
$ngx_feature_incs
int main(void) {
$ngx_feature_test;
return 0;
}
END
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
-o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
ngx_feature_inc_path=
eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
case "$ngx_feature_run" in
yes)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
else
echo " found but is not working"
fi
;;
value)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " found"
ngx_found=yes
cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $ngx_feature_name
#define $ngx_feature_name `$NGX_AUTOTEST`
#endif
END
else
echo " found but is not working"
fi
;;
bug)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " not found"
else
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
fi
;;
*)
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
;;
esac
else
echo " not found"
echo "----------" >> $NGX_AUTOCONF_ERR
cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR
echo "----------" >> $NGX_AUTOCONF_ERR
echo $ngx_test >> $NGX_AUTOCONF_ERR
echo "----------" >> $NGX_AUTOCONF_ERR
fi
rm -rf $NGX_AUTOTEST*

@ -0,0 +1,12 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $have
#define $have 1
#endif
END

@ -0,0 +1,12 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
cat << END >> $NGX_AUTO_HEADERS_H
#ifndef $have
#define $have 1
#endif
END

@ -0,0 +1,13 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
ngx_include="unistd.h"; . auto/include
ngx_include="inttypes.h"; . auto/include
ngx_include="limits.h"; . auto/include
ngx_include="sys/filio.h"; . auto/include
ngx_include="sys/param.h"; . auto/include
ngx_include="sys/mount.h"; . auto/include
ngx_include="sys/statvfs.h"; . auto/include
ngx_include="crypt.h"; . auto/include

@ -0,0 +1,58 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
echo $ngx_n "checking for $ngx_include ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
----------------------------------------
checking for $ngx_include
END
ngx_found=no
cat << END > $NGX_AUTOTEST.c
$NGX_INCLUDE_SYS_PARAM_H
#include <$ngx_include>
int main(void) {
return 0;
}
END
ngx_test="$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c"
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
ngx_found=yes
echo " found"
ngx_name=`echo $ngx_include \
| tr abcdefghijklmnopqrstuvwxyz/. ABCDEFGHIJKLMNOPQRSTUVWXYZ__`
have=NGX_HAVE_$ngx_name . auto/have_headers
eval "NGX_INCLUDE_$ngx_name='#include <$ngx_include>'"
else
echo " not found"
echo "----------" >> $NGX_AUTOCONF_ERR
cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR
echo "----------" >> $NGX_AUTOCONF_ERR
echo $ngx_test >> $NGX_AUTOCONF_ERR
echo "----------" >> $NGX_AUTOCONF_ERR
fi
rm -rf $NGX_AUTOTEST*

@ -0,0 +1,51 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
NGX_MAKEFILE=$NGX_OBJS/Makefile
NGX_MODULES_C=$NGX_OBJS/ngx_modules.c
NGX_AUTO_HEADERS_H=$NGX_OBJS/ngx_auto_headers.h
NGX_AUTO_CONFIG_H=$NGX_OBJS/ngx_auto_config.h
NGX_AUTOTEST=$NGX_OBJS/autotest
NGX_AUTOCONF_ERR=$NGX_OBJS/autoconf.err
# STUBs
NGX_ERR=$NGX_OBJS/autoconf.err
MAKEFILE=$NGX_OBJS/Makefile
NGX_PCH=
NGX_USE_PCH=
# check the echo's "-n" option and "\c" capability
if echo "test\c" | grep c >/dev/null; then
if echo -n test | grep n >/dev/null; then
ngx_n=
ngx_c=
else
ngx_n=-n
ngx_c=
fi
else
ngx_n=
ngx_c='\c'
fi
# create Makefile
cat << END > Makefile
default: build
clean:
rm -rf Makefile $NGX_OBJS
END

@ -0,0 +1,218 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ $USE_PERL != NO ]; then
cat << END >> $NGX_MAKEFILE
install_perl_modules:
cd $NGX_OBJS/src/http/modules/perl && \$(MAKE) install
END
NGX_INSTALL_PERL_MODULES=install_perl_modules
fi
case ".$NGX_SBIN_PATH" in
./*)
;;
*)
NGX_SBIN_PATH=$NGX_PREFIX/$NGX_SBIN_PATH
;;
esac
case ".$NGX_MODULES_PATH" in
./*)
;;
*)
NGX_MODULES_PATH=$NGX_PREFIX/$NGX_MODULES_PATH
;;
esac
NGX_MODULES_PATH=`dirname $NGX_MODULES_PATH/.`
case ".$NGX_CONF_PATH" in
./*)
;;
*)
NGX_CONF_PATH=$NGX_PREFIX/$NGX_CONF_PATH
;;
esac
NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
case ".$NGX_PID_PATH" in
./*)
;;
*)
NGX_PID_PATH=$NGX_PREFIX/$NGX_PID_PATH
;;
esac
case ".$NGX_ERROR_LOG_PATH" in
./* | .)
;;
*)
NGX_ERROR_LOG_PATH=$NGX_PREFIX/$NGX_ERROR_LOG_PATH
;;
esac
case ".$NGX_HTTP_LOG_PATH" in
./*)
;;
*)
NGX_HTTP_LOG_PATH=$NGX_PREFIX/$NGX_HTTP_LOG_PATH
;;
esac
if test -f man/nginx.8 ; then
NGX_MAN=man/nginx.8
else
NGX_MAN=docs/man/nginx.8
fi
if test -d html ; then
NGX_HTML=html
else
NGX_HTML=docs/html
fi
cat << END >> $NGX_MAKEFILE
manpage: $NGX_OBJS/nginx.8
$NGX_OBJS/nginx.8: $NGX_MAN $NGX_AUTO_CONFIG_H
sed -e "s|%%PREFIX%%|$NGX_PREFIX|" \\
-e "s|%%PID_PATH%%|$NGX_PID_PATH|" \\
-e "s|%%CONF_PATH%%|$NGX_CONF_PATH|" \\
-e "s|%%ERROR_LOG_PATH%%|${NGX_ERROR_LOG_PATH:-stderr}|" \\
< $NGX_MAN > \$@
install: build $NGX_INSTALL_PERL_MODULES
test -d '\$(DESTDIR)$NGX_PREFIX' || mkdir -p '\$(DESTDIR)$NGX_PREFIX'
test -d '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' \\
|| mkdir -p '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`'
test ! -f '\$(DESTDIR)$NGX_SBIN_PATH' \\
|| mv '\$(DESTDIR)$NGX_SBIN_PATH' \\
'\$(DESTDIR)$NGX_SBIN_PATH.old'
cp $NGX_OBJS/nginx '\$(DESTDIR)$NGX_SBIN_PATH'
test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \\
|| mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX'
cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX'
cp conf/koi-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
cp conf/win-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
test -f '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types' \\
|| cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX'
cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types.default'
test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params' \\
|| cp conf/fastcgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
cp conf/fastcgi_params \\
'\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params.default'
test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf' \\
|| cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX'
cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf.default'
test -f '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params' \\
|| cp conf/uwsgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
cp conf/uwsgi_params \\
'\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params.default'
test -f '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params' \\
|| cp conf/scgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
cp conf/scgi_params \\
'\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params.default'
test -f '\$(DESTDIR)$NGX_CONF_PATH' \\
|| cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH'
cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \\
|| mkdir -p '\$(DESTDIR)`dirname "$NGX_PID_PATH"`'
test -d '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' \\
|| mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`'
test -d '\$(DESTDIR)$NGX_PREFIX/html' \\
|| cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX'
END
if test -n "$NGX_ERROR_LOG_PATH"; then
cat << END >> $NGX_MAKEFILE
test -d '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' \\
|| mkdir -p '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`'
END
fi
if test -n "$DYNAMIC_MODULES"; then
cat << END >> $NGX_MAKEFILE
test -d '\$(DESTDIR)$NGX_MODULES_PATH' \\
|| mkdir -p '\$(DESTDIR)$NGX_MODULES_PATH'
END
fi
for ngx_module in $DYNAMIC_MODULES
do
ngx_module=$ngx_module$ngx_modext
cat << END >> $NGX_MAKEFILE
test ! -f '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\
|| mv '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\
'\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module.old'
cp $NGX_OBJS/$ngx_module '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module'
END
done
# create Makefile
cat << END >> Makefile
build:
\$(MAKE) -f $NGX_MAKEFILE
install:
\$(MAKE) -f $NGX_MAKEFILE install
modules:
\$(MAKE) -f $NGX_MAKEFILE modules
upgrade:
$NGX_SBIN_PATH -t
kill -USR2 \`cat $NGX_PID_PATH\`
sleep 1
test -f $NGX_PID_PATH.oldbin
kill -QUIT \`cat $NGX_PID_PATH.oldbin\`
END

@ -0,0 +1,54 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ $USE_PCRE = YES -o $PCRE != NONE ]; then
. auto/lib/pcre/conf
else
if [ $USE_PCRE = DISABLED -a $HTTP = YES -a $HTTP_REWRITE = YES ]; then
cat << END
$0: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option or you have to enable the PCRE support.
END
exit 1
fi
fi
if [ $USE_OPENSSL = YES ]; then
. auto/lib/openssl/conf
fi
if [ $USE_ZLIB = YES ]; then
. auto/lib/zlib/conf
fi
if [ $USE_LIBXSLT != NO ]; then
. auto/lib/libxslt/conf
fi
if [ $USE_LIBGD != NO ]; then
. auto/lib/libgd/conf
fi
if [ $USE_PERL != NO ]; then
. auto/lib/perl/conf
fi
if [ $USE_GEOIP != NO ]; then
. auto/lib/geoip/conf
fi
if [ $NGX_GOOGLE_PERFTOOLS = YES ]; then
. auto/lib/google-perftools/conf
fi
if [ $NGX_LIBATOMIC != NO ]; then
. auto/lib/libatomic/conf
fi

@ -0,0 +1,97 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
ngx_feature="GeoIP library"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <GeoIP.h>"
ngx_feature_path=
ngx_feature_libs="-lGeoIP"
ngx_feature_test="GeoIP_open(NULL, 0)"
. auto/feature
if [ $ngx_found = no ]; then
# FreeBSD port
ngx_feature="GeoIP library in /usr/local/"
ngx_feature_path="/usr/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lGeoIP"
else
ngx_feature_libs="-L/usr/local/lib -lGeoIP"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# NetBSD port
ngx_feature="GeoIP library in /usr/pkg/"
ngx_feature_path="/usr/pkg/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lGeoIP"
else
ngx_feature_libs="-L/usr/pkg/lib -lGeoIP"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# MacPorts
ngx_feature="GeoIP library in /opt/local/"
ngx_feature_path="/opt/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lGeoIP"
else
ngx_feature_libs="-L/opt/local/lib -lGeoIP"
fi
. auto/feature
fi
if [ $ngx_found = yes ]; then
CORE_INCS="$CORE_INCS $ngx_feature_path"
if [ $USE_GEOIP = YES ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
fi
NGX_LIB_GEOIP=$ngx_feature_libs
ngx_feature="GeoIP IPv6 support"
ngx_feature_name="NGX_HAVE_GEOIP_V6"
ngx_feature_run=no
ngx_feature_incs="#include <stdio.h>
#include <GeoIP.h>"
#ngx_feature_path=
#ngx_feature_libs=
ngx_feature_test="printf(\"%d\", GEOIP_CITY_EDITION_REV0_V6);"
. auto/feature
else
cat << END
$0: error: the GeoIP module requires the GeoIP library.
You can either do not enable the module or install the library.
END
exit 1
fi

@ -0,0 +1,62 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
ngx_feature="Google perftools"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs="-lprofiler"
ngx_feature_test="void ProfilerStop(void);
ProfilerStop()"
. auto/feature
if [ $ngx_found = no ]; then
# FreeBSD port
ngx_feature="Google perftools in /usr/local/"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lprofiler"
else
ngx_feature_libs="-L/usr/local/lib -lprofiler"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# MacPorts
ngx_feature="Google perftools in /opt/local/"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lprofiler"
else
ngx_feature_libs="-L/opt/local/lib -lprofiler"
fi
. auto/feature
fi
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
else
cat << END
$0: error: the Google perftools module requires the Google perftools
library. You can either do not enable the module or install the library.
END
exit 1
fi

@ -0,0 +1,43 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ $NGX_LIBATOMIC != YES ]; then
have=NGX_HAVE_LIBATOMIC . auto/have
CORE_INCS="$CORE_INCS $NGX_LIBATOMIC/src"
LINK_DEPS="$LINK_DEPS $NGX_LIBATOMIC/src/libatomic_ops.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBATOMIC/src/libatomic_ops.a"
else
ngx_feature="atomic_ops library"
ngx_feature_name=NGX_HAVE_LIBATOMIC
ngx_feature_run=yes
ngx_feature_incs="#define AO_REQUIRE_CAS
#include <atomic_ops.h>"
ngx_feature_path=
ngx_feature_libs="-latomic_ops"
ngx_feature_test="long n = 0;
if (!AO_compare_and_swap(&n, 0, 1))
return 1;
if (AO_fetch_and_add(&n, 1) != 1)
return 1;
if (n != 2)
return 1;
AO_nop();"
. auto/feature
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
else
cat << END
$0: error: libatomic_ops library was not found.
END
exit 1
fi
fi

@ -0,0 +1,16 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
cat << END >> $NGX_MAKEFILE
$NGX_LIBATOMIC/src/libatomic_ops.a: $NGX_LIBATOMIC/Makefile
cd $NGX_LIBATOMIC && \$(MAKE)
$NGX_LIBATOMIC/Makefile: $NGX_MAKEFILE
cd $NGX_LIBATOMIC \\
&& if [ -f Makefile ]; then \$(MAKE) distclean; fi \\
&& ./configure
END

@ -0,0 +1,95 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
ngx_feature="GD library"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <gd.h>"
ngx_feature_path=
ngx_feature_libs="-lgd"
ngx_feature_test="gdImagePtr img = gdImageCreateFromGifPtr(1, NULL);
(void) img"
. auto/feature
if [ $ngx_found = no ]; then
# FreeBSD port
ngx_feature="GD library in /usr/local/"
ngx_feature_path="/usr/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lgd"
else
ngx_feature_libs="-L/usr/local/lib -lgd"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# NetBSD port
ngx_feature="GD library in /usr/pkg/"
ngx_feature_path="/usr/pkg/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lgd"
else
ngx_feature_libs="-L/usr/pkg/lib -lgd"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# MacPorts
ngx_feature="GD library in /opt/local/"
ngx_feature_path="/opt/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lgd"
else
ngx_feature_libs="-L/opt/local/lib -lgd"
fi
. auto/feature
fi
if [ $ngx_found = yes ]; then
CORE_INCS="$CORE_INCS $ngx_feature_path"
if [ $USE_LIBGD = YES ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
fi
NGX_LIB_LIBGD=$ngx_feature_libs
ngx_feature="GD WebP support"
ngx_feature_name="NGX_HAVE_GD_WEBP"
ngx_feature_test="gdImagePtr img = gdImageCreateFromWebpPtr(1, NULL);
(void) img"
. auto/feature
else
cat << END
$0: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.
END
exit 1
fi

@ -0,0 +1,165 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
ngx_feature="libxslt"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>"
ngx_feature_path="/usr/include/libxml2"
ngx_feature_libs="-lxml2 -lxslt"
ngx_feature_test="xmlParserCtxtPtr ctxt = NULL;
xsltStylesheetPtr sheet = NULL;
xmlDocPtr doc = NULL;
xmlParseChunk(ctxt, NULL, 0, 0);
xsltApplyStylesheet(sheet, doc, NULL);"
. auto/feature
if [ $ngx_found = no ]; then
# FreeBSD port
ngx_feature="libxslt in /usr/local/"
ngx_feature_path="/usr/local/include/libxml2 /usr/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lxml2 -lxslt"
else
ngx_feature_libs="-L/usr/local/lib -lxml2 -lxslt"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# NetBSD port
ngx_feature="libxslt in /usr/pkg/"
ngx_feature_path="/usr/pkg/include/libxml2 /usr/pkg/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lxml2 -lxslt"
else
ngx_feature_libs="-L/usr/pkg/lib -lxml2 -lxslt"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# MacPorts
ngx_feature="libxslt in /opt/local/"
ngx_feature_path="/opt/local/include/libxml2 /opt/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lxml2 -lxslt"
else
ngx_feature_libs="-L/opt/local/lib -lxml2 -lxslt"
fi
. auto/feature
fi
if [ $ngx_found = yes ]; then
CORE_INCS="$CORE_INCS $ngx_feature_path"
if [ $USE_LIBXSLT = YES ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
fi
NGX_LIB_LIBXSLT=$ngx_feature_libs
else
cat << END
$0: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries.
END
exit 1
fi
ngx_feature="libexslt"
ngx_feature_name=NGX_HAVE_EXSLT
ngx_feature_run=no
ngx_feature_incs="#include <libexslt/exslt.h>"
ngx_feature_path="/usr/include/libxml2"
ngx_feature_libs="-lexslt"
ngx_feature_test="exsltRegisterAll();"
. auto/feature
if [ $ngx_found = no ]; then
# FreeBSD port
ngx_feature="libexslt in /usr/local/"
ngx_feature_path="/usr/local/include/libxml2 /usr/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lexslt"
else
ngx_feature_libs="-L/usr/local/lib -lexslt"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# NetBSD port
ngx_feature="libexslt in /usr/pkg/"
ngx_feature_path="/usr/pkg/include/libxml2 /usr/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lexslt"
else
ngx_feature_libs="-L/usr/pkg/lib -lexslt"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# MacPorts
ngx_feature="libexslt in /opt/local/"
ngx_feature_path="/opt/local/include/libxml2 /opt/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lexslt"
else
ngx_feature_libs="-L/opt/local/lib -lexslt"
fi
. auto/feature
fi
if [ $ngx_found = yes ]; then
if [ $USE_LIBXSLT = YES ]; then
CORE_LIBS="$CORE_LIBS -lexslt"
fi
NGX_LIB_LIBXSLT="$NGX_LIB_LIBXSLT -lexslt"
fi

@ -0,0 +1,24 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ $PCRE != NONE -a $PCRE != NO -a $PCRE != YES ]; then
. auto/lib/pcre/make
fi
if [ $OPENSSL != NONE -a $OPENSSL != NO -a $OPENSSL != YES ]; then
. auto/lib/openssl/make
fi
if [ $ZLIB != NONE -a $ZLIB != NO -a $ZLIB != YES ]; then
. auto/lib/zlib/make
fi
if [ $NGX_LIBATOMIC != NO -a $NGX_LIBATOMIC != YES ]; then
. auto/lib/libatomic/make
fi
if [ $USE_PERL != NO ]; then
. auto/lib/perl/make
fi

@ -0,0 +1,142 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ $OPENSSL != NONE ]; then
case "$CC" in
cl | bcc32)
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
CFLAGS="$CFLAGS -DNO_SYS_TYPES_H"
CORE_INCS="$CORE_INCS $OPENSSL/openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/openssl/include/openssl/ssl.h"
if [ -f $OPENSSL/ms/do_ms.bat ]; then
# before OpenSSL 1.1.0
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/ssleay32.lib"
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libeay32.lib"
else
# OpenSSL 1.1.0+
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libssl.lib"
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libcrypto.lib"
fi
# libeay32.lib requires gdi32.lib
CORE_LIBS="$CORE_LIBS gdi32.lib"
# OpenSSL 1.0.0 requires crypt32.lib
CORE_LIBS="$CORE_LIBS crypt32.lib"
;;
*)
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
CORE_LIBS="$CORE_LIBS $NGX_LIBPTHREAD"
if [ "$NGX_PLATFORM" = win32 ]; then
CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32"
fi
;;
esac
else
if [ "$NGX_PLATFORM" != win32 ]; then
OPENSSL=NO
ngx_feature="OpenSSL library"
ngx_feature_name="NGX_OPENSSL"
ngx_feature_run=no
ngx_feature_incs="#include <openssl/ssl.h>"
ngx_feature_path=
ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL $NGX_LIBPTHREAD"
ngx_feature_test="SSL_CTX_set_options(NULL, 0)"
. auto/feature
if [ $ngx_found = no ]; then
# FreeBSD port
ngx_feature="OpenSSL library in /usr/local/"
ngx_feature_path="/usr/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto"
else
ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto"
fi
ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
. auto/feature
fi
if [ $ngx_found = no ]; then
# NetBSD port
ngx_feature="OpenSSL library in /usr/pkg/"
ngx_feature_path="/usr/pkg/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto"
else
ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto"
fi
ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
. auto/feature
fi
if [ $ngx_found = no ]; then
# MacPorts
ngx_feature="OpenSSL library in /opt/local/"
ngx_feature_path="/opt/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto"
else
ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto"
fi
ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
. auto/feature
fi
if [ $ngx_found = yes ]; then
have=NGX_SSL . auto/have
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
OPENSSL=YES
fi
fi
if [ $OPENSSL != YES ]; then
cat << END
$0: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
END
exit 1
fi
fi

@ -0,0 +1,62 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
case "$CC" in
cl)
cat << END >> $NGX_MAKEFILE
$OPENSSL/openssl/include/openssl/ssl.h: $NGX_MAKEFILE
\$(MAKE) -f auto/lib/openssl/makefile.msvc \
OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT"
END
;;
bcc32)
ngx_opt=`echo "-DOPENSSL=\"$OPENSSL\" -DOPENSSL_OPT=\"$OPENSSL_OPT\"" \
| sed -e "s/\//$ngx_regex_dirsep/g"`
cat << END >> $NGX_MAKEFILE
`echo "$OPENSSL\\openssl\\lib\\libeay32.lib: \
$OPENSSL\\openssl\\include\\openssl\\ssl.h" \
| sed -e "s/\//$ngx_regex_dirsep/g"`
`echo "$OPENSSL\\openssl\\lib\\ssleay32.lib: \
$OPENSSL\\openssl\\include\\openssl\\ssl.h" \
| sed -e "s/\//$ngx_regex_dirsep/g"`
`echo "$OPENSSL\\openssl\\include\\openssl\\ssl.h: $NGX_MAKEFILE" \
| sed -e "s/\//$ngx_regex_dirsep/g"`
\$(MAKE) -f auto/lib/openssl/makefile.bcc $ngx_opt
END
;;
*)
case $OPENSSL in
/*) ngx_prefix="$OPENSSL/.openssl" ;;
*) ngx_prefix="$PWD/$OPENSSL/.openssl" ;;
esac
cat << END >> $NGX_MAKEFILE
$OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE
cd $OPENSSL \\
&& if [ -f Makefile ]; then \$(MAKE) clean; fi \\
&& ./config --prefix=$ngx_prefix no-shared no-threads $OPENSSL_OPT \\
&& \$(MAKE) \\
&& \$(MAKE) install_sw LIBDIR=lib
END
;;
esac

@ -0,0 +1,18 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
all:
cd $(OPENSSL)
perl Configure BC-32 no-shared --prefix=openssl $(OPENSSL_OPT)
ms\do_nasm
$(MAKE) -f ms\bcb.mak
$(MAKE) -f ms\bcb.mak install
# Borland's make does not expand "[ch]" in
# copy "inc32\openssl\*.[ch]" "openssl\include\openssl"
copy inc32\openssl\*.h openssl\include\openssl

@ -0,0 +1,21 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
all:
cd $(OPENSSL)
perl Configure VC-WIN32 no-shared \
--prefix="%cd%/openssl" \
--openssldir="%cd%/openssl/ssl" \
$(OPENSSL_OPT)
if exist ms\do_ms.bat ( \
ms\do_ms \
&& $(MAKE) -f ms\nt.mak \
&& $(MAKE) -f ms\nt.mak install \
) else ( \
$(MAKE) \
&& $(MAKE) install_sw \
)

@ -0,0 +1,203 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ $PCRE != NONE ]; then
CORE_INCS="$CORE_INCS $PCRE"
case "$NGX_CC_NAME" in
msvc | owc | bcc)
have=NGX_PCRE . auto/have
have=PCRE_STATIC . auto/have
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib"
CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
;;
icc)
have=NGX_PCRE . auto/have
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
echo $ngx_n "checking for PCRE library ...$ngx_c"
if [ -f $PCRE/pcre.h ]; then
ngx_pcre_ver=`grep PCRE_MAJOR $PCRE/pcre.h \
| sed -e 's/^.*PCRE_MAJOR.* \(.*\)$/\1/'`
else if [ -f $PCRE/configure.in ]; then
ngx_pcre_ver=`grep PCRE_MAJOR= $PCRE/configure.in \
| sed -e 's/^.*=\(.*\)$/\1/'`
else
ngx_pcre_ver=`grep pcre_major, $PCRE/configure.ac \
| sed -e 's/^.*pcre_major,.*\[\(.*\)\].*$/\1/'`
fi
fi
echo " $ngx_pcre_ver major version found"
# to allow -ipo optimization we link with the *.o but not library
case "$ngx_pcre_ver" in
4|5)
CORE_LIBS="$CORE_LIBS $PCRE/pcre.o"
;;
6)
CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o"
;;
*)
CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_newline.o"
;;
esac
;;
*)
have=NGX_PCRE . auto/have
if [ "$NGX_PLATFORM" = win32 ]; then
have=PCRE_STATIC . auto/have
fi
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a"
;;
esac
if [ $PCRE_JIT = YES ]; then
have=NGX_HAVE_PCRE_JIT . auto/have
PCRE_CONF_OPT="$PCRE_CONF_OPT --enable-jit"
fi
else
if [ "$NGX_PLATFORM" != win32 ]; then
PCRE=NO
ngx_feature="PCRE library"
ngx_feature_name="NGX_PCRE"
ngx_feature_run=no
ngx_feature_incs="#include <pcre.h>"
ngx_feature_path=
ngx_feature_libs="-lpcre"
ngx_feature_test="pcre *re;
re = pcre_compile(NULL, 0, NULL, 0, NULL);
if (re == NULL) return 1"
. auto/feature
if [ $ngx_found = no ]; then
# FreeBSD port
ngx_feature="PCRE library in /usr/local/"
ngx_feature_path="/usr/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lpcre"
else
ngx_feature_libs="-L/usr/local/lib -lpcre"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# RedHat RPM, Solaris package
ngx_feature="PCRE library in /usr/include/pcre/"
ngx_feature_path="/usr/include/pcre"
ngx_feature_libs="-lpcre"
. auto/feature
fi
if [ $ngx_found = no ]; then
# NetBSD port
ngx_feature="PCRE library in /usr/pkg/"
ngx_feature_path="/usr/pkg/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre"
else
ngx_feature_libs="-L/usr/pkg/lib -lpcre"
fi
. auto/feature
fi
if [ $ngx_found = no ]; then
# MacPorts
ngx_feature="PCRE library in /opt/local/"
ngx_feature_path="/opt/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre"
else
ngx_feature_libs="-L/opt/local/lib -lpcre"
fi
. auto/feature
fi
if [ $ngx_found = yes ]; then
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
PCRE=YES
fi
if [ $PCRE = YES ]; then
ngx_feature="PCRE JIT support"
ngx_feature_name="NGX_HAVE_PCRE_JIT"
ngx_feature_test="int jit = 0;
pcre_free_study(NULL);
pcre_config(PCRE_CONFIG_JIT, &jit);
if (jit != 1) return 1;"
. auto/feature
if [ $ngx_found = yes ]; then
PCRE_JIT=YES
fi
fi
fi
if [ $PCRE != YES ]; then
cat << END
$0: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
END
exit 1
fi
fi

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save