x_ite 10.5.0 → 10.5.2
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 +4 -4
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +2 -2
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +2 -2
- package/dist/assets/components/Geometry2DComponent.min.js +2 -2
- package/dist/assets/components/GeospatialComponent.js +2 -2
- package/dist/assets/components/GeospatialComponent.min.js +2 -2
- package/dist/assets/components/HAnimComponent.js +2 -2
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +2 -2
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +134 -37
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +3 -3
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
- package/dist/assets/components/PickingComponent.js +2 -2
- package/dist/assets/components/PickingComponent.min.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +2 -2
- package/dist/assets/components/ScriptingComponent.min.js +2 -2
- package/dist/assets/components/TextComponent.js +4 -4
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +10 -10
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +121 -178
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +2 -2
- package/dist/assets/components/X_ITEComponent.min.js +2 -2
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +321 -310
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +321 -310
- package/dist/x_ite.zip +0 -0
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v10.5.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.5.
|
|
1
|
+
/* X_ITE v10.5.2 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.5.2")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ // The require scope
|
|
@@ -130,6 +130,8 @@ Object .assign (Object .setPrototypeOf (X3DVolumeRenderStyleNode .prototype, (ex
|
|
|
130
130
|
{
|
|
131
131
|
addShaderFields (shaderNode)
|
|
132
132
|
{ },
|
|
133
|
+
getDefines ()
|
|
134
|
+
{ },
|
|
133
135
|
getUniformsText ()
|
|
134
136
|
{
|
|
135
137
|
return "";
|
|
@@ -1141,6 +1143,10 @@ Object .assign (Object .setPrototypeOf (CartoonVolumeStyle .prototype, VolumeRen
|
|
|
1141
1143
|
if (this .surfaceNormalsNode)
|
|
1142
1144
|
shaderNode .addUserDefinedField ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "surfaceNormals_" + this .getId (), new (external_X_ITE_X3D_Fields_default()).SFNode (this .surfaceNormalsNode));
|
|
1143
1145
|
},
|
|
1146
|
+
getDefines (defines)
|
|
1147
|
+
{
|
|
1148
|
+
defines .add ("#define X3D_HSV");
|
|
1149
|
+
},
|
|
1144
1150
|
getUniformsText ()
|
|
1145
1151
|
{
|
|
1146
1152
|
if (! this ._enabled .getValue ())
|
|
@@ -1157,127 +1163,6 @@ Object .assign (Object .setPrototypeOf (CartoonVolumeStyle .prototype, VolumeRen
|
|
|
1157
1163
|
|
|
1158
1164
|
string += this .getNormalText (this .surfaceNormalsNode);
|
|
1159
1165
|
|
|
1160
|
-
string += "\n";
|
|
1161
|
-
string += "vec3\n";
|
|
1162
|
-
string += "rgb2hsv_" + this .getId () + " (in vec3 color)\n";
|
|
1163
|
-
string += "{\n";
|
|
1164
|
-
string += " float h = 0.0;\n";
|
|
1165
|
-
string += " float s = 0.0;\n";
|
|
1166
|
-
string += " float v = 0.0;\n";
|
|
1167
|
-
string += "\n";
|
|
1168
|
-
string += " float min = min (min (color .r, color .g), color .b);\n";
|
|
1169
|
-
string += " float max = max (max (color .r, color .g), color .b);\n";
|
|
1170
|
-
string += " v = max; // value\n";
|
|
1171
|
-
string += "\n";
|
|
1172
|
-
string += " float delta = max - min;\n";
|
|
1173
|
-
string += "\n";
|
|
1174
|
-
string += " if (max != 0.0 && delta != 0.0)\n";
|
|
1175
|
-
string += " {\n";
|
|
1176
|
-
string += " s = delta / max; // s\n";
|
|
1177
|
-
string += "\n";
|
|
1178
|
-
string += " if (color .r == max)\n";
|
|
1179
|
-
string += " h = (color .g - color .b) / delta; // between yellow & magenta\n";
|
|
1180
|
-
string += " else if (color .g == max)\n";
|
|
1181
|
-
string += " h = 2.0 + (color .b - color .r) / delta; // between cyan & yellow\n";
|
|
1182
|
-
string += " else\n";
|
|
1183
|
-
string += " h = 4.0 + (color .r - color .g) / delta; // between magenta & cyan\n";
|
|
1184
|
-
string += "\n";
|
|
1185
|
-
string += " h *= M_PI / 3.0; // radiants\n";
|
|
1186
|
-
string += " if (h < 0.0)\n";
|
|
1187
|
-
string += " h += M_PI * 2.0;\n";
|
|
1188
|
-
string += " }\n";
|
|
1189
|
-
string += " else\n";
|
|
1190
|
-
string += " s = h = 0.0; // s = 0, h is undefined\n";
|
|
1191
|
-
string += "\n";
|
|
1192
|
-
string += " return vec3 (h, s, v);\n";
|
|
1193
|
-
string += "}\n";
|
|
1194
|
-
|
|
1195
|
-
string += "\n";
|
|
1196
|
-
string += "vec3\n";
|
|
1197
|
-
string += "hsv2rgb_" + this .getId () + " (in vec3 hsv)\n";
|
|
1198
|
-
string += "{\n";
|
|
1199
|
-
string += " float h = hsv [0];\n";
|
|
1200
|
-
string += " float s = clamp (hsv [1], 0.0, 1.0);\n";
|
|
1201
|
-
string += " float v = clamp (hsv [2], 0.0, 1.0);\n";
|
|
1202
|
-
string += "\n";
|
|
1203
|
-
string += " // H is given on [0, 2 * Pi]. S and V are given on [0, 1].\n";
|
|
1204
|
-
string += " // RGB are each returned on [0, 1].\n";
|
|
1205
|
-
string += "\n";
|
|
1206
|
-
string += " if (s == 0.0)\n";
|
|
1207
|
-
string += " {\n";
|
|
1208
|
-
string += " // achromatic (grey)\n";
|
|
1209
|
-
string += " return vec3 (v, v, v);\n";
|
|
1210
|
-
string += " }\n";
|
|
1211
|
-
string += " else\n";
|
|
1212
|
-
string += " {\n";
|
|
1213
|
-
string += " float w = (h * (180.0 / M_PI)) / 60.0; // sector 0 to 5\n";
|
|
1214
|
-
string += "\n";
|
|
1215
|
-
string += " float i = floor (w);\n";
|
|
1216
|
-
string += " float f = w - i; // factorial part of h\n";
|
|
1217
|
-
string += " float p = v * ( 1.0 - s );\n";
|
|
1218
|
-
string += " float q = v * ( 1.0 - s * f );\n";
|
|
1219
|
-
string += " float t = v * ( 1.0 - s * ( 1.0 - f ) );\n";
|
|
1220
|
-
string += "\n";
|
|
1221
|
-
string += " switch (int (i) % 6)\n";
|
|
1222
|
-
string += " {\n";
|
|
1223
|
-
string += " case 0: return vec3 (v, t, p);\n";
|
|
1224
|
-
string += " case 1: return vec3 (q, v, p);\n";
|
|
1225
|
-
string += " case 2: return vec3 (p, v, t);\n";
|
|
1226
|
-
string += " case 3: return vec3 (p, q, v);\n";
|
|
1227
|
-
string += " case 4: return vec3 (t, p, v);\n";
|
|
1228
|
-
string += " default: return vec3 (v, p, q);\n";
|
|
1229
|
-
string += " }\n";
|
|
1230
|
-
string += " }\n";
|
|
1231
|
-
string += "\n";
|
|
1232
|
-
string += " return vec3 (0.0);\n";
|
|
1233
|
-
string += "}\n";
|
|
1234
|
-
|
|
1235
|
-
string += "\n";
|
|
1236
|
-
string += "vec3\n";
|
|
1237
|
-
string += "mix_hsv_" + this .getId () + " (in vec3 a, in vec3 b, in float t)\n";
|
|
1238
|
-
string += "{\n";
|
|
1239
|
-
string += " // Linearely interpolate in HSV space between source color @a a and destination color @a b by an amount of @a t.\n";
|
|
1240
|
-
string += " // Source and destination color must be in HSV space.\n";
|
|
1241
|
-
string += "\n";
|
|
1242
|
-
string += " float ha = a [0];\n";
|
|
1243
|
-
string += " float sa = a [1];\n";
|
|
1244
|
-
string += " float va = a [2];\n";
|
|
1245
|
-
string += "\n";
|
|
1246
|
-
string += " float hb = b [0];\n";
|
|
1247
|
-
string += " float sb = b [1];\n";
|
|
1248
|
-
string += " float vb = b [2];\n";
|
|
1249
|
-
string += "\n";
|
|
1250
|
-
string += " if (sa == 0.0)\n";
|
|
1251
|
-
string += " ha = hb;\n";
|
|
1252
|
-
string += "\n";
|
|
1253
|
-
string += " if (sb == 0.0)\n";
|
|
1254
|
-
string += " hb = ha;\n";
|
|
1255
|
-
string += "\n";
|
|
1256
|
-
string += " float range = abs (hb - ha);\n";
|
|
1257
|
-
string += "\n";
|
|
1258
|
-
string += " if (range <= M_PI)\n";
|
|
1259
|
-
string += " {\n";
|
|
1260
|
-
string += " float h = ha + t * (hb - ha);\n";
|
|
1261
|
-
string += " float s = sa + t * (sb - sa);\n";
|
|
1262
|
-
string += " float v = va + t * (vb - va);\n";
|
|
1263
|
-
string += " return vec3 (h, s, v);\n";
|
|
1264
|
-
string += " }\n";
|
|
1265
|
-
string += "\n";
|
|
1266
|
-
string += " float PI2 = M_PI * 2.0;\n";
|
|
1267
|
-
string += " float step = (PI2 - range) * t;\n";
|
|
1268
|
-
string += " float h = ha < hb ? ha - step : ha + step;\n";
|
|
1269
|
-
string += "\n";
|
|
1270
|
-
string += " if (h < 0.0)\n";
|
|
1271
|
-
string += " h += PI2;\n";
|
|
1272
|
-
string += "\n";
|
|
1273
|
-
string += " else if (h > PI2)\n";
|
|
1274
|
-
string += " h -= PI2;\n";
|
|
1275
|
-
string += "\n";
|
|
1276
|
-
string += " float s = sa + t * (sb - sa);\n";
|
|
1277
|
-
string += " float v = va + t * (vb - va);\n";
|
|
1278
|
-
string += " return vec3 (h, s, v);\n";
|
|
1279
|
-
string += "}\n";
|
|
1280
|
-
|
|
1281
1166
|
string += "\n";
|
|
1282
1167
|
string += "vec4\n";
|
|
1283
1168
|
string += "getCartoonStyle_" + this .getId () + " (in vec4 originalColor, vec3 texCoord)\n";
|
|
@@ -1299,10 +1184,10 @@ Object .assign (Object .setPrototypeOf (CartoonVolumeStyle .prototype, VolumeRen
|
|
|
1299
1184
|
string += " return vec4 (0.0);\n";
|
|
1300
1185
|
string += "\n";
|
|
1301
1186
|
string += " float t = cos (min (floor (acos (cosTheta) / step) * (steps > 1.0 ? steps / (steps - 1.0) : 1.0), steps) * step);\n";
|
|
1302
|
-
string += " vec3 orthogonalHSV =
|
|
1303
|
-
string += " vec3 parallelHSV =
|
|
1187
|
+
string += " vec3 orthogonalHSV = rgb2hsv (orthogonalColor .rgb);\n";
|
|
1188
|
+
string += " vec3 parallelHSV = rgb2hsv (parallelColor .rgb);\n";
|
|
1304
1189
|
string += "\n";
|
|
1305
|
-
string += " return vec4 (
|
|
1190
|
+
string += " return vec4 (hsv2rgb (mix_hsv (orthogonalHSV, parallelHSV, t)), originalColor .a);\n";
|
|
1306
1191
|
string += "}\n";
|
|
1307
1192
|
|
|
1308
1193
|
return string;
|
|
@@ -1476,6 +1361,11 @@ Object .assign (Object .setPrototypeOf (ComposedVolumeStyle .prototype, VolumeRe
|
|
|
1476
1361
|
for (const renderStyleNode of this .renderStyleNodes)
|
|
1477
1362
|
renderStyleNode .addShaderFields (shaderNode);
|
|
1478
1363
|
},
|
|
1364
|
+
getDefines (defines)
|
|
1365
|
+
{
|
|
1366
|
+
for (const renderStyleNode of this .renderStyleNodes)
|
|
1367
|
+
renderStyleNode .getDefines (defines);
|
|
1368
|
+
},
|
|
1479
1369
|
getUniformsText ()
|
|
1480
1370
|
{
|
|
1481
1371
|
if (! this ._enabled .getValue ())
|
|
@@ -1714,16 +1604,47 @@ const external_X_ITE_X3D_UnlitMaterial_namespaceObject = __X_ITE_X3D__ .UnlitMat
|
|
|
1714
1604
|
var external_X_ITE_X3D_UnlitMaterial_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_UnlitMaterial_namespaceObject);
|
|
1715
1605
|
;// CONCATENATED MODULE: ./src/x_ite/Browser/VolumeRendering/VolumeStyle.vs.js
|
|
1716
1606
|
const VolumeStyle_vs_default_ = /* glsl */ `#version 300 es
|
|
1717
|
-
precision highp float;precision highp int;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;uniform mat4 x3d_TextureMatrix[1];in vec4 x3d_TexCoord0;in vec4 x3d_Vertex;out vec3 vertex;out vec4 texCoord;
|
|
1607
|
+
precision highp float;precision highp int;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;uniform mat4 x3d_TextureMatrix[1];in vec4 x3d_TexCoord0;in vec4 x3d_Vertex;out vec3 vertex;out vec4 texCoord;
|
|
1608
|
+
#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)
|
|
1609
|
+
out float depth;
|
|
1610
|
+
#endif
|
|
1611
|
+
void main(){vec4 position=x3d_ModelViewMatrix*x3d_Vertex;vertex=position.xyz;texCoord=x3d_TextureMatrix[0]*x3d_TexCoord0;gl_Position=x3d_ProjectionMatrix*position;
|
|
1612
|
+
#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)
|
|
1613
|
+
depth=1.0+gl_Position.w;
|
|
1614
|
+
#endif
|
|
1615
|
+
}`
|
|
1718
1616
|
;
|
|
1719
1617
|
|
|
1720
1618
|
/* harmony default export */ const VolumeStyle_vs = (external_X_ITE_X3D_Namespace_default().add ("VolumeStyle.vs", VolumeStyle_vs_default_));
|
|
1721
1619
|
;// CONCATENATED MODULE: ./src/x_ite/Browser/VolumeRendering/VolumeStyle.fs.js
|
|
1722
1620
|
const VolumeStyle_fs_default_ = /* glsl */ `#version 300 es
|
|
1723
|
-
precision highp float;precision highp int;precision highp sampler3D;in vec3 vertex;in vec4 texCoord;
|
|
1621
|
+
precision highp float;precision highp int;precision highp sampler3D;in vec3 vertex;in vec4 texCoord;
|
|
1622
|
+
#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)
|
|
1623
|
+
uniform float x3d_LogarithmicFarFactor1_2;in float depth;
|
|
1624
|
+
#endif
|
|
1625
|
+
uniform sampler3D x3d_Texture3D[1];uniform mat3 x3d_TextureNormalMatrix;uniform x3d_LightSourceParameters x3d_LightSource[x3d_MaxLights];const float M_PI=3.141592653589793;const float M_SQRT2=1.4142135623730951;const float M_SQRT1_2=0.7071067811865476;
|
|
1626
|
+
#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)
|
|
1627
|
+
layout(location=0)out vec4 x3d_FragData0;layout(location=1)out vec4 x3d_FragData1;
|
|
1628
|
+
#else
|
|
1629
|
+
out vec4 x3d_FragColor;
|
|
1630
|
+
#endif
|
|
1724
1631
|
#pragma X3D include "includes/ClipPlanes.glsl"
|
|
1725
1632
|
#pragma X3D include "includes/Fog.glsl"
|
|
1726
|
-
|
|
1633
|
+
__VOLUME_STYLES_DEFINES__
|
|
1634
|
+
#if defined(X3D_HSV)
|
|
1635
|
+
vec3 rgb2hsv(in vec3 color){float h=0.0;float s=0.0;float v=0.0;float min=min(min(color.r,color.g),color.b);float max=max(max(color.r,color.g),color.b);v=max;float delta=max-min;if(max!=0.0&&delta!=0.0){s=delta/max;if(color.r==max)h=(color.g-color.b)/delta;else if(color.g==max)h=2.0+(color.b-color.r)/delta;else h=4.0+(color.r-color.g)/delta;h*=M_PI/3.0;if(h<0.0)h+=M_PI*2.0;}else s=h=0.0;return vec3(h,s,v);}vec3 hsv2rgb(in vec3 hsv){float h=hsv[0];float s=clamp(hsv[1],0.0,1.0);float v=clamp(hsv[2],0.0,1.0);if(s==0.0){return vec3(v,v,v);}else{float w=(h*(180.0/M_PI))/60.0;float i=floor(w);float f=w-i;float p=v*(1.0-s);float q=v*(1.0-s*f);float t=v*(1.0-s*(1.0-f));switch(int(i)% 6){case 0:return vec3(v,t,p);case 1:return vec3(q,v,p);case 2:return vec3(p,v,t);case 3:return vec3(p,q,v);case 4:return vec3(t,p,v);default:return vec3(v,p,q);}}return vec3(0.0);}vec3 mix_hsv(in vec3 a,in vec3 b,in float t){float ha=a[0];float sa=a[1];float va=a[2];float hb=b[0];float sb=b[1];float vb=b[2];if(sa==0.0)ha=hb;if(sb==0.0)hb=ha;float range=abs(hb-ha);if(range<=M_PI){float h=ha+t*(hb-ha);float s=sa+t*(sb-sa);float v=va+t*(vb-va);return vec3(h,s,v);}float PI2=M_PI*2.0;float step=(PI2-range)*t;float h=ha<hb?ha-step:ha+step;if(h<0.0)h+=PI2;else if(h>PI2)h-=PI2;float s=sa+t*(sb-sa);float v=va+t*(vb-va);return vec3(h,s,v);}
|
|
1636
|
+
#endif
|
|
1637
|
+
#if defined(X3D_PLANE)
|
|
1638
|
+
struct Plane3{vec3 normal;float distanceFromOrigin;};Plane3 plane3(const in vec3 point,const in vec3 normal){return Plane3(normal,dot(normal,point));}vec3 plane3_perpendicular_vector(const in Plane3 plane,const in vec3 point){return plane.normal*(dot(point,plane.normal)-plane.distanceFromOrigin);}
|
|
1639
|
+
#endif
|
|
1640
|
+
#if defined(X3D_SHADING)
|
|
1641
|
+
float getSpotFactor(const in float cutOffAngle,const in float beamWidth,const in vec3 L,const in vec3 d){float spotAngle=acos(clamp(dot(-L,d),-1.0,1.0));if(spotAngle>=cutOffAngle)return 0.0;else if(spotAngle<=beamWidth)return 1.0;return(spotAngle-cutOffAngle)/(beamWidth-cutOffAngle);}
|
|
1642
|
+
#endif
|
|
1643
|
+
__VOLUME_STYLES_UNIFORMS__ vec4 getTextureColor(in vec3 texCoord){if(any(greaterThan(abs(texCoord-0.5),vec3(0.5))))discard;vec4 textureColor=texture(x3d_Texture3D[0],texCoord);__VOLUME_STYLES_FUNCTIONS__ return textureColor;}
|
|
1644
|
+
#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)
|
|
1645
|
+
float weight(const in float z,const in float a){return clamp(pow(min(1.0,a*10.0)+0.01,3.0)*1e8*pow(1.0-z*0.9,3.0),1e-2,3e3);}
|
|
1646
|
+
#endif
|
|
1647
|
+
void main(){
|
|
1727
1648
|
#if defined(X3D_CLIP_PLANES)
|
|
1728
1649
|
clip();
|
|
1729
1650
|
#endif
|
|
@@ -1731,7 +1652,15 @@ vec4 finalColor=getTextureColor(texCoord.stp/texCoord.q);
|
|
|
1731
1652
|
#if defined(X3D_FOG)
|
|
1732
1653
|
finalColor.rgb=getFogColor(finalColor.rgb);
|
|
1733
1654
|
#endif
|
|
1734
|
-
|
|
1655
|
+
#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)
|
|
1656
|
+
float a=finalColor.a;float w=weight(gl_FragCoord.z,a);finalColor.rgb*=a;finalColor*=w;x3d_FragData0=vec4(finalColor.rgb,a);x3d_FragData1=vec4(finalColor.a);
|
|
1657
|
+
#else
|
|
1658
|
+
x3d_FragColor=finalColor;
|
|
1659
|
+
#endif
|
|
1660
|
+
#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)
|
|
1661
|
+
gl_FragDepth=log2(depth)*x3d_LogarithmicFarFactor1_2;
|
|
1662
|
+
#endif
|
|
1663
|
+
}`
|
|
1735
1664
|
;
|
|
1736
1665
|
|
|
1737
1666
|
/* harmony default export */ const VolumeStyle_fs = (external_X_ITE_X3D_Namespace_default().add ("VolumeStyle.fs", VolumeStyle_fs_default_));
|
|
@@ -1812,7 +1741,8 @@ Object .assign (Object .setPrototypeOf (VolumeMaterial .prototype, (external_X_I
|
|
|
1812
1741
|
key += ".";
|
|
1813
1742
|
key += localObjectsKeys .sort () .join (""); // ClipPlane, X3DLightNode
|
|
1814
1743
|
|
|
1815
|
-
return this .volumeShaderNodes .get (key)
|
|
1744
|
+
return this .volumeShaderNodes .get (key)
|
|
1745
|
+
?? this .createShader (key, geometryContext, renderContext);
|
|
1816
1746
|
},
|
|
1817
1747
|
createShader (key, geometryContext, renderContext)
|
|
1818
1748
|
{
|
|
@@ -1824,6 +1754,12 @@ Object .assign (Object .setPrototypeOf (VolumeMaterial .prototype, (external_X_I
|
|
|
1824
1754
|
|
|
1825
1755
|
const objectsKeys = localObjectsKeys .concat (renderObject .getGlobalLightsKeys ());
|
|
1826
1756
|
|
|
1757
|
+
if (renderObject .getLogarithmicDepthBuffer ())
|
|
1758
|
+
options .push ("X3D_LOGARITHMIC_DEPTH_BUFFER");
|
|
1759
|
+
|
|
1760
|
+
if (renderObject .getOrderIndependentTransparency ())
|
|
1761
|
+
options .push ("X3D_ORDER_INDEPENDENT_TRANSPARENCY");
|
|
1762
|
+
|
|
1827
1763
|
switch (fogNode ?.getFogType ())
|
|
1828
1764
|
{
|
|
1829
1765
|
case 1:
|
|
@@ -2279,7 +2215,11 @@ Object .assign (Object .setPrototypeOf (IsoSurfaceVolumeData .prototype, VolumeR
|
|
|
2279
2215
|
// if (DEVELOPMENT)
|
|
2280
2216
|
// console .log ("Creating VolumeData Shader ...");
|
|
2281
2217
|
|
|
2282
|
-
const
|
|
2218
|
+
const
|
|
2219
|
+
opacityMapVolumeStyle = this .getBrowser () .getDefaultVolumeStyle (),
|
|
2220
|
+
styleDefines = new Set ();
|
|
2221
|
+
|
|
2222
|
+
opacityMapVolumeStyle .getDefines (styleDefines);
|
|
2283
2223
|
|
|
2284
2224
|
let
|
|
2285
2225
|
styleUniforms = opacityMapVolumeStyle .getUniformsText (),
|
|
@@ -2290,7 +2230,10 @@ Object .assign (Object .setPrototypeOf (IsoSurfaceVolumeData .prototype, VolumeR
|
|
|
2290
2230
|
styleUniforms += "uniform float surfaceTolerance;\n";
|
|
2291
2231
|
|
|
2292
2232
|
for (const renderStyleNode of this .renderStyleNodes)
|
|
2233
|
+
{
|
|
2234
|
+
renderStyleNode .getDefines (styleDefines);
|
|
2293
2235
|
styleUniforms += renderStyleNode .getUniformsText ();
|
|
2236
|
+
}
|
|
2294
2237
|
|
|
2295
2238
|
styleFunctions += "\n";
|
|
2296
2239
|
styleFunctions += " // IsoSurfaceVolumeData\n";
|
|
@@ -2417,8 +2360,9 @@ Object .assign (Object .setPrototypeOf (IsoSurfaceVolumeData .prototype, VolumeR
|
|
|
2417
2360
|
}
|
|
2418
2361
|
|
|
2419
2362
|
fs = fs
|
|
2420
|
-
.replace (
|
|
2421
|
-
.replace (
|
|
2363
|
+
.replace ("__VOLUME_STYLES_DEFINES__", Array .from (styleDefines) .join ("\n"))
|
|
2364
|
+
.replace ("__VOLUME_STYLES_UNIFORMS__", styleUniforms)
|
|
2365
|
+
.replace ("__VOLUME_STYLES_FUNCTIONS__", styleFunctions);
|
|
2422
2366
|
|
|
2423
2367
|
// if (DEVELOPMENT)
|
|
2424
2368
|
// this .getBrowser () .print (fs);
|
|
@@ -2565,6 +2509,10 @@ Object .assign (Object .setPrototypeOf (ProjectionVolumeStyle .prototype, Volume
|
|
|
2565
2509
|
|
|
2566
2510
|
shaderNode .addUserDefinedField ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "intensityThreshold_" + this .getId (), this ._intensityThreshold .copy ());
|
|
2567
2511
|
},
|
|
2512
|
+
getDefines (defines)
|
|
2513
|
+
{
|
|
2514
|
+
defines .add ("#define X3D_PLANE");
|
|
2515
|
+
},
|
|
2568
2516
|
getUniformsText ()
|
|
2569
2517
|
{
|
|
2570
2518
|
if (! this ._enabled .getValue ())
|
|
@@ -2586,35 +2534,32 @@ Object .assign (Object .setPrototypeOf (ProjectionVolumeStyle .prototype, Volume
|
|
|
2586
2534
|
default:
|
|
2587
2535
|
case "MAX":
|
|
2588
2536
|
{
|
|
2589
|
-
string += " float
|
|
2537
|
+
string += " float projectionColor = 0.0;\n";
|
|
2590
2538
|
break;
|
|
2591
2539
|
}
|
|
2592
2540
|
case "MIN":
|
|
2593
2541
|
{
|
|
2594
|
-
string += " float
|
|
2542
|
+
string += " float projectionColor = 1.0;\n";
|
|
2595
2543
|
break;
|
|
2596
2544
|
}
|
|
2597
2545
|
case "AVERAGE":
|
|
2598
2546
|
{
|
|
2599
|
-
string += " float
|
|
2547
|
+
string += " float projectionColor = 0.0;\n";
|
|
2600
2548
|
break;
|
|
2601
2549
|
}
|
|
2602
2550
|
}
|
|
2603
2551
|
|
|
2604
|
-
string += " const
|
|
2605
|
-
string += " vec3
|
|
2606
|
-
string += "
|
|
2607
|
-
string += "
|
|
2552
|
+
string += " const int samples = 16;\n";
|
|
2553
|
+
string += " vec3 normal = normalize (x3d_TextureNormalMatrix * vec3 (0.0, 0.0, 1.0));\n";
|
|
2554
|
+
string += " Plane3 plane = plane3 (vec3 (0.5), normal);\n";
|
|
2555
|
+
string += " vec3 point = texCoord + plane3_perpendicular_vector (plane, texCoord);\n";
|
|
2556
|
+
string += " vec3 ray = point - normal * M_SQRT1_2;\n";
|
|
2557
|
+
string += " vec3 step = normal * (M_SQRT2 / float (samples));\n";
|
|
2558
|
+
string += " bool first = false;\n";
|
|
2608
2559
|
string += "\n";
|
|
2609
2560
|
string += " for (int i = 0; i < samples; ++ i, ray += step)\n";
|
|
2610
2561
|
string += " {\n";
|
|
2611
|
-
string += " if (
|
|
2612
|
-
string += " continue;\n";
|
|
2613
|
-
string += "\n";
|
|
2614
|
-
string += " if (ray .t < 0.0 || ray .t > 1.0)\n";
|
|
2615
|
-
string += " continue;\n";
|
|
2616
|
-
string += "\n";
|
|
2617
|
-
string += " if (ray .p < 0.0 || ray .p > 1.0)\n";
|
|
2562
|
+
string += " if (any (greaterThan (abs (ray - 0.5), vec3 (0.5))))\n";
|
|
2618
2563
|
string += " continue;\n";
|
|
2619
2564
|
string += "\n";
|
|
2620
2565
|
string += " float intensity = texture (x3d_Texture3D [0], ray) .r;\n";
|
|
@@ -2628,7 +2573,7 @@ Object .assign (Object .setPrototypeOf (ProjectionVolumeStyle .prototype, Volume
|
|
|
2628
2573
|
string += " if (intensity < intensityThreshold_" + this .getId () + ")\n";
|
|
2629
2574
|
string += " continue;\n";
|
|
2630
2575
|
string += "\n";
|
|
2631
|
-
string += " if (intensityThreshold_" + this .getId () + " > 0.0
|
|
2576
|
+
string += " if (first && intensityThreshold_" + this .getId () + " > 0.0)\n";
|
|
2632
2577
|
string += " break;\n";
|
|
2633
2578
|
string += "\n";
|
|
2634
2579
|
string += " if (intensity <= projectionColor)\n";
|
|
@@ -2645,7 +2590,7 @@ Object .assign (Object .setPrototypeOf (ProjectionVolumeStyle .prototype, Volume
|
|
|
2645
2590
|
string += " if (intensity < intensityThreshold_" + this .getId () + ")\n";
|
|
2646
2591
|
string += " continue;\n";
|
|
2647
2592
|
string += "\n";
|
|
2648
|
-
string += " if (intensityThreshold_" + this .getId () + " > 0.0
|
|
2593
|
+
string += " if (first && intensityThreshold_" + this .getId () + " > 0.0)\n";
|
|
2649
2594
|
string += " break;\n";
|
|
2650
2595
|
string += "\n";
|
|
2651
2596
|
string += " if (intensity >= projectionColor)\n";
|
|
@@ -2850,7 +2795,9 @@ Object .assign (Object .setPrototypeOf (SegmentedVolumeData .prototype, VolumeRe
|
|
|
2850
2795
|
// if (DEVELOPMENT)
|
|
2851
2796
|
// console .log ("Creating SegmentedVolumeData Shader ...");
|
|
2852
2797
|
|
|
2853
|
-
const
|
|
2798
|
+
const
|
|
2799
|
+
opacityMapVolumeStyle = this .getBrowser () .getDefaultVolumeStyle (),
|
|
2800
|
+
styleDefines = new Set ();
|
|
2854
2801
|
|
|
2855
2802
|
let
|
|
2856
2803
|
styleUniforms = opacityMapVolumeStyle .getUniformsText (),
|
|
@@ -2878,6 +2825,8 @@ Object .assign (Object .setPrototypeOf (SegmentedVolumeData .prototype, VolumeRe
|
|
|
2878
2825
|
|
|
2879
2826
|
for (const [i, renderStyleNode] of this .renderStyleNodes .entries ())
|
|
2880
2827
|
{
|
|
2828
|
+
renderStyleNode .getDefines (styleDefines);
|
|
2829
|
+
|
|
2881
2830
|
styleFunctions += " case " + i + ":\n";
|
|
2882
2831
|
styleFunctions += " {\n";
|
|
2883
2832
|
|
|
@@ -2899,8 +2848,9 @@ Object .assign (Object .setPrototypeOf (SegmentedVolumeData .prototype, VolumeRe
|
|
|
2899
2848
|
}
|
|
2900
2849
|
|
|
2901
2850
|
fs = fs
|
|
2902
|
-
.replace (
|
|
2903
|
-
.replace (
|
|
2851
|
+
.replace ("__VOLUME_STYLES_DEFINES__", Array .from (styleDefines) .join ("\n"))
|
|
2852
|
+
.replace ("__VOLUME_STYLES_UNIFORMS__", styleUniforms)
|
|
2853
|
+
.replace ("__VOLUME_STYLES_FUNCTIONS__", styleFunctions);
|
|
2904
2854
|
|
|
2905
2855
|
// if (DEVELOPMENT)
|
|
2906
2856
|
// this .getBrowser () .print (fs);
|
|
@@ -3086,6 +3036,10 @@ Object .assign (Object .setPrototypeOf (ShadedVolumeStyle .prototype, VolumeRend
|
|
|
3086
3036
|
if (this .surfaceNormalsNode)
|
|
3087
3037
|
shaderNode .addUserDefinedField ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "surfaceNormals_" + this .getId (), new (external_X_ITE_X3D_Fields_default()).SFNode (this .surfaceNormalsNode));
|
|
3088
3038
|
},
|
|
3039
|
+
getDefines (defines)
|
|
3040
|
+
{
|
|
3041
|
+
defines .add ("#define X3D_SHADING");
|
|
3042
|
+
},
|
|
3089
3043
|
getUniformsText ()
|
|
3090
3044
|
{
|
|
3091
3045
|
if (! this ._enabled .getValue ())
|
|
@@ -3105,20 +3059,6 @@ Object .assign (Object .setPrototypeOf (ShadedVolumeStyle .prototype, VolumeRend
|
|
|
3105
3059
|
|
|
3106
3060
|
string += this .getNormalText (this .surfaceNormalsNode);
|
|
3107
3061
|
|
|
3108
|
-
string += "\n";
|
|
3109
|
-
string += "float\n";
|
|
3110
|
-
string += "getSpotFactor_" + this .getId () + " (const in float cutOffAngle, const in float beamWidth, const in vec3 L, const in vec3 d)\n";
|
|
3111
|
-
string += "{\n";
|
|
3112
|
-
string += " float spotAngle = acos (clamp (dot (-L, d), -1.0, 1.0));\n";
|
|
3113
|
-
string += "\n";
|
|
3114
|
-
string += " if (spotAngle >= cutOffAngle)\n";
|
|
3115
|
-
string += " return 0.0;\n";
|
|
3116
|
-
string += " else if (spotAngle <= beamWidth)\n";
|
|
3117
|
-
string += " return 1.0;\n";
|
|
3118
|
-
string += "\n";
|
|
3119
|
-
string += " return (spotAngle - cutOffAngle) / (beamWidth - cutOffAngle);\n";
|
|
3120
|
-
string += "}\n";
|
|
3121
|
-
|
|
3122
3062
|
string += "\n";
|
|
3123
3063
|
string += "vec4\n";
|
|
3124
3064
|
string += "getShadedStyle_" + this .getId () + " (in vec4 originalColor, in vec3 texCoord)\n";
|
|
@@ -3172,7 +3112,7 @@ Object .assign (Object .setPrototypeOf (ShadedVolumeStyle .prototype, VolumeRend
|
|
|
3172
3112
|
string += " vec3 specularTerm = light .intensity * specularColor_" + this .getId () + " * specularFactor;\n";
|
|
3173
3113
|
string += "\n";
|
|
3174
3114
|
string += " float attenuationFactor = di ? 1.0 : 1.0 / max (dot (c, vec3 (1.0, dL, dL * dL)), 1.0);\n";
|
|
3175
|
-
string += " float spotFactor = light .type == x3d_SpotLight ?
|
|
3115
|
+
string += " float spotFactor = light .type == x3d_SpotLight ? getSpotFactor (light .cutOffAngle, light .beamWidth, L, d) : 1.0;\n";
|
|
3176
3116
|
string += " float attenuationSpotFactor = attenuationFactor * spotFactor;\n";
|
|
3177
3117
|
string += " vec3 ambientColor = light .ambientIntensity * ambientTerm;\n";
|
|
3178
3118
|
string += " vec3 diffuseSpecularColor = light .intensity * (diffuseTerm + specularTerm);\n";
|
|
@@ -3640,9 +3580,7 @@ function VolumeData (executionContext)
|
|
|
3640
3580
|
VolumeRendering_X3DVolumeDataNode .call (this, executionContext);
|
|
3641
3581
|
|
|
3642
3582
|
this .addType ((external_X_ITE_X3D_X3DConstants_default()).VolumeData);
|
|
3643
|
-
|
|
3644
|
-
this .renderStyleNode = null;
|
|
3645
|
-
}
|
|
3583
|
+
}
|
|
3646
3584
|
|
|
3647
3585
|
Object .assign (Object .setPrototypeOf (VolumeData .prototype, VolumeRendering_X3DVolumeDataNode .prototype),
|
|
3648
3586
|
{
|
|
@@ -3694,7 +3632,11 @@ Object .assign (Object .setPrototypeOf (VolumeData .prototype, VolumeRendering_X
|
|
|
3694
3632
|
// if (DEVELOPMENT)
|
|
3695
3633
|
// console .log ("Creating VolumeData Shader ...");
|
|
3696
3634
|
|
|
3697
|
-
const
|
|
3635
|
+
const
|
|
3636
|
+
opacityMapVolumeStyle = this .getBrowser () .getDefaultVolumeStyle (),
|
|
3637
|
+
styleDefines = new Set ();
|
|
3638
|
+
|
|
3639
|
+
opacityMapVolumeStyle .getDefines (styleDefines);
|
|
3698
3640
|
|
|
3699
3641
|
let
|
|
3700
3642
|
styleUniforms = opacityMapVolumeStyle .getUniformsText (),
|
|
@@ -3702,16 +3644,18 @@ Object .assign (Object .setPrototypeOf (VolumeData .prototype, VolumeRendering_X
|
|
|
3702
3644
|
|
|
3703
3645
|
if (this .renderStyleNode)
|
|
3704
3646
|
{
|
|
3647
|
+
this .renderStyleNode .getDefines (styleDefines);
|
|
3648
|
+
|
|
3705
3649
|
styleUniforms += this .renderStyleNode .getUniformsText (),
|
|
3706
3650
|
styleFunctions += this .renderStyleNode .getFunctionsText ();
|
|
3707
3651
|
}
|
|
3708
3652
|
|
|
3709
3653
|
fs = fs
|
|
3710
|
-
.replace (
|
|
3711
|
-
.replace (
|
|
3654
|
+
.replace ("__VOLUME_STYLES_DEFINES__", Array .from (styleDefines) .join ("\n"))
|
|
3655
|
+
.replace ("__VOLUME_STYLES_UNIFORMS__", styleUniforms)
|
|
3656
|
+
.replace ("__VOLUME_STYLES_FUNCTIONS__", styleFunctions);
|
|
3712
3657
|
|
|
3713
|
-
//
|
|
3714
|
-
// this .getBrowser () .print (fs);
|
|
3658
|
+
// this .getBrowser () .print (fs);
|
|
3715
3659
|
|
|
3716
3660
|
const vertexShader = new (external_X_ITE_X3D_ShaderPart_default()) (this .getExecutionContext ());
|
|
3717
3661
|
vertexShader ._url .push (encodeURI ("data:x-shader/x-vertex," + vs));
|
|
@@ -3737,8 +3681,7 @@ Object .assign (Object .setPrototypeOf (VolumeData .prototype, VolumeRendering_X
|
|
|
3737
3681
|
|
|
3738
3682
|
opacityMapVolumeStyle .addShaderFields (shaderNode);
|
|
3739
3683
|
|
|
3740
|
-
|
|
3741
|
-
this .renderStyleNode .addShaderFields (shaderNode);
|
|
3684
|
+
this .renderStyleNode ?.addShaderFields (shaderNode);
|
|
3742
3685
|
|
|
3743
3686
|
const uniformNames = [ ];
|
|
3744
3687
|
|