start of block rendering code

gh-pages
Brian Jack 2015-01-16 02:22:04 -08:00
parent 4b4eafa39c
commit a87168a388
3 changed files with 49 additions and 0 deletions

View File

@ -141,6 +141,8 @@
<Unit filename="auto/version.h" />
<Unit filename="bvgame/core.cpp" />
<Unit filename="bvgame/core.hpp" />
<Unit filename="chunk.cpp" />
<Unit filename="chunk.hpp" />
<Unit filename="client.cpp">
<Option target="ClientDebug" />
<Option target="ClientRelease" />

View File

@ -17,3 +17,47 @@
**
*/
#include "client.hpp"
namespace bvclient {
/** @brief generate visible mesh for visible blocks
Cenetered on 0,0,0 of loaded block cache looking
in the direction of the specified viewer angle.
360deg = 0deg = north, 90deg = east,
180deg = south, 270deg = west
@param angle: viewer angle
*/
void ClientFrontEnd::TriangulateScene(float angle) {
// normalize angle
while (angle>=360.0) angle-=360.0;
while (angle<0.0) angle+=360.0;
/** @todo
for third person we look from
behind player from a fixed camera point
or nearest obstruction along line from
player's head to camera point, whichever
is shorter */
// get block at 0,0,1 (player head)
//
// If this is an obstructing (solid) block show only this block's
// edge faces and we are done. minetest et al tend to use the
// algorithm "treat blocks of same general type (any stone type,
// any sand type, etc) as the block at player's head as air and
// show bordering blocks that differ" When head is inside a solid
// block this creates an "x-ray" mode. Instead I only show the
// block the player's head is inside of.
//
// If block is a non-obstructing block (air, water, lava, space, etc)
// the do the bordering blocks algorithm to find surfaces of visible
// blocks within viewing range (if the loader is optimized any nonvisible
// blocks behind solid blocks won't be loaded anyways). Above paragraph
// explains the bordering blocks algorithm.
//
// x-ray may be made into a boolean setting that enables x-ray
// viewing (performs bordering blocks alg) when center contains
// a solid block.
//
}
}

View File

@ -119,6 +119,9 @@ namespace bvclient {
guienv->clear();
}
/** @brief generate visible mesh for visible blocks */
void TriangulateScene(float angle);
void setGUIFont(std::string fontfile) {
IGUISkin* skin = guienv->getSkin();
IGUIFont* font = guienv->getFont(fontfile.c_str());