mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 23:56:29 +02:00
add Voxels.getFaceVector() to JS
This commit is contained in:
parent
4e28a8c312
commit
03d6173c90
2 changed files with 21 additions and 0 deletions
|
@ -64,3 +64,21 @@ RayToVoxelIntersectionResult VoxelsScriptingInterface::findRayIntersection(const
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 VoxelsScriptingInterface::getFaceVector(const QString& face) {
|
||||||
|
if (face == "MIN_X_FACE") {
|
||||||
|
return glm::vec3(-1, 0, 0);
|
||||||
|
} else if (face == "MAX_X_FACE") {
|
||||||
|
return glm::vec3(1, 0, 0);
|
||||||
|
} else if (face == "MIN_Y_FACE") {
|
||||||
|
return glm::vec3(0, -1, 0);
|
||||||
|
} else if (face == "MAX_Y_FACE") {
|
||||||
|
return glm::vec3(0, 1, 0);
|
||||||
|
} else if (face == "MIN_Z_FACE") {
|
||||||
|
return glm::vec3(0, 0, -1);
|
||||||
|
} else if (face == "MAX_Z_FACE") {
|
||||||
|
return glm::vec3(0, 0, 1);
|
||||||
|
}
|
||||||
|
return glm::vec3(0, 0, 0); //error case
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,9 @@ public slots:
|
||||||
/// If the scripting context has visible voxels, this will determine a ray intersection
|
/// If the scripting context has visible voxels, this will determine a ray intersection
|
||||||
RayToVoxelIntersectionResult findRayIntersection(const PickRay& ray);
|
RayToVoxelIntersectionResult findRayIntersection(const PickRay& ray);
|
||||||
|
|
||||||
|
/// returns a voxel space axis aligned vector for the face, useful in doing voxel math
|
||||||
|
glm::vec3 getFaceVector(const QString& face);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void queueVoxelAdd(PacketType addPacketType, VoxelDetail& addVoxelDetails);
|
void queueVoxelAdd(PacketType addPacketType, VoxelDetail& addVoxelDetails);
|
||||||
VoxelTree* _tree;
|
VoxelTree* _tree;
|
||||||
|
|
Loading…
Reference in a new issue