@shapediver/viewer.rendering-engine.rendering-engine-threejs 3.3.3 → 3.3.6
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/package.json +19 -20
- package/src/RenderingEngine.ts +0 -1336
- package/src/index.ts +0 -81
- package/src/injectors/Tag3dGeometryCreationInjector.ts +0 -154
- package/src/injectors/TextureUnifierInjector.ts +0 -214
- package/src/interfaces/ILoader.ts +0 -3
- package/src/interfaces/IPostProcessingEffectDefinitions.ts +0 -402
- package/src/interfaces/IRenderingEngine.ts +0 -48
- package/src/loaders/EnvironmentMapLoader.ts +0 -357
- package/src/loaders/GeometryLoader.ts +0 -585
- package/src/loaders/HTMLElementAnchorLoader.ts +0 -107
- package/src/loaders/LightLoader.ts +0 -171
- package/src/loaders/MaterialLoader.ts +0 -1413
- package/src/managers/CameraManager.ts +0 -178
- package/src/managers/EnvironmentGeometryManager.ts +0 -224
- package/src/managers/PostProcessingManager.ts +0 -1181
- package/src/managers/RenderingManager.ts +0 -657
- package/src/managers/SceneTracingManager.ts +0 -127
- package/src/managers/SceneTreeManager.ts +0 -576
- package/src/managers/postprocessing/GodRaysManager.ts +0 -52
- package/src/managers/postprocessing/OutlineManager.ts +0 -58
- package/src/managers/postprocessing/SSAARenderPass.ts +0 -339
- package/src/managers/postprocessing/SelectiveBloomManager.ts +0 -58
- package/src/managers/postprocessing/ao/ao/AOEffect.ts +0 -180
- package/src/managers/postprocessing/ao/ao/AOPass.ts +0 -128
- package/src/managers/postprocessing/ao/ao/shader/ao_compose.glsl +0 -17
- package/src/managers/postprocessing/ao/ao/shader/ao_compose.ts +0 -19
- package/src/managers/postprocessing/ao/hbao/HBAOEffect.ts +0 -41
- package/src/managers/postprocessing/ao/hbao/shader/hbao.glsl +0 -96
- package/src/managers/postprocessing/ao/hbao/shader/hbao.ts +0 -98
- package/src/managers/postprocessing/ao/hbao/shader/hbao_utils.glsl +0 -92
- package/src/managers/postprocessing/ao/hbao/shader/hbao_utils.ts +0 -95
- package/src/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.ts +0 -259
- package/src/managers/postprocessing/ao/poissionDenoise/shader/poissionDenoise.glsl +0 -125
- package/src/managers/postprocessing/ao/poissionDenoise/shader/poissionDenoise.ts +0 -127
- package/src/managers/postprocessing/ao/ssao/SSAOEffect.ts +0 -106
- package/src/managers/postprocessing/ao/ssao/shader/ssao.glsl +0 -128
- package/src/managers/postprocessing/ao/ssao/shader/ssao.ts +0 -130
- package/src/managers/postprocessing/ao/utils/shader/basic.glsl +0 -6
- package/src/managers/postprocessing/ao/utils/shader/basic.ts +0 -8
- package/src/managers/postprocessing/ao/utils/shader/sampleBlueNoise.glsl +0 -36
- package/src/managers/postprocessing/ao/utils/shader/sampleBlueNoise.ts +0 -38
- package/src/managers/postprocessing/utils/CopyMaterial.ts +0 -130
- package/src/managers/postprocessing/utils/CopyShader.ts +0 -39
- package/src/managers/postprocessing/utils/FullScreenQuad.ts +0 -47
- package/src/managers/postprocessing/utils/NormalPass.ts +0 -222
- package/src/managers/postprocessing/utils/RenderPass.ts +0 -366
- package/src/materials/GemMaterial.ts +0 -268
- package/src/materials/MeshUnlitMaterialParameters.ts +0 -4
- package/src/materials/MultiPointsMaterial.ts +0 -646
- package/src/materials/SpecularGlossinessMaterial.ts +0 -182
- package/src/objects/SDBone.ts +0 -51
- package/src/objects/SDColor.ts +0 -54
- package/src/objects/SDData.ts +0 -44
- package/src/objects/SDObject.ts +0 -58
- package/src/shaders/PCSS.ts +0 -124
- package/src/shaders/gem.ts +0 -579
- package/src/shaders/gem_frag.glsl +0 -522
- package/src/shaders/gem_vert.glsl +0 -53
- package/src/shaders/multi_points.ts +0 -291
- package/src/shaders/multi_points_frag.glsl +0 -166
- package/src/shaders/multi_points_vert.glsl +0 -120
- package/src/styling/viewport-css.ts +0 -113
- package/src/styling/viewport.css +0 -111
- package/src/three/font.ts +0 -2
- package/src/three/geometries/TextGeometry.ts +0 -58
- package/src/three/loaders/FontLoader.ts +0 -205
- package/src/three/loaders/RGBELoader.ts +0 -496
- package/src/types/IThreejsData.ts +0 -16
- package/src/types/ThreejsData.ts +0 -43
- package/tsconfig.json +0 -20
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { IBox, ISphere } from '@shapediver/viewer.shared.math';
|
|
3
|
-
import { ILoader } from '../interfaces/ILoader';
|
|
4
|
-
import { RenderingEngine } from '../RenderingEngine';
|
|
5
|
-
import { SDData } from '../objects/SDData';
|
|
6
|
-
import {
|
|
7
|
-
AbstractLight,
|
|
8
|
-
AmbientLight,
|
|
9
|
-
DirectionalLight,
|
|
10
|
-
HemisphereLight,
|
|
11
|
-
PointLight,
|
|
12
|
-
SpotLight,
|
|
13
|
-
} from '@shapediver/viewer.rendering-engine.light-engine';
|
|
14
|
-
|
|
15
|
-
export class LightLoader implements ILoader {
|
|
16
|
-
// #region Properties (3)
|
|
17
|
-
|
|
18
|
-
private _forceDisabledShadows: boolean = false;
|
|
19
|
-
private _shadowMapCount = 0;
|
|
20
|
-
|
|
21
|
-
// #endregion Properties (3)
|
|
22
|
-
|
|
23
|
-
// #region Constructors (1)
|
|
24
|
-
|
|
25
|
-
constructor(private readonly _renderingEngine: RenderingEngine) { }
|
|
26
|
-
|
|
27
|
-
// #endregion Constructors (1)
|
|
28
|
-
|
|
29
|
-
// #region Public Getters And Setters (4)
|
|
30
|
-
|
|
31
|
-
public get forceDisabledShadows(): boolean {
|
|
32
|
-
return this._forceDisabledShadows;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public set forceDisabledShadows(value: boolean) {
|
|
36
|
-
this._forceDisabledShadows = value;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public get shadowMapCount(): number {
|
|
40
|
-
return this._shadowMapCount;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public set shadowMapCount(value: number) {
|
|
44
|
-
this._shadowMapCount = value;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// #endregion Public Getters And Setters (4)
|
|
48
|
-
|
|
49
|
-
// #region Public Methods (3)
|
|
50
|
-
|
|
51
|
-
public adjustToBoundingBox(light: AbstractLight, dataChild: SDData, boundingBox: IBox) {
|
|
52
|
-
const threeLight: THREE.Light = <THREE.Light>dataChild.children[0];
|
|
53
|
-
|
|
54
|
-
if (light instanceof DirectionalLight) {
|
|
55
|
-
const threeDirectionalLight = <THREE.DirectionalLight>threeLight;
|
|
56
|
-
|
|
57
|
-
const bs: ISphere = boundingBox.boundingSphere;
|
|
58
|
-
threeDirectionalLight.position.set(bs.center[0] + light.direction[0] * bs.radius * 2.35, bs.center[1] + light.direction[1] * bs.radius * 2.35, bs.center[2] + light.direction[2] * bs.radius * 2.35);
|
|
59
|
-
threeDirectionalLight.target.position.set(bs.center[0], bs.center[1], bs.center[2]);
|
|
60
|
-
|
|
61
|
-
if (light.castShadow === true && this.forceDisabledShadows === false) {
|
|
62
|
-
threeDirectionalLight.castShadow = true;
|
|
63
|
-
threeDirectionalLight.shadow.camera.up.set(0, 0, 1);
|
|
64
|
-
threeDirectionalLight.shadow.camera.far = 8 * bs.radius;
|
|
65
|
-
threeDirectionalLight.shadow.camera.right = 1.5 * bs.radius;
|
|
66
|
-
threeDirectionalLight.shadow.camera.left = -1.5 * bs.radius;
|
|
67
|
-
threeDirectionalLight.shadow.camera.top = 1.5 * bs.radius;
|
|
68
|
-
threeDirectionalLight.shadow.camera.bottom = -1.5 * bs.radius;
|
|
69
|
-
threeDirectionalLight.shadow.mapSize.width = light.shadowMapResolution;
|
|
70
|
-
threeDirectionalLight.shadow.mapSize.height = light.shadowMapResolution;
|
|
71
|
-
threeDirectionalLight.shadow.bias = light.shadowMapBias;
|
|
72
|
-
threeDirectionalLight.shadow.camera.updateProjectionMatrix();
|
|
73
|
-
this._shadowMapCount++;
|
|
74
|
-
} else {
|
|
75
|
-
threeDirectionalLight.castShadow = false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public init(): void { }
|
|
81
|
-
|
|
82
|
-
public load(light: AbstractLight, dataChild: SDData) {
|
|
83
|
-
let threeLight: THREE.Light | null = dataChild.children[0] instanceof THREE.Light ? <THREE.Light>dataChild.children[0] : null;
|
|
84
|
-
if (light instanceof AmbientLight) {
|
|
85
|
-
if (!threeLight) {
|
|
86
|
-
threeLight = new THREE.AmbientLight();
|
|
87
|
-
light.convertedObject[this._renderingEngine.id] = <THREE.AmbientLight>threeLight;
|
|
88
|
-
dataChild.add(threeLight);
|
|
89
|
-
}
|
|
90
|
-
const threeAmbientLight = <THREE.AmbientLight>threeLight;
|
|
91
|
-
|
|
92
|
-
threeAmbientLight.color = this._renderingEngine.createThreeJsColor(light.color);
|
|
93
|
-
threeAmbientLight.intensity = light.intensity;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (light instanceof DirectionalLight) {
|
|
97
|
-
if (!threeLight) {
|
|
98
|
-
threeLight = new THREE.DirectionalLight();
|
|
99
|
-
dataChild.add(threeLight);
|
|
100
|
-
dataChild.add((<THREE.DirectionalLight>threeLight).target);
|
|
101
|
-
light.convertedObject[this._renderingEngine.id] = <THREE.DirectionalLight>threeLight;
|
|
102
|
-
}
|
|
103
|
-
const threeDirectionalLight = <THREE.DirectionalLight>threeLight;
|
|
104
|
-
|
|
105
|
-
threeDirectionalLight.color = this._renderingEngine.createThreeJsColor(light.color);
|
|
106
|
-
threeDirectionalLight.intensity = light.intensity;
|
|
107
|
-
|
|
108
|
-
if (light.useNodeData) {
|
|
109
|
-
threeDirectionalLight.position.set(0, 0, 0);
|
|
110
|
-
threeDirectionalLight.target.position.set(0, 0, -1);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (light instanceof HemisphereLight) {
|
|
115
|
-
if (!threeLight) {
|
|
116
|
-
threeLight = new THREE.HemisphereLight();
|
|
117
|
-
dataChild.add(threeLight);
|
|
118
|
-
light.convertedObject[this._renderingEngine.id] = <THREE.HemisphereLight>threeLight;
|
|
119
|
-
}
|
|
120
|
-
const threeHemisphereLight = <THREE.HemisphereLight>threeLight;
|
|
121
|
-
|
|
122
|
-
threeHemisphereLight.color = this._renderingEngine.createThreeJsColor(light.color);
|
|
123
|
-
threeHemisphereLight.intensity = light.intensity;
|
|
124
|
-
threeHemisphereLight.groundColor = this._renderingEngine.createThreeJsColor(light.groundColor);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (light instanceof PointLight) {
|
|
128
|
-
if (!threeLight) {
|
|
129
|
-
threeLight = new THREE.PointLight();
|
|
130
|
-
dataChild.add(threeLight);
|
|
131
|
-
light.convertedObject[this._renderingEngine.id] = <THREE.PointLight>threeLight;
|
|
132
|
-
}
|
|
133
|
-
const threePointLight = <THREE.PointLight>threeLight;
|
|
134
|
-
|
|
135
|
-
threePointLight.color = this._renderingEngine.createThreeJsColor(light.color);
|
|
136
|
-
threePointLight.intensity = light.intensity;
|
|
137
|
-
threePointLight.distance = light.distance;
|
|
138
|
-
threePointLight.decay = light.decay;
|
|
139
|
-
threePointLight.position.set(light.position[0], light.position[1], light.position[2]);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (light instanceof SpotLight) {
|
|
143
|
-
if (!threeLight) {
|
|
144
|
-
threeLight = new THREE.SpotLight(
|
|
145
|
-
this._renderingEngine.createThreeJsColor(light.color),
|
|
146
|
-
light.intensity,
|
|
147
|
-
light.distance,
|
|
148
|
-
light.angle,
|
|
149
|
-
light.penumbra,
|
|
150
|
-
light.decay
|
|
151
|
-
);
|
|
152
|
-
dataChild.add(threeLight);
|
|
153
|
-
dataChild.add((<THREE.SpotLight>threeLight).target);
|
|
154
|
-
light.convertedObject[this._renderingEngine.id] = <THREE.SpotLight>threeLight;
|
|
155
|
-
}
|
|
156
|
-
const threeSpotLight = <THREE.SpotLight>threeLight;
|
|
157
|
-
|
|
158
|
-
threeSpotLight.color = this._renderingEngine.createThreeJsColor(light.color);
|
|
159
|
-
threeSpotLight.intensity = light.intensity;
|
|
160
|
-
threeSpotLight.distance = light.distance;
|
|
161
|
-
threeSpotLight.angle = light.angle;
|
|
162
|
-
threeSpotLight.penumbra = light.penumbra;
|
|
163
|
-
threeSpotLight.decay = light.decay;
|
|
164
|
-
|
|
165
|
-
threeSpotLight.position.set(light.position[0], light.position[1], light.position[2]);
|
|
166
|
-
threeSpotLight.target.position.set(light.target[0], light.target[1], light.target[2]);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// #endregion Public Methods (3)
|
|
171
|
-
}
|