@volter/blender-engine 0.1.89 → 0.1.90
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.
|
@@ -363,15 +363,23 @@ ${compiled.uvs.map(n => `varying vec2 ${uvVarying(n)};`).join('\n')}`;
|
|
|
363
363
|
'#include <project_vertex>',
|
|
364
364
|
`vBlenderObjectPosition = transformed;
|
|
365
365
|
vBlenderObjectNormal = objectNormal;
|
|
366
|
-
|
|
366
|
+
vec4 blenderWorldPosition = vec4(transformed, 1.0);
|
|
367
|
+
#ifdef USE_INSTANCING
|
|
368
|
+
blenderWorldPosition = instanceMatrix * blenderWorldPosition;
|
|
369
|
+
#endif
|
|
367
370
|
#ifdef USE_BATCHING
|
|
368
|
-
|
|
371
|
+
blenderWorldPosition = batchingMatrix * blenderWorldPosition;
|
|
369
372
|
#endif
|
|
370
|
-
|
|
371
|
-
|
|
373
|
+
vBlenderWorldPosition = (modelMatrix * blenderWorldPosition).xyz;
|
|
374
|
+
// Three already computed inverse-transpose(modelView) * objectNormal,
|
|
375
|
+
// including the supported instance/batch normal transforms. Multiplying by
|
|
376
|
+
// transpose(view) removes that view transform without another matrix inverse.
|
|
377
|
+
// Our instance planners retain ordinary draws for shear/singular transforms.
|
|
378
|
+
vec3 blenderWorldNormal = transpose(mat3(viewMatrix)) * transformedNormal;
|
|
379
|
+
#ifdef FLIP_SIDED
|
|
380
|
+
blenderWorldNormal = -blenderWorldNormal;
|
|
372
381
|
#endif
|
|
373
|
-
|
|
374
|
-
vBlenderWorldNormal = normalize(transpose(inverse(mat3(blenderWorldMatrix))) * objectNormal);
|
|
382
|
+
vBlenderWorldNormal = normalize(blenderWorldNormal);
|
|
375
383
|
vBlenderOrco = blenderOrco;
|
|
376
384
|
${compiled.attributes.map(n => `${attributeVarying(n)} = ${graphAttributeName(n)};`).join('\n')}
|
|
377
385
|
${compiled.uvs.map(n => `${uvVarying(n)} = ${attribute(channels[n] ?? 0)};`).join('\n')}
|
|
@@ -109,7 +109,7 @@ export function applyPhysicalMaterial(material: THREE.MeshPhysicalMaterial, inpu
|
|
|
109
109
|
blenderWorldExtinction: {value: new THREE.Vector3()}};
|
|
110
110
|
uniforms.set(material, values);
|
|
111
111
|
const held = values;
|
|
112
|
-
material.customProgramCacheKey = () => `blender-principled-physical-
|
|
112
|
+
material.customProgramCacheKey = () => `blender-principled-physical-v6${graphProgramKey(material)}`;
|
|
113
113
|
material.onBeforeRender = (renderer, scene, camera, geometry, object) => {
|
|
114
114
|
bindNamedUvChannels(material, geometry);
|
|
115
115
|
bindGraphDraw(material, geometry, renderer, scene, camera, object, graphShadow);
|