Skip to content

Commit

Permalink
Fix SceneModel DTX edge renderer for entity offsetting #1196
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Oct 26, 2023
1 parent 530a2fd commit 06fde38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ export class TrianglesDataTextureColorRenderer {

src.push("uniform int renderPass;");

if (scene.entityOffsetsEnabled) {
src.push("in vec3 offset;");
}
// if (scene.entityOffsetsEnabled) {
// src.push("in vec3 offset;");
// }

src.push("uniform mat4 sceneModelWorldMatrix;");
src.push("uniform mat4 viewMatrix;");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ export class TrianglesDataTextureEdgesColorRenderer {
if (gotOrigin || gotPosition) {
const rtcOrigin = tempVec3a;
if (gotOrigin) {
const rotatedOrigin = tempVec3b;
math.transformPoint3(rotationMatrix, origin, rotatedOrigin);
const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);
rtcOrigin[0] = rotatedOrigin[0];
rtcOrigin[1] = rotatedOrigin[1];
rtcOrigin[2] = rotatedOrigin[2];
Expand Down Expand Up @@ -335,7 +334,7 @@ export class TrianglesDataTextureEdgesColorRenderer {
// get XYZ offset
src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");

// src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");

src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);

const tempVec3a = math.vec3();
const tempVec3b = math.vec3();
const tempVec3c = math.vec3();
const tempVec3d = math.vec3();
const tempMat4a = math.mat4();

Expand Down Expand Up @@ -70,8 +69,7 @@ export class TrianglesDataTextureEdgesRenderer {
if (gotOrigin || gotPosition) {
const rtcOrigin = tempVec3a;
if (gotOrigin) {
const rotatedOrigin = tempVec3b;
math.transformPoint3(rotationMatrix, origin, rotatedOrigin);
const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);
rtcOrigin[0] = rotatedOrigin[0];
rtcOrigin[1] = rotatedOrigin[1];
rtcOrigin[2] = rotatedOrigin[2];
Expand Down Expand Up @@ -253,9 +251,9 @@ export class TrianglesDataTextureEdgesRenderer {

src.push("uniform int renderPass;");

if (scene.entityOffsetsEnabled) {
src.push("in vec3 offset;");
}
// if (scene.entityOffsetsEnabled) {
// src.push("in vec3 offset;");
// }

src.push("uniform mat4 sceneModelWorldMatrix;");
src.push("uniform mat4 viewMatrix;");
Expand Down Expand Up @@ -340,7 +338,7 @@ export class TrianglesDataTextureEdgesRenderer {
// get XYZ offset
src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");

src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz + vec3(110.0,50.0, 10.0);");

src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");

Expand Down

0 comments on commit 06fde38

Please sign in to comment.