From 14aea7acc90b9c19127a3b773d9bdde34fd68ff0 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 3 Sep 2013 02:31:21 +0200 Subject: [PATCH] Removed the debug triangle from the material editor plugin. --HG-- branch : gsoc2013-dfighter --- .../material_editor_window.cpp | 14 -- .../material_editor/material_editor_window.h | 3 +- .../material_editor/nel3d_interface.cpp | 138 ------------------ .../plugins/material_editor/nel3d_interface.h | 1 - 4 files changed, 1 insertion(+), 155 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp index 6e70f02f3..408a21d3b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp @@ -260,13 +260,6 @@ namespace MaterialEditor viewPort->stopTimedUpdates(); } - void MaterialEditorWindow::onTriangleClicked() - { - nl3dIface->clearScene(); - materialSplitter->onSceneCleared(); - nl3dIface->drawTriangle(); - } - void MaterialEditorWindow::createMenus() { Core::MenuManager *mm = Core::ICore::instance()->menuManager(); @@ -312,13 +305,6 @@ namespace MaterialEditor a = new QAction( tr( "Clear scene" ), NULL ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onClearSceneClicked() ) ); mm->addAction( a ); - - QMenu *mmmm = mm->addMenu( tr( "Debug" ) ); - { - a = new QAction( tr( "Triangle" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onTriangleClicked() ) ); - mmmm->addAction( a ); - } } a = new QAction( tr( "Shaders" ), NULL ); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h index 7e68f4813..9a4aeb265 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h @@ -51,8 +51,7 @@ private Q_SLOTS: void onAddTeaPotClicked(); void onClearSceneClicked(); - void onTriangleClicked(); - + private: void createMenus(); void createDockWidgets(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp index 41878c14f..aa44a64ab 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp @@ -447,144 +447,6 @@ namespace MaterialEditor return loadShape( "primitives/teapot.shape" ); } - const char *vs = - "#version 330\n" - "\n" - "layout ( location = 0 ) in vec4 vertex;\n" - "layout ( location = 3 ) in vec4 color;\n" - "out vec4 vColor;\n" - "\n" - "void main( void )\n" - "{\n" - "gl_Position = vertex;\n" - "vColor = color;\n" - "}\n"; - - const char *ps = - "#version 330\n" - "\n" - "in vec4 vColor;\n" - "out vec4 color;\n" - "\n" - "uniform float redShift;" - "\n" - "void main( void )\n" - "{\n" - "vec4 finalColor = vColor.rgba;\n" - "finalColor.r = redShift;\n" - "color = finalColor;\n" - "}\n"; - - void CNel3DInterface::drawTriangle() - { - NL3D::CDriverUser *d = dynamic_cast< NL3D::CDriverUser* >( driver ); - if( d != NULL ) - { - NL3D::IDriver *id = d->getDriver(); - - NL3D::CVertexBuffer vb; - vb.setVertexFormat( NL3D::CVertexBuffer::PositionFlag | NL3D::CVertexBuffer::PrimaryColorFlag ); - vb.setNumVertices( 3 ); - vb.setPreferredMemory( NL3D::CVertexBuffer::StaticPreferred, false ); - - NL3D::CVertexBufferReadWrite rw; - vb.lock( rw ); - rw.setVertexCoord( 0, -1.0f, -1.0f, 0.0f ); - rw.setColor( 0, NLMISC::CRGBA::Red ); - rw.setVertexCoord( 1, 1.0f, -1.0f, 0.0f ); - rw.setColor( 1, NLMISC::CRGBA::Green ); - rw.setVertexCoord( 2, 0.0f, 1.0f, 0.0f ); - rw.setColor( 2, NLMISC::CRGBA::Blue ); - rw.unlock(); - - NL3D::CIndexBuffer ib; - ib.setNumIndexes( 3 ); - ib.setFormat( NL3D::CIndexBuffer::Indices32 ); - ib.setPreferredMemory( NL3D::CIndexBuffer::StaticPreferred, false ); - - NL3D::CIndexBufferReadWrite iw; - ib.lock( iw ); - iw.setTri( 0, 0, 1, 2 ); - iw.unlock(); - - NL3D::CMaterial mat; - - NL3D::IProgramObject *po = id->createProgramObject(); - NL3D::IProgram *vp = id->createVertexProgram(); - NL3D::IProgram *pp = id->createPixelProgram(); - - vp->shaderSource( vs ); - pp->shaderSource( ps ); - - std::string log; - bool ok = false; - - ok = vp->compile( log ); - if( !ok ) - { - delete po; - delete vp; - delete pp; - return; - } - - ok = pp->compile( log ); - if( !ok ) - { - delete po; - delete vp; - delete pp; - return; - } - - ok = po->attachVertexProgram( vp ); - if( !ok ) - { - delete po; - return; - } - - ok = po->attachPixelProgram( pp ); - if( !ok ) - { - delete po; - return; - } - - ok = po->link( log ); - if( !ok ) - { - delete po; - return; - } - - ok = id->activeProgramObject( po ); - if( !ok ) - { - delete po; - return; - } - - int opacityLocation = id->getUniformLocation( "redShift" ); - if( opacityLocation != -1 ) - id->setUniform1f( opacityLocation, 0.25f ); - - id->activeVertexBuffer( vb ); - id->activeIndexBuffer( ib ); - - driver->clearBuffers( NLMISC::CRGBA::Black ); - NLMISC::CMatrix f; - f.identity(); - driver->setFrustumMatrix( f ); - - id->renderRawTriangles2( mat, 0, 1 ); - driver->swapBuffers(); - id->activeProgramObject( NULL ); - delete po; - } - } - - bool CNel3DInterface::loadShape( const std::string &fileName ) { NLMISC::CPath::addSearchPath( NLMISC::CFile::getPath( fileName ), false, false ); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.h index 80c2eb132..0c45cf0fd 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.h @@ -161,7 +161,6 @@ namespace MaterialEditor bool addSphere(); bool addCylinder(); bool addTeaPot(); - void drawTriangle(); bool loadShape( const std::string &fileName ); void clearScene();