@anov/3d-ability 0.0.4-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/city/flyinglead.d.ts +0 -0
- package/dist/city/flyinglead.js +0 -0
- package/dist/city/radar.d.ts +0 -0
- package/dist/city/radar.js +0 -0
- package/dist/city/scanning.d.ts +0 -0
- package/dist/city/scanning.js +0 -0
- package/dist/city/surroundLine.d.ts +0 -0
- package/dist/city/surroundLine.js +0 -0
- package/dist/core/mouseDrawe.d.ts +2 -0
- package/dist/core/mouseDrawe.js +1 -0
- package/dist/environment/cloud/cloud.d.ts +1 -0
- package/dist/environment/cloud/cloud.js +1 -0
- package/dist/environment/cloud/index.d.ts +7 -0
- package/dist/environment/cloud/index.js +60 -0
- package/dist/environment/rain.d.ts +20 -0
- package/dist/environment/rain.js +44 -0
- package/dist/environment/rainShder/index.d.ts +8 -0
- package/dist/environment/rainShder/index.js +70 -0
- package/dist/environment/rainShder/shader.d.ts +26 -0
- package/dist/environment/rainShder/shader.js +28 -0
- package/dist/environment/shaderCloud/cloudMaterial.d.ts +10 -0
- package/dist/environment/shaderCloud/cloudMaterial.js +39 -0
- package/dist/environment/shaderCloud/index.d.ts +2 -0
- package/dist/environment/shaderCloud/index.js +45 -0
- package/dist/environment/shaderCloud/shader.d.ts +5 -0
- package/dist/environment/shaderCloud/shader.js +6 -0
- package/dist/environment/showShder/index.d.ts +8 -0
- package/dist/environment/showShder/index.js +73 -0
- package/dist/environment/showShder/shader.d.ts +28 -0
- package/dist/environment/showShder/shader.js +32 -0
- package/dist/environment/sky/index.d.ts +12 -0
- package/dist/environment/sky/index.js +116 -0
- package/dist/environment/snow.d.ts +16 -0
- package/dist/environment/snow.js +45 -0
- package/dist/environment/sun/index.d.ts +13 -0
- package/dist/environment/sun/index.js +76 -0
- package/dist/environment/utils/points.d.ts +26 -0
- package/dist/environment/utils/points.js +55 -0
- package/dist/environment/volumetricCloud/cloudMaterial.d.ts +3 -0
- package/dist/environment/volumetricCloud/cloudMaterial.js +60 -0
- package/dist/environment/volumetricCloud/inex.d.ts +8 -0
- package/dist/environment/volumetricCloud/inex.js +42 -0
- package/dist/helper/view/index.d.ts +40 -0
- package/dist/helper/view/index.js +385 -0
- package/dist/helper/view/utils.d.ts +6 -0
- package/dist/helper/view/utils.js +91 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +20 -0
- package/dist/material/pristineGridMaterial/index.d.ts +20 -0
- package/dist/material/pristineGridMaterial/index.js +102 -0
- package/dist/material/pristineGridMaterial/shader/fragment.d.ts +2 -0
- package/dist/material/pristineGridMaterial/shader/fragment.js +1 -0
- package/dist/material/pristineGridMaterial/shader/vertex.d.ts +2 -0
- package/dist/material/pristineGridMaterial/shader/vertex.js +1 -0
- package/dist/postEffects/bloomPass.d.ts +5 -0
- package/dist/postEffects/bloomPass.js +30 -0
- package/dist/postEffects/index.d.ts +11 -0
- package/dist/postEffects/index.js +32 -0
- package/dist/postEffects/outlinePass.d.ts +16 -0
- package/dist/postEffects/outlinePass.js +51 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +3 -0
- package/package.json +29 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
import { Mesh, PlaneGeometry, ShaderMaterial, Vector2, use } from '@anov/3d-core';
|
|
9
|
+
import rainShader from "./shader";
|
|
10
|
+
var Snow = /*#__PURE__*/function () {
|
|
11
|
+
function Snow() {
|
|
12
|
+
_classCallCheck(this, Snow);
|
|
13
|
+
_defineProperty(this, "meshes", []);
|
|
14
|
+
this.initGeometry();
|
|
15
|
+
}
|
|
16
|
+
_createClass(Snow, [{
|
|
17
|
+
key: "initGeometry",
|
|
18
|
+
value: function initGeometry() {
|
|
19
|
+
var _this = this;
|
|
20
|
+
var _use$useScene = use.useScene(),
|
|
21
|
+
scene = _use$useScene.scene,
|
|
22
|
+
camera = _use$useScene.camera;
|
|
23
|
+
if (!scene && !camera) throw new Error('please init scene and camera first');
|
|
24
|
+
var geometry = new PlaneGeometry(10000, 10000);
|
|
25
|
+
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
rainShader.uniforms.iResolution.value = new Vector2(window.innerWidth, window.innerHeight);
|
|
28
|
+
var material = new ShaderMaterial({
|
|
29
|
+
uniforms: rainShader.uniforms,
|
|
30
|
+
side: 2,
|
|
31
|
+
depthWrite: false,
|
|
32
|
+
transparent: true,
|
|
33
|
+
blending: 2,
|
|
34
|
+
vertexShader: rainShader.vertexShader,
|
|
35
|
+
fragmentShader: rainShader.fragmentShader
|
|
36
|
+
});
|
|
37
|
+
for (var i = 0; i < 10; i++) {
|
|
38
|
+
var mesh = new Mesh(geometry, material);
|
|
39
|
+
// const mesh = new Mesh(geometry, new MeshBasicMaterial({ color: new Color(Math.random() * 0xFFFFFF) }))
|
|
40
|
+
mesh.position.z = -10000 + i * 1000;
|
|
41
|
+
mesh.scale.x = Math.random() * 0.5 + 1;
|
|
42
|
+
mesh.scale.y = Math.random() * 0.5 + 1;
|
|
43
|
+
scene.add(mesh);
|
|
44
|
+
this.meshes.push(mesh);
|
|
45
|
+
}
|
|
46
|
+
use.useframe(function () {
|
|
47
|
+
rainShader.uniforms.iTime.value += 0.01;
|
|
48
|
+
_this.meshes.forEach(function (mesh) {
|
|
49
|
+
mesh.lookAt(camera.position.x, camera.position.y * 0.1, camera.position.z);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "stop",
|
|
55
|
+
value: function stop() {
|
|
56
|
+
this.meshes.forEach(function (mesh) {
|
|
57
|
+
mesh.visible = false;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "continue",
|
|
62
|
+
value: function _continue() {
|
|
63
|
+
this.meshes.forEach(function (mesh) {
|
|
64
|
+
mesh.visible = true;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
return Snow;
|
|
69
|
+
}();
|
|
70
|
+
export default Snow;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Color } from '@anov/3d-core';
|
|
2
|
+
declare const rainShader: {
|
|
3
|
+
uniforms: {
|
|
4
|
+
tDiffuse: {
|
|
5
|
+
value: null;
|
|
6
|
+
};
|
|
7
|
+
iResolution: {
|
|
8
|
+
value: null;
|
|
9
|
+
};
|
|
10
|
+
iTime: {
|
|
11
|
+
value: number;
|
|
12
|
+
};
|
|
13
|
+
radian: {
|
|
14
|
+
value: number;
|
|
15
|
+
};
|
|
16
|
+
rainSpeed: {
|
|
17
|
+
value: number;
|
|
18
|
+
};
|
|
19
|
+
rainColor: {
|
|
20
|
+
value: Color;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
vertexShader: string;
|
|
24
|
+
fragmentShader: string;
|
|
25
|
+
};
|
|
26
|
+
export default rainShader;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Color } from '@anov/3d-core';
|
|
2
|
+
|
|
3
|
+
// source from https://www.shadertoy.com/view/wd2GDG
|
|
4
|
+
var rainShader = {
|
|
5
|
+
uniforms: {
|
|
6
|
+
tDiffuse: {
|
|
7
|
+
value: null
|
|
8
|
+
},
|
|
9
|
+
iResolution: {
|
|
10
|
+
value: null
|
|
11
|
+
},
|
|
12
|
+
iTime: {
|
|
13
|
+
value: 0
|
|
14
|
+
},
|
|
15
|
+
radian: {
|
|
16
|
+
value: 0
|
|
17
|
+
},
|
|
18
|
+
rainSpeed: {
|
|
19
|
+
value: 0.1
|
|
20
|
+
},
|
|
21
|
+
rainColor: {
|
|
22
|
+
value: new Color(1, 1, 1)
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
vertexShader: /* glsl */"\n varying highp vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
26
|
+
fragmentShader: /* glsl */"\n\n uniform sampler2D tDiffuse;\n uniform vec2 iResolution;\n uniform float iTime;\n uniform float radian;\n uniform float rainSpeed;\n uniform vec3 rainColor;\n varying highp vec2 vUv;\n\n float random(float t){\n return fract(sin(t*745.523)*7894.552);\n }\n \n\n void main(){\n vec3 col=texture(tDiffuse,vUv).rgb;\n\n //vec2 uv = gl_FragCoord.xy/iResolution.xy;\n vec2 uv =vUv;\n mat2 r=mat2(cos(radian),-sin(radian),sin(radian),cos(radian));\n uv*=r;\n uv.y += iTime*2.0*rainSpeed;\n uv.xy *= 500.0;///\u96E8\u70B9\u4E2A\u6570\n uv.y += random(floor(uv.x))*500.0;\n //vec3 rain=vec3(clamp(1.0-length(vec2(cos(uv.x*3.1415 ), sin(uv.y*0.2)-1.7)), 0.0,1.0))*rainColor;///1.7\u90A3\u4E2A\u662F\u96E8\u70B9\u6D53\u5EA60.2\u90A3\u4E2A\u662F\u96E8\u6EF4\u957F\u5EA6\n vec3 rain=vec3(clamp(1.0-length(vec2(cos(uv.x*3.1415 ), sin(uv.y*0.09)-1.90)), 0.0,1.0))*rainColor;\n gl_FragColor = vec4(col+rain,0.7);\n }"
|
|
27
|
+
};
|
|
28
|
+
export default rainShader;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ShaderMaterial } from '@anov/3d-core';
|
|
2
|
+
declare type CloudMaterialOptions = {
|
|
3
|
+
opacity?: number;
|
|
4
|
+
density?: number;
|
|
5
|
+
};
|
|
6
|
+
declare class CloudMaterial {
|
|
7
|
+
material: ShaderMaterial;
|
|
8
|
+
constructor(opts: CloudMaterialOptions);
|
|
9
|
+
}
|
|
10
|
+
export default CloudMaterial;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
import { ShaderMaterial } from '@anov/3d-core';
|
|
9
|
+
import CloudShader from "./shader";
|
|
10
|
+
var CloudMaterial = /*#__PURE__*/_createClass(function CloudMaterial(opts) {
|
|
11
|
+
var _opts$opacity, _opts$density;
|
|
12
|
+
_classCallCheck(this, CloudMaterial);
|
|
13
|
+
_defineProperty(this, "material", void 0);
|
|
14
|
+
this.material = new ShaderMaterial({
|
|
15
|
+
uniforms: {
|
|
16
|
+
iResolution: {
|
|
17
|
+
value: null
|
|
18
|
+
},
|
|
19
|
+
iTime: {
|
|
20
|
+
value: 0
|
|
21
|
+
},
|
|
22
|
+
cloudDensity: {
|
|
23
|
+
value: 0.8
|
|
24
|
+
},
|
|
25
|
+
skyAlpha: {
|
|
26
|
+
value: (_opts$opacity = opts.opacity) !== null && _opts$opacity !== void 0 ? _opts$opacity : 0.0
|
|
27
|
+
},
|
|
28
|
+
cloudscale: {
|
|
29
|
+
value: (_opts$density = opts.density) !== null && _opts$density !== void 0 ? _opts$density : 5.4
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
side: 2,
|
|
33
|
+
vertexShader: CloudShader.vertexShader,
|
|
34
|
+
fragmentShader: CloudShader.fragmentShader,
|
|
35
|
+
depthWrite: false,
|
|
36
|
+
transparent: true
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
export default CloudMaterial;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ModelLoader, use } from '@anov/3d-core';
|
|
2
|
+
import Materialcloud from "./cloudMaterial";
|
|
3
|
+
var loader = new ModelLoader();
|
|
4
|
+
var createSkyCloud = function createSkyCloud(opacity, density) {
|
|
5
|
+
var _use$useScene = use.useScene(),
|
|
6
|
+
scene = _use$useScene.scene;
|
|
7
|
+
var isNeedUpdate = false;
|
|
8
|
+
var currentDensity = 5.4;
|
|
9
|
+
if (!scene) throw new Error('scene is not defined');
|
|
10
|
+
var cloudModel;
|
|
11
|
+
loader.loadGLTF('http://182.92.210.127:8009/image/skySphereMesh.glb', false, false, undefined, function (gltf) {
|
|
12
|
+
var model = gltf.scene;
|
|
13
|
+
cloudModel = model;
|
|
14
|
+
model.scale.set(10000, 15000, 10000);
|
|
15
|
+
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
model.children[0].material = new Materialcloud({
|
|
18
|
+
opacity: opacity !== null && opacity !== void 0 ? opacity : 0.6,
|
|
19
|
+
density: density !== null && density !== void 0 ? density : 5.4
|
|
20
|
+
}).material;
|
|
21
|
+
scene.add(model);
|
|
22
|
+
use.useframe(function () {
|
|
23
|
+
isNeedUpdate && (
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
model.children[0].material = new Materialcloud({
|
|
26
|
+
opacity: opacity !== null && opacity !== void 0 ? opacity : 0.6,
|
|
27
|
+
density: currentDensity
|
|
28
|
+
}).material);
|
|
29
|
+
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
model.children[0].material.uniforms.iTime.value += 0.03;
|
|
32
|
+
isNeedUpdate = false;
|
|
33
|
+
});
|
|
34
|
+
return gltf;
|
|
35
|
+
});
|
|
36
|
+
var setCloudDensity = function setCloudDensity(density) {
|
|
37
|
+
isNeedUpdate = true;
|
|
38
|
+
currentDensity = density !== null && density !== void 0 ? density : currentDensity;
|
|
39
|
+
};
|
|
40
|
+
var clear = function clear() {
|
|
41
|
+
cloudModel && cloudModel.removeFromParent();
|
|
42
|
+
};
|
|
43
|
+
return [setCloudDensity, clear];
|
|
44
|
+
};
|
|
45
|
+
export default createSkyCloud;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* eslint-disable no-tabs */
|
|
2
|
+
var CloudShader = {
|
|
3
|
+
vertexShader: /* glsl */"\n\n varying highp vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
|
|
4
|
+
fragmentShader: /* glsl */"\nprecision highp float;\nuniform float skyAlpha;\nuniform float iTime;\nuniform float cloudDensity;\nuniform float cloudscale;\nconst float speed = 0.02;\nconst float clouddark = 0.5;\nconst float cloudlight = 0.3;\nconst float cloudcover = 0.2;\nconst float cloudalpha = 8.0;\nconst float skytint = 0.5;\nconst vec3 skycolour1 = vec3(0.2, 0.4, 0.6);\nconst vec3 skycolour2 = vec3(0.4, 0.7, 1.0);\n\nconst mat2 m = mat2( 1.6, 1.2, -1.2, 1.6 );\nconst vec2 iResolution = vec2(0.001,0.001);\nvarying highp vec2 vUv;\n\nvec2 hash( vec2 p ) {\np = vec2(dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)));\nreturn -1.0 + 2.0*fract(sin(p)*43758.5453123);\n}\n\nfloat noise( in vec2 p ) {\n const float K1 = 0.366025404; // (sqrt(3)-1)/2;\n const float K2 = 0.211324865; // (3-sqrt(3))/6;\n\tvec2 i = floor(p + (p.x+p.y)*K1);\n vec2 a = p - i + (i.x+i.y)*K2;\n vec2 o = (a.x>a.y) ? vec2(1.0,0.0) : vec2(0.0,1.0); //vec2 of = 0.5 + 0.5*vec2(sign(a.x-a.y), sign(a.y-a.x));\n vec2 b = a - o + K2;\n\tvec2 c = a - 1.0 + 2.0*K2;\n vec3 h = max(0.5-vec3(dot(a,a), dot(b,b), dot(c,c) ), 0.0 );\n\tvec3 n = h*h*h*h*vec3( dot(a,hash(i+0.0)), dot(b,hash(i+o)), dot(c,hash(i+1.0)));\n return dot(n, vec3(70.0));\n}\n\nfloat fbm(vec2 n) {\n\tfloat total = 0.0, amplitude = 0.1;\n\tfor (int i = 0; i < 7; i++) {\n\t\ttotal += noise(n) * amplitude;\n\t\tn = m * n;\n\t\tamplitude *= 0.4;\n\t}\n\treturn total*1.0;\n}\n\n// -----------------------------------------------\nfloat distanceTo(vec2 src, vec2 dst) {\n float dx = src.x - dst.x;\n float dy = src.y - dst.y;\n float dv = dx * dx + dy * dy;\n return sqrt(dv);\n}\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord ) {\n // vec2 p = fragCoord.xy / iResolution.xy;\n vec2 p = vUv*1.;\n\tvec2 uv = p*vec2(iResolution.x/iResolution.y,1.0);\n float time = iTime * speed;\n float q = fbm(uv * cloudscale * 0.5);\n////////\u538B\u8FB9\n float dis= max(max((p.x*51.-50.0), 1.-(p.x*51.)),max((p.y*3.-2.), 1.-(p.y*3.)));\n float sphere =pow(distanceTo(vec2(0.5,0.5),p),8.)*1000.;/////\u753B\u5706\u57082\n\n\n //ridged noise shape\n\tfloat r = 0.0;\n\tuv *= cloudscale;\n uv -= q - time;\n float weight = 0.8;\n for (int i=0; i<8; i++){\n\t\tr += abs(weight*noise( uv ));\n uv = m*uv + time;\n\t\tweight *= 0.7;\n }\n\n //noise shape\n\tfloat f = 0.0;\n uv = p*vec2(iResolution.x/iResolution.y,1.0);\n\tuv *= cloudscale;\n uv -= q - time;\n weight = 0.7;\n for (int i=0; i<8; i++){\n\t\tf += weight*noise( uv );\n uv = m*uv + time;\n\t\tweight *= 0.6;\n }\n\n f *= r + f;\n\n //noise colour\n float c = 0.0;\n time = iTime * speed * 2.0;\n uv = p*vec2(iResolution.x/iResolution.y,1.0);\n\tuv *= cloudscale*2.0;\n uv -= q - time;\n weight = 0.4;\n for (int i=0; i<7; i++){\n\t\tc += weight*noise( uv );\n uv = m*uv + time;\n\t\tweight *= 0.6;\n }\n\n //noise ridge colour\n float c1 = 0.0;\n time = iTime * speed * 3.0;\n uv = p*vec2(iResolution.x/iResolution.y,1.0);\n\tuv *= cloudscale*3.0;\n uv -= q - time;\n weight = 0.4;\n for (int i=0; i<7; i++){\n\t\tc1 += abs(weight*noise( uv ));\n uv = m*uv + time;\n\t\tweight *= 0.6;\n }\n\n c += c1;\n\n vec3 skycolour = mix(skycolour2, skycolour1, p.y)+sphere*0.3;\n vec3 cloudcolour = vec3(1.1, 1.1, 0.9) * clamp((clouddark + cloudlight*c), 0.0, 1.0);\n\n f = cloudcover + cloudalpha*f*r;\n\n float cloudIntensity = clamp(f + c, 0.0, 1.0) * (cloudDensity);\n\n vec3 result = mix(skycolour, clamp(skytint * skycolour + cloudcolour, 0.0, 1.0), cloudIntensity);\n\n\tfragColor = vec4(result, 0.5);\n //fragColor = vec4(sphere,0,0,1.); ////- clamp(dis,0.,1.)\n}\n\nvoid main() {\n vec2 fragCoord = gl_FragCoord.xy;\n mainImage(gl_FragColor, fragCoord);\n}\n"
|
|
5
|
+
};
|
|
6
|
+
export default CloudShader;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
import { Mesh, PlaneGeometry, ShaderMaterial, Vector2, use } from '@anov/3d-core';
|
|
9
|
+
import snowShader from "./shader";
|
|
10
|
+
|
|
11
|
+
// todo: merge rain
|
|
12
|
+
var Snow = /*#__PURE__*/function () {
|
|
13
|
+
function Snow() {
|
|
14
|
+
_classCallCheck(this, Snow);
|
|
15
|
+
_defineProperty(this, "meshes", []);
|
|
16
|
+
this.initGeometry();
|
|
17
|
+
}
|
|
18
|
+
_createClass(Snow, [{
|
|
19
|
+
key: "initGeometry",
|
|
20
|
+
value: function initGeometry() {
|
|
21
|
+
var _this = this;
|
|
22
|
+
var _use$useScene = use.useScene(),
|
|
23
|
+
scene = _use$useScene.scene,
|
|
24
|
+
camera = _use$useScene.camera;
|
|
25
|
+
if (!scene && !camera) throw new Error('please init scene and camera first');
|
|
26
|
+
var geometry = new PlaneGeometry(10000, 10000);
|
|
27
|
+
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
snowShader.uniforms.iResolution.value = new Vector2(window.innerWidth, window.innerHeight);
|
|
30
|
+
var material = new ShaderMaterial({
|
|
31
|
+
uniforms: snowShader.uniforms,
|
|
32
|
+
side: 2,
|
|
33
|
+
transparent: true,
|
|
34
|
+
depthTest: false,
|
|
35
|
+
blending: 2,
|
|
36
|
+
vertexShader: snowShader.vertexShader,
|
|
37
|
+
fragmentShader: snowShader.fragmentShader
|
|
38
|
+
});
|
|
39
|
+
for (var i = 0; i < 10; i++) {
|
|
40
|
+
var mesh = new Mesh(geometry, material);
|
|
41
|
+
// const mesh = new Mesh(geometry, new MeshBasicMaterial({ color: new Color(Math.random() * 0xFFFFFF) }))
|
|
42
|
+
mesh.position.z = -10000 + i * 1000;
|
|
43
|
+
mesh.scale.x = Math.random() * 0.5 + 1;
|
|
44
|
+
mesh.scale.y = Math.random() * 0.5 + 1;
|
|
45
|
+
scene.add(mesh);
|
|
46
|
+
this.meshes.push(mesh);
|
|
47
|
+
}
|
|
48
|
+
use.useframe(function () {
|
|
49
|
+
snowShader.uniforms.iTime.value += 0.01;
|
|
50
|
+
snowShader.uniforms.snowSpeed.value = 1;
|
|
51
|
+
_this.meshes.forEach(function (mesh) {
|
|
52
|
+
mesh.lookAt(camera.position.x, camera.position.y * 0.1, camera.position.z);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "stop",
|
|
58
|
+
value: function stop() {
|
|
59
|
+
this.meshes.forEach(function (mesh) {
|
|
60
|
+
mesh.visible = false;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "continue",
|
|
65
|
+
value: function _continue() {
|
|
66
|
+
this.meshes.forEach(function (mesh) {
|
|
67
|
+
mesh.visible = true;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}]);
|
|
71
|
+
return Snow;
|
|
72
|
+
}();
|
|
73
|
+
export default Snow;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const snowShader: {
|
|
2
|
+
uniforms: {
|
|
3
|
+
tDiffuse: {
|
|
4
|
+
value: null;
|
|
5
|
+
};
|
|
6
|
+
iResolution: {
|
|
7
|
+
value: null;
|
|
8
|
+
};
|
|
9
|
+
iTime: {
|
|
10
|
+
value: number;
|
|
11
|
+
};
|
|
12
|
+
size: {
|
|
13
|
+
value: number;
|
|
14
|
+
};
|
|
15
|
+
density: {
|
|
16
|
+
value: number;
|
|
17
|
+
};
|
|
18
|
+
snowSpeed: {
|
|
19
|
+
value: number;
|
|
20
|
+
};
|
|
21
|
+
camVert: {
|
|
22
|
+
value: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
vertexShader: string;
|
|
26
|
+
fragmentShader: string;
|
|
27
|
+
};
|
|
28
|
+
export default snowShader;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// source from https://www.shadertoy.com/view/wt3GWH
|
|
2
|
+
var snowShader = {
|
|
3
|
+
uniforms: {
|
|
4
|
+
tDiffuse: {
|
|
5
|
+
value: null
|
|
6
|
+
},
|
|
7
|
+
iResolution: {
|
|
8
|
+
value: null
|
|
9
|
+
},
|
|
10
|
+
iTime: {
|
|
11
|
+
value: 0
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
value: 0.032
|
|
15
|
+
},
|
|
16
|
+
// 0.05
|
|
17
|
+
density: {
|
|
18
|
+
value: 1.0
|
|
19
|
+
},
|
|
20
|
+
// 1.0
|
|
21
|
+
snowSpeed: {
|
|
22
|
+
value: 0.1
|
|
23
|
+
},
|
|
24
|
+
// 1.0
|
|
25
|
+
camVert: {
|
|
26
|
+
value: 1.0
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
vertexShader: /* glsl */"\n varying highp vec2 vUv;\n varying vec3 vPosition;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
|
|
30
|
+
fragmentShader: /* glsl */"\n #define PI 3.14159265359\n uniform sampler2D tDiffuse;\n uniform vec2 iResolution;\n uniform float iTime;\n uniform float size;\n uniform float density;\n uniform float snowSpeed;\n uniform float camVert;\n varying highp vec2 vUv;\n\n float ball(vec2 p) {\n float d = distance(vec2(.5), p);\n return smoothstep(size,size - .05, d);\n }\n float N11(float n) {\n return fract(sin(n * 871.213) * 3134.422);\n }\n float N21(vec2 uv) {\n return N11(N11(uv.x) + uv.y);\n }\n \n float snow(vec2 uv, float t) {\n vec2 org_uv = vec2(uv.x, uv.y);\n float z = 10.;\n uv.y += t * .5;\n vec2 gv = fract(uv*z);\n vec2 id = floor(uv*z); \n gv.x += (sin(N21(id) * 128. + t) * .4);\n gv.y += (sin(N11(N21(id)) * 128. + t) * .4);\n float dots = ball(gv);\n return dots;\n }\n void main(){\n vec3 col=texture(tDiffuse,vUv).rgb;\n vec2 uv= vUv;\n float t = iTime * .3*snowSpeed;\n vec2 gh_uv = uv;\n vec3 colSnow = vec3(0.);\n float m = 0.;\n \n for(float i =0.; i <= .5; i += 1. / (16.*density)) {\n float z = mix(1., .5 , i);\n vec2 offset = vec2(N11(i), N11(N11(i)));\n m += snow((uv + offset) * z, t) * .3;\n }\n \n\n colSnow = vec3(m)*1.2;\n gl_FragColor = vec4(colSnow,colSnow.x);\n }"
|
|
31
|
+
};
|
|
32
|
+
export default snowShader;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Group, Vector3 } from '@anov/3d-core';
|
|
2
|
+
/**
|
|
3
|
+
* create sky system
|
|
4
|
+
* @param date
|
|
5
|
+
* @param latitude
|
|
6
|
+
* @param longitude
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
declare const createSkySystem: (date: Date, latitude: number, longitude: number, sunRadius?: number) => [(currentDate?: Date) => Vector3, Group & {
|
|
10
|
+
sunPosition: Vector3;
|
|
11
|
+
}, any];
|
|
12
|
+
export default createSkySystem;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { DirectionalLight, Group, MathUtils, Vector3, lib, use } from '@anov/3d-core';
|
|
8
|
+
import { getLastValue } from "../../utils";
|
|
9
|
+
import { getSunPosition } from "../sun";
|
|
10
|
+
var Sky = lib.Sky;
|
|
11
|
+
/**
|
|
12
|
+
* 天空盒 shader
|
|
13
|
+
*/
|
|
14
|
+
var initsSkySystem = function initsSkySystem(options) {
|
|
15
|
+
var sky = new Sky();
|
|
16
|
+
var position = new Vector3();
|
|
17
|
+
var _use$useScene = use.useScene(),
|
|
18
|
+
renderer = _use$useScene.renderer;
|
|
19
|
+
sky.scale.setScalar(450000);
|
|
20
|
+
var effectController = {
|
|
21
|
+
turbidity: 10,
|
|
22
|
+
rayleigh: 3,
|
|
23
|
+
mieCoefficient: 0.005,
|
|
24
|
+
mieDirectionalG: 0.7,
|
|
25
|
+
elevation: 2,
|
|
26
|
+
azimuth: 180,
|
|
27
|
+
exposure: renderer.toneMappingExposure
|
|
28
|
+
};
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
var uniforms = sky.material.uniforms;
|
|
31
|
+
uniforms.turbidity.value = effectController.turbidity;
|
|
32
|
+
uniforms.rayleigh.value = effectController.rayleigh;
|
|
33
|
+
uniforms.mieCoefficient.value = effectController.mieCoefficient;
|
|
34
|
+
uniforms.mieDirectionalG.value = effectController.mieDirectionalG;
|
|
35
|
+
var phi = MathUtils.degToRad(90 - effectController.elevation);
|
|
36
|
+
var theta = MathUtils.degToRad(effectController.azimuth);
|
|
37
|
+
position.setFromSphericalCoords(1, phi, theta);
|
|
38
|
+
uniforms.sunPosition.value.copy(position);
|
|
39
|
+
return [sky, position, uniforms];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* create sun light
|
|
43
|
+
* @param options
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
var initSunLight = function initSunLight(options) {
|
|
47
|
+
var _opts$mapSize, _opts$mapSize2;
|
|
48
|
+
var opts = options || {};
|
|
49
|
+
var sunLight = new DirectionalLight(getLastValue(opts.color, 'white'), getLastValue(opts.intensity, 1));
|
|
50
|
+
sunLight.castShadow = true;
|
|
51
|
+
sunLight.shadow.bias = getLastValue(opts.bias, -0.005);
|
|
52
|
+
sunLight.shadow.mapSize.set(getLastValue((_opts$mapSize = opts.mapSize) === null || _opts$mapSize === void 0 ? void 0 : _opts$mapSize[0], 1024 * 2), getLastValue((_opts$mapSize2 = opts.mapSize) === null || _opts$mapSize2 === void 0 ? void 0 : _opts$mapSize2[1], 1024 * 2));
|
|
53
|
+
var cam = sunLight.shadow.camera;
|
|
54
|
+
// cam.near = getLastValue(opts.near, 0.1)
|
|
55
|
+
// cam.far = getLastValue(opts.far, 10000)
|
|
56
|
+
// cam.left = getLastValue(opts.left, -10000)
|
|
57
|
+
// cam.right = getLastValue(opts.right, 10000)
|
|
58
|
+
// cam.top = getLastValue(opts.top, 10000)
|
|
59
|
+
// cam.bottom = getLastValue(opts.bottom, -10000)
|
|
60
|
+
|
|
61
|
+
return sunLight;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* create sky system
|
|
66
|
+
* @param date
|
|
67
|
+
* @param latitude
|
|
68
|
+
* @param longitude
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
var createSkySystem = function createSkySystem(date, latitude, longitude) {
|
|
72
|
+
var sunRadius = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 300;
|
|
73
|
+
var _use$useScene2 = use.useScene(),
|
|
74
|
+
renderer = _use$useScene2.renderer,
|
|
75
|
+
scene = _use$useScene2.scene;
|
|
76
|
+
if (!renderer && !scene) throw new Error('renderer or scene is not exist');
|
|
77
|
+
var _initsSkySystem = initsSkySystem(),
|
|
78
|
+
_initsSkySystem2 = _slicedToArray(_initsSkySystem, 3),
|
|
79
|
+
sky = _initsSkySystem2[0],
|
|
80
|
+
position = _initsSkySystem2[1],
|
|
81
|
+
uniforms = _initsSkySystem2[2];
|
|
82
|
+
var sunLight = initSunLight();
|
|
83
|
+
var skyGroup = new Group();
|
|
84
|
+
scene.add(sky);
|
|
85
|
+
skyGroup.add(sunLight);
|
|
86
|
+
scene.add(skyGroup);
|
|
87
|
+
var move = function move(altitude, azimuth) {
|
|
88
|
+
position.setFromSphericalCoords(sunRadius, MathUtils.degToRad(90 - MathUtils.radToDeg(altitude)), azimuth);
|
|
89
|
+
uniforms.sunPosition.value.copy(position);
|
|
90
|
+
var x = sunRadius * Math.cos(altitude) * Math.cos(azimuth);
|
|
91
|
+
var z = sunRadius * Math.cos(altitude) * Math.sin(azimuth);
|
|
92
|
+
var y = sunRadius * Math.sin(altitude);
|
|
93
|
+
var sunPosition = new Vector3(x, y, z);
|
|
94
|
+
skyGroup.sunPosition = sunPosition;
|
|
95
|
+
skyGroup.position.copy(position);
|
|
96
|
+
return sunPosition;
|
|
97
|
+
};
|
|
98
|
+
var _getSunPosition = getSunPosition(date, latitude, longitude),
|
|
99
|
+
altitude = _getSunPosition.altitude,
|
|
100
|
+
azimuth = _getSunPosition.azimuth;
|
|
101
|
+
move(altitude, azimuth);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* set date
|
|
105
|
+
* @param currentDate
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
var setDate = function setDate(currentDate) {
|
|
109
|
+
var _getSunPosition2 = getSunPosition(currentDate || date, latitude, longitude),
|
|
110
|
+
altitude = _getSunPosition2.altitude,
|
|
111
|
+
azimuth = _getSunPosition2.azimuth;
|
|
112
|
+
return move(altitude, azimuth);
|
|
113
|
+
};
|
|
114
|
+
return [setDate, skyGroup, sky];
|
|
115
|
+
};
|
|
116
|
+
export default createSkySystem;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SpeedType } from './rain';
|
|
2
|
+
declare type CreateSnowReturn = [
|
|
3
|
+
() => void,
|
|
4
|
+
() => void
|
|
5
|
+
];
|
|
6
|
+
/**
|
|
7
|
+
* create snow
|
|
8
|
+
* @param size 雪花大小
|
|
9
|
+
* @param range 降雪范围
|
|
10
|
+
* @param speed 降雪速度
|
|
11
|
+
* @param opacity 雪花透明度
|
|
12
|
+
* @param count 雪花密度
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const createSnow: (size?: number, range?: number, speed?: SpeedType, opacity?: number, count?: number) => CreateSnowReturn;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { globalObjectManage, use } from '@anov/3d-core';
|
|
2
|
+
import EnvironmentPoints from "./utils/points";
|
|
3
|
+
var useframe = use.useframe;
|
|
4
|
+
/**
|
|
5
|
+
* create snow
|
|
6
|
+
* @param size 雪花大小
|
|
7
|
+
* @param range 降雪范围
|
|
8
|
+
* @param speed 降雪速度
|
|
9
|
+
* @param opacity 雪花透明度
|
|
10
|
+
* @param count 雪花密度
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export var createSnow = function createSnow() {
|
|
14
|
+
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
15
|
+
var range = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
16
|
+
var speed = arguments.length > 2 ? arguments[2] : undefined;
|
|
17
|
+
var opacity = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.6;
|
|
18
|
+
var count = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 100;
|
|
19
|
+
var points = new EnvironmentPoints({
|
|
20
|
+
size: size,
|
|
21
|
+
opacity: opacity,
|
|
22
|
+
speed: speed,
|
|
23
|
+
range: range,
|
|
24
|
+
count: count,
|
|
25
|
+
url: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QAAAACAAIUyQ49AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AUUCyQKo9veFQAAD09JREFUeNrtm8lzXFcVxr/X/brVakmtyZJlebbl2DiG2InjFKQCgSJMxRBSsGDBn8CGP4UqNmxYUixSFMMCCgiQCiFkchLbsZ3I0WhZkjW2Wj08dfdl8zvlE0WyWi6HBJKu6uqn7vfuPec73xnuuVfSp69PX5/oV/S/JnAIISXJ3pJUj6Ko+X8NAErHkuooXpDUIWlNUlVScq8gRB8TBWNn0WYURfVNv/dIGpa0zn1nJNUkvSEpLakhqSSpulsg4o9YaXvlJXVJ2pBUCiHIQAghZCW1YfXHUXZR0rykBCY0YIdCCKndgBB/RMrnJe1l/kTSYQB4V1JTUncIocLtw5L2YPGspAFJQdKypOOSViSt8lzM58cXACyfReEHJXWjzC1JFecKktTOO5L0JFaeltQnaRAwXpN0TVIRIFY+ti4Q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DtIfC9gLUSxi1C+x5Jf0NBO267xL37YNFlukpLLkJbf+9H+PBl4stVFCtTovtTIlkYueLkS1wlqB33Bt0iaCGEsMLAdoTlGXz/FUm/Jag8itWMkkkURdUQwiiUPIvPH6CzZEqM8mmdogpWHyGgFt1e4B6XacYxRnNT7yLF/GXnvpaO67s+Kepe00TqLlpiZWru65L+TE/wlKvbU27iNfzPFi17XR//sqRfMtYZ6LmPLlNBd/4X4FkH8rI7Z9TcZNGmS+HLDpC7bo5ELZTCtoYXud2aodb0mNsObQqpPMD0woKS801ru9sGSOCs32FK5XcYv+Caodc431PXfXi1AoCdFrf22LArZFI77bwAQs5tevbDqhJNioTzCDkH8oALYkXmsqM62/5/wr28WnEB22FZcRuZFnBa+Tc126Iuwwbr0MauAEqc3066Mz07BrEPnQHbrAzvSZjtnt/036Ap3CXryu76/VT6ngH4b7wAI7s5iH1YAHziX/8BkvqQgkVlJkQAAAAASUVORK5CYII='
|
|
26
|
+
});
|
|
27
|
+
var removeFrame = null;
|
|
28
|
+
var isBoundaryJudgment = true;
|
|
29
|
+
var start = function start() {
|
|
30
|
+
globalObjectManage.scene.add(points.point);
|
|
31
|
+
removeFrame = useframe(function () {
|
|
32
|
+
points.animation(function (position) {
|
|
33
|
+
position.y -= position.speedY;
|
|
34
|
+
if (position.y <= 0 && isBoundaryJudgment) position.y = 1000 / 2;
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var stop = function stop() {
|
|
39
|
+
if (removeFrame) {
|
|
40
|
+
removeFrame();
|
|
41
|
+
globalObjectManage.scene.remove(points.point);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return [start, stop];
|
|
45
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Group } from '@anov/3d-core';
|
|
2
|
+
export declare const getSunPosition: (date: Date, latitude: number, longitude: number) => {
|
|
3
|
+
altitude: number;
|
|
4
|
+
azimuth: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* create init
|
|
8
|
+
* @param date
|
|
9
|
+
* @param latitude
|
|
10
|
+
* @param longitude
|
|
11
|
+
* @param distance
|
|
12
|
+
*/
|
|
13
|
+
export declare const createSun: (date: Date, latitude: number, longitude: number, distance?: number, autoUpdate?: boolean) => (Group | ((date: Date, latitude: number, longitude: number) => void))[];
|