Skip to content

Commit

Permalink
voxel occlusion testing
Browse files Browse the repository at this point in the history
  • Loading branch information
turanszkij committed Feb 28, 2024
1 parent 4d7e514 commit 9ec92f3
Show file tree
Hide file tree
Showing 9 changed files with 285 additions and 50 deletions.
5 changes: 5 additions & 0 deletions Content/Documentation/ScriptingAPI-Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ Render images on the screen.
- GetTexture() : Texture
- SetMaskTexture(Texture texture)
- GetMaskTexture() : Texture
- SetHidden(bool value)
- IsHidden() : bool

#### ImageParams
Specify Sprite properties, like position, size, etc.
Expand Down Expand Up @@ -1765,6 +1767,9 @@ Path finding operations can be made by using a voxel grid and path queries. The
- GetDebugColorExtent() : Vector -- returns color of debug visualization of voxel grid extents
- SetDebugColorExtent(Vector color) -- set the color for debug visualization of voxel grid extents
- GetMemorySize() : int -- returns the memory consumption of the voxel grid in bytes
- IsVisible(int observer_x,observer_y,observer_z, subject_x,subject_y,subject_z) : bool -- performs line of sight occlusion test from observer to subject voxel coordinates. Returns false if occlusion was found, true otherwise.
- IsVisible(AABB observer, subject) : bool -- performs line of sight occlusion test from observer to subject world space points. Returns false if occlusion was found, true otherwise.
- IsVisible(AABB observer, AABB subject) : bool -- performs line of sight occlusion test from observer world space point to subject AABB. Returns true if any of the AABB's touched voxels is visible, false otherwise.

#### PathQuery
- [constructor] PathQuery()
Expand Down
1 change: 1 addition & 0 deletions WickedEngine/wiRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7347,6 +7347,7 @@ void DrawDebugWorld(
params.size = x.params.pixel_height;
params.scaling = 1.0f / params.size * x.params.scaling;
params.color = wi::Color::fromFloat4(x.params.color);
params.intensity = x.params.color.w > 1 ? x.params.color.w : 1;
params.h_align = wi::font::WIFALIGN_CENTER;
params.v_align = wi::font::WIFALIGN_CENTER;
params.softness = 0.0f;
Expand Down
18 changes: 18 additions & 0 deletions WickedEngine/wiSprite_BindLua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace wi::lua
lunamethod(Sprite_BindLua, GetTexture),
lunamethod(Sprite_BindLua, SetMaskTexture),
lunamethod(Sprite_BindLua, GetMaskTexture),
lunamethod(Sprite_BindLua, SetHidden),
lunamethod(Sprite_BindLua, IsHidden),

{ NULL, NULL }
};
Expand Down Expand Up @@ -131,6 +133,22 @@ namespace wi::lua
Luna<Texture_BindLua>::push(L, sprite.maskResource);
return 1;
}
int Sprite_BindLua::SetHidden(lua_State* L)
{
int argc = wi::lua::SGetArgCount(L);
if (argc < 1)
{
wi::lua::SError(L, "SetHidden(bool value) not enough arguments!");
return 0;
}
sprite.SetHidden(wi::lua::SGetBool(L, 1));
return 0;
}
int Sprite_BindLua::IsHidden(lua_State* L)
{
wi::lua::SSetBool(L, sprite.IsHidden());
return 1;
}

void Sprite_BindLua::Bind()
{
Expand Down
2 changes: 2 additions & 0 deletions WickedEngine/wiSprite_BindLua.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace wi::lua
int GetTexture(lua_State* L);
int SetMaskTexture(lua_State* L);
int GetMaskTexture(lua_State* L);
int SetHidden(lua_State* L);
int IsHidden(lua_State* L);

static void Bind();
};
Expand Down
4 changes: 2 additions & 2 deletions WickedEngine/wiVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 383;
const int revision = 384;

const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);

Expand Down Expand Up @@ -50,7 +50,7 @@ All contributors: https://github.com/turanszkij/WickedEngine/graphs/contributors
Patreon supporters
---------------------------
Nemerle, James Webb, Quifeng Jin, TheGameCreators, Joseph Goldin, Yuri, Sergey K, Yukawa Kanta, Dragon Josh, John, LurkingNinja, Bernardo Del Castillo, Invictus, Scott Hunt, Yazan Altaki, Tuan NV, Robert MacGregor, cybernescence, Alexander Dahlin, blueapples, Delhills, NI NI, Sherief, ktopoet, Justin Macklin, Cédric Fabre, TogetherTeam, Bartosz Boczula, Arne Koenig, Ivan Trajchev, nathants, Fahd Ahmed, Gabriel Jadderson, SAS_Controller, Dominik Madarász, Segfault, Mike amanfo, Dennis Brakhane, rookie, Peter Moore, therealjtgill, Nicolas Embleton, Desuuc, radino1977, Anthony Curtis, manni heck, Matthias Hölzl, Phyffer, Lucas Pinheiro, Tapkaara, gpman, Anthony Python, Gnowos, Klaus, slaughternaut, Paul Brain, Connor Greaves, Alexandr, Lee Bamber, MCAlarm MC2, Titoutan, Willow, Aldo, lokimx, K. Osterman, Nomad
Nemerle, James Webb, Quifeng Jin, TheGameCreators, Joseph Goldin, Yuri, Sergey K, Yukawa Kanta, Dragon Josh, John, LurkingNinja, Bernardo Del Castillo, Invictus, Scott Hunt, Yazan Altaki, Tuan NV, Robert MacGregor, cybernescence, Alexander Dahlin, blueapples, Delhills, NI NI, Sherief, ktopoet, Justin Macklin, Cédric Fabre, TogetherTeam, Bartosz Boczula, Arne Koenig, Ivan Trajchev, nathants, Fahd Ahmed, Gabriel Jadderson, SAS_Controller, Dominik Madarász, Segfault, Mike amanfo, Dennis Brakhane, rookie, Peter Moore, therealjtgill, Nicolas Embleton, Desuuc, radino1977, Anthony Curtis, manni heck, Matthias Hölzl, Phyffer, Lucas Pinheiro, Tapkaara, gpman, Anthony Python, Gnowos, Klaus, slaughternaut, Paul Brain, Connor Greaves, Alexandr, Lee Bamber, MCAlarm MC2, Titoutan, Willow, Aldo, lokimx, K. Osterman, Nomad, ykl
)";

return credits;
Expand Down
Loading

0 comments on commit 9ec92f3

Please sign in to comment.