From ca1756c504c21ccc10f681da49c5969b9c9a3afc Mon Sep 17 00:00:00 2001 From: David Williams Date: Mon, 8 Oct 2007 01:25:53 +0000 Subject: [PATCH] Adding axis for debugging. --- source/IndexedSurfacePatch.cpp | 5 +- source/PolyVoxSceneManager.cpp | 152 +++++++++------------------------ 2 files changed, 39 insertions(+), 118 deletions(-) diff --git a/source/IndexedSurfacePatch.cpp b/source/IndexedSurfacePatch.cpp index a2092d00..6d1c5519 100644 --- a/source/IndexedSurfacePatch.cpp +++ b/source/IndexedSurfacePatch.cpp @@ -26,12 +26,9 @@ namespace Ogre vecVertices.resize(m_listVertices.size()); std::copy(m_listVertices.begin(), m_listVertices.end(), vecVertices.begin()); - //vecIndices.resize(m_listTriangles.size() * 3); for(std::vector::iterator iterVertices = m_vecTriangleIndices.begin(); iterVertices != m_vecTriangleIndices.end(); ++iterVertices) { - std::vector::iterator iterVertex; - - iterVertex = lower_bound(vecVertices.begin(), vecVertices.end(), **iterVertices); + std::vector::iterator iterVertex = lower_bound(vecVertices.begin(), vecVertices.end(), **iterVertices); vecIndices.push_back(iterVertex - vecVertices.begin()); } } diff --git a/source/PolyVoxSceneManager.cpp b/source/PolyVoxSceneManager.cpp index 8a1b48bb..329e38fb 100644 --- a/source/PolyVoxSceneManager.cpp +++ b/source/PolyVoxSceneManager.cpp @@ -114,124 +114,53 @@ namespace Ogre getRootSceneNode()->removeAndDestroyAllChildren(); + //Create Arrows - //Create surrounding box - //FIXME - should do this using indices - /*ManualObject* metalBox = createManualObject("MetalBox"); + ManualObject* xAxis = createManualObject("X-Axis"); - metalBox->begin("Examples/BumpyMetal",RenderOperation::OT_TRIANGLE_STRIP); - metalBox->position(0,0,0); - metalBox->textureCoord(0,0); - metalBox->normal(0,0,1); - metalBox->position(512,0,0); - metalBox->textureCoord(1,0); - metalBox->normal(0,0,1); - metalBox->position(0,512,0); - metalBox->textureCoord(0,1); - metalBox->normal(0,0,1); - metalBox->position(512,512,0); - metalBox->textureCoord(1,1); - metalBox->normal(0,0,1); - metalBox->end();*/ - /*metalBox->begin("Examples/BumpyMetal",RenderOperation::OT_TRIANGLE_STRIP); - metalBox->position(0,0,0); - metalBox->textureCoord(0,0); - metalBox->normal(0,1,0); - metalBox->position(0,0,512); - metalBox->textureCoord(0,1); - metalBox->normal(0,1,0); - metalBox->position(512,0,0); - metalBox->textureCoord(1,0); - metalBox->normal(0,1,0); - metalBox->position(512,0,512); - metalBox->textureCoord(1,1); - metalBox->normal(0,1,0); - metalBox->end();*/ + uint uArrowTotalLength = 256; + uint uArrowHeadLength = 8; + uint uArrowBarLength = uArrowTotalLength - uArrowHeadLength; - /*metalBox->begin("Examples/BumpyMetal",RenderOperation::OT_TRIANGLE_STRIP); - metalBox->position(0,0,0); - metalBox->textureCoord(0,0); - metalBox->normal(1,0,0); - metalBox->position(0,512,0); - metalBox->textureCoord(1,0); - metalBox->normal(1,0,0); - metalBox->position(0,0,512); - metalBox->textureCoord(0,1); - metalBox->normal(1,0,0); - metalBox->position(0,512,512); - metalBox->textureCoord(1,1); - metalBox->normal(1,0,0); - metalBox->end(); + xAxis->begin("BaseWhiteNoLighting",RenderOperation::OT_TRIANGLE_LIST); + xAxis->position(0, -1,-1); + xAxis->position(uArrowBarLength, -1,-1); + xAxis->position(0, 1,-1); + xAxis->position(uArrowBarLength, 1,-1); + xAxis->position(0, -1, 1); + xAxis->position(uArrowBarLength, -1, 1); + xAxis->position(0, 1, 1); + xAxis->position(uArrowBarLength, 1, 1); - metalBox->begin("Examples/BumpyMetal",RenderOperation::OT_TRIANGLE_STRIP); - metalBox->position(0,0,512); - metalBox->textureCoord(0,0); - metalBox->normal(0,0,-1); - metalBox->position(0,512,512); - metalBox->textureCoord(0,1); - metalBox->normal(0,0,-1); - metalBox->position(512,0,512); - metalBox->textureCoord(1,0); - metalBox->normal(0,0,-1); - metalBox->position(512,512,512); - metalBox->textureCoord(1,1); - metalBox->normal(0,0,-1); - metalBox->end(); + xAxis->position(uArrowBarLength, -2, -2); + xAxis->position(uArrowBarLength, 2, -2); + xAxis->position(uArrowBarLength, -2, 2); + xAxis->position(uArrowBarLength, 2, 2); + xAxis->position(uArrowTotalLength, 0, 0); - metalBox->begin("Examples/BumpyMetal",RenderOperation::OT_TRIANGLE_STRIP); - metalBox->position(0,512,0); - metalBox->textureCoord(0,0); - metalBox->normal(0,-1,0); - metalBox->position(512,512,0); - metalBox->textureCoord(1,0); - metalBox->normal(0,-1,0); - metalBox->position(0,512,512); - metalBox->textureCoord(0,1); - metalBox->normal(0,-1,0); - metalBox->position(512,512,512); - metalBox->textureCoord(1,1); - metalBox->normal(0,-1,0); - metalBox->end(); + xAxis->index(0); xAxis->index(4); xAxis->index(2); + xAxis->index(2); xAxis->index(4); xAxis->index(6); - metalBox->begin("Examples/BumpyMetal",RenderOperation::OT_TRIANGLE_STRIP); - metalBox->position(512,0,0); - metalBox->textureCoord(0,0); - metalBox->normal(-1,0,0); - metalBox->position(512,0,512); - metalBox->textureCoord(0,1); - metalBox->normal(-1,0,0); - metalBox->position(512,512,0); - metalBox->textureCoord(1,0); - metalBox->normal(-1,0,0); - metalBox->position(512,512,512); - metalBox->textureCoord(1,1); - metalBox->normal(-1,0,0); - metalBox->end(); + xAxis->index(7); xAxis->index(6); xAxis->index(4); + xAxis->index(4); xAxis->index(5); xAxis->index(7); + xAxis->index(0); xAxis->index(2); xAxis->index(3); + xAxis->index(3); xAxis->index(1); xAxis->index(0); + xAxis->index(2); xAxis->index(6); xAxis->index(7); + xAxis->index(7); xAxis->index(3); xAxis->index(2); + xAxis->index(0); xAxis->index(1); xAxis->index(5); + xAxis->index(5); xAxis->index(4); xAxis->index(0); - SceneNode* boxSceneNode = getRootSceneNode()->createChildSceneNode(); - boxSceneNode->attachObject(metalBox);*/ + xAxis->index(8); xAxis->index(11); xAxis->index(9); + xAxis->index(8); xAxis->index(10); xAxis->index(11); + xAxis->index(9); xAxis->index(11); xAxis->index(12); + xAxis->index(11); xAxis->index(10); xAxis->index(12); + xAxis->index(8); xAxis->index(9); xAxis->index(12); + xAxis->index(10); xAxis->index(8); xAxis->index(12); + xAxis->end(); - /*ManualObject* water = createManualObject("WaterPlane"); - - water->begin("DavidWater",RenderOperation::OT_TRIANGLE_STRIP); - water->position(-1024,100,-1024); - water->textureCoord(0,0); - water->normal(0,1,0); - water->position(-1024,100,1024); - water->textureCoord(0,1); - water->normal(0,1,0); - water->position(1024,100,-1024); - water->textureCoord(1,0); - water->normal(0,1,0); - water->position(1024,100,1024); - water->textureCoord(1,1); - water->normal(0,1,0); - - water->end(); - - SceneNode* waterSceneNode = getRootSceneNode()->createChildSceneNode(); - waterSceneNode->attachObject(water);*/ + SceneNode* axisNode = getRootSceneNode()->createChildSceneNode(); + axisNode->attachObject(xAxis); return true; } @@ -887,11 +816,6 @@ namespace Ogre m_normalGenerationMethod = method; } - /*void PolyVoxSceneManager::setMaterialNameForIndex(uchar uIndex, std::string sMaterialName) - { - m_aMaterialNames[uIndex] = sMaterialName; - }*/ - bool PolyVoxSceneManager::containsPoint(Vector3 pos, float boundary) { return volumeData->containsPoint(pos, boundary);