mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
libblock.raycast: Add argument to specify blocks to ignore during ray casting
libentity.raycast: Add argument to specify blocks to ignore during ray casting Chunk::rayCast: Add argument to specify blocks to ignore during ray casting. On lua side filter blocks are passed as list of strings in form of "MOD:BLOCK_NAME" On C++ size filter blocks are std::set of blockid_t
This commit is contained in:
parent
8ef288c189
commit
1be50c2e06
4 changed files with 56 additions and 12 deletions
|
|
@ -414,7 +414,8 @@ voxel* Chunks::rayCast(
|
|||
float maxDist,
|
||||
glm::vec3& end,
|
||||
glm::ivec3& norm,
|
||||
glm::ivec3& iend
|
||||
glm::ivec3& iend,
|
||||
std::set<blockid_t> filter
|
||||
) {
|
||||
float px = start.x;
|
||||
float py = start.y;
|
||||
|
|
@ -454,8 +455,10 @@ voxel* Chunks::rayCast(
|
|||
if (voxel == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const auto& def = indices->blocks.require(voxel->id);
|
||||
if (def.selectable) {
|
||||
if ((filter.empty() && def.selectable) ||
|
||||
(!filter.empty() && filter.find(def.rt.id) == filter.end())) {
|
||||
end.x = px + t * dx;
|
||||
end.y = py + t * dy;
|
||||
end.z = pz + t * dz;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue