mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 13:33:27 +02:00
Added options to selectively toggle heightfield/dual contour surface
rendering.
This commit is contained in:
parent
9c43748d35
commit
34cba5c031
3 changed files with 30 additions and 27 deletions
|
@ -432,6 +432,8 @@ Menu::Menu() :
|
||||||
QMenu* metavoxelOptionsMenu = developerMenu->addMenu("Metavoxels");
|
QMenu* metavoxelOptionsMenu = developerMenu->addMenu("Metavoxels");
|
||||||
addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::DisplayHermiteData, 0, false,
|
addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::DisplayHermiteData, 0, false,
|
||||||
Application::getInstance()->getMetavoxels(), SLOT(refreshVoxelData()));
|
Application::getInstance()->getMetavoxels(), SLOT(refreshVoxelData()));
|
||||||
|
addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::RenderHeightfields, 0, true);
|
||||||
|
addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::RenderDualContourSurfaces, 0, true);
|
||||||
addActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::NetworkSimulator, 0, this,
|
addActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::NetworkSimulator, 0, this,
|
||||||
SLOT(showMetavoxelNetworkSimulator()));
|
SLOT(showMetavoxelNetworkSimulator()));
|
||||||
|
|
||||||
|
|
|
@ -446,8 +446,10 @@ namespace MenuOption {
|
||||||
const QString Quit = "Quit";
|
const QString Quit = "Quit";
|
||||||
const QString ReloadAllScripts = "Reload All Scripts";
|
const QString ReloadAllScripts = "Reload All Scripts";
|
||||||
const QString RenderBoundingCollisionShapes = "Show Bounding Collision Shapes";
|
const QString RenderBoundingCollisionShapes = "Show Bounding Collision Shapes";
|
||||||
|
const QString RenderDualContourSurfaces = "Render Dual Contour Surfaces";
|
||||||
const QString RenderFocusIndicator = "Show Eye Focus";
|
const QString RenderFocusIndicator = "Show Eye Focus";
|
||||||
const QString RenderHeadCollisionShapes = "Show Head Collision Shapes";
|
const QString RenderHeadCollisionShapes = "Show Head Collision Shapes";
|
||||||
|
const QString RenderHeightfields = "Render Heightfields";
|
||||||
const QString RenderLookAtVectors = "Show Look-at Vectors";
|
const QString RenderLookAtVectors = "Show Look-at Vectors";
|
||||||
const QString RenderSkeletonCollisionShapes = "Show Skeleton Collision Shapes";
|
const QString RenderSkeletonCollisionShapes = "Show Skeleton Collision Shapes";
|
||||||
const QString RenderResolution = "Scale Resolution";
|
const QString RenderResolution = "Scale Resolution";
|
||||||
|
|
|
@ -2772,40 +2772,39 @@ void DefaultMetavoxelRendererImplementation::render(MetavoxelData& data, Metavox
|
||||||
|
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
_baseHeightfieldProgram.bind();
|
if (Menu::getInstance()->isOptionChecked(MenuOption::RenderHeightfields)) {
|
||||||
|
_baseHeightfieldProgram.bind();
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
|
|
||||||
BufferRenderVisitor heightfieldRenderVisitor(Application::getInstance()->getMetavoxels()->getHeightfieldBufferAttribute());
|
|
||||||
data.guide(heightfieldRenderVisitor);
|
|
||||||
|
|
||||||
_baseHeightfieldProgram.release();
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE2);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
|
||||||
|
BufferRenderVisitor heightfieldRenderVisitor(Application::getInstance()->getMetavoxels()->getHeightfieldBufferAttribute());
|
||||||
|
data.guide(heightfieldRenderVisitor);
|
||||||
|
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
_baseHeightfieldProgram.release();
|
||||||
|
}
|
||||||
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
if (Menu::getInstance()->isOptionChecked(MenuOption::RenderDualContourSurfaces)) {
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
glEnableClientState(GL_NORMAL_ARRAY);
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
_baseVoxelProgram.bind();
|
_baseVoxelProgram.bind();
|
||||||
|
|
||||||
BufferRenderVisitor voxelRenderVisitor(Application::getInstance()->getMetavoxels()->getVoxelBufferAttribute());
|
BufferRenderVisitor voxelRenderVisitor(Application::getInstance()->getMetavoxels()->getVoxelBufferAttribute());
|
||||||
data.guide(voxelRenderVisitor);
|
data.guide(voxelRenderVisitor);
|
||||||
|
|
||||||
_baseVoxelProgram.release();
|
_baseVoxelProgram.release();
|
||||||
|
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_NORMAL_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
|
||||||
glDisableClientState(GL_NORMAL_ARRAY);
|
|
||||||
|
|
||||||
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
|
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue