From 5697b2f0a106a321a300c456db329f986c4ac7ae Mon Sep 17 00:00:00 2001 From: Antoine Chavasse Date: Fri, 6 Jul 2007 15:34:38 +0200 Subject: [PATCH] Minor cleanup here and there. --- app/startup.lua | 27 ++++++--------------------- core/pointer.h | 5 +++++ gui/BoringTheme/ButtonDecorator.cpp | 9 +++------ gui/BoringTheme/WindowDecorator.cpp | 2 +- gui/SimpleContainer.cpp | 2 +- scenegraph/material.aih | 9 --------- scenegraph/scenegraph.aidl | 2 +- shapes/Rectangle.cpp | 2 +- 8 files changed, 18 insertions(+), 40 deletions(-) diff --git a/app/startup.lua b/app/startup.lua index b3a06e7..c187f3d 100644 --- a/app/startup.lua +++ b/app/startup.lua @@ -97,10 +97,6 @@ end -- Initialize SDL application object. It just use some arbitrary defaults for now. app = awful.sdl.App.GetInstance() - --- Create a rendering context. ---rc = awful.renderer.Context() - scene = CreateTestScene() collectgarbage() @@ -114,7 +110,6 @@ camframe.LocalToParent.position.z = 7 camframe:dirty() proj = sg.PerspectiveProjection() ---proj = sg.OrthographicProjection() -- Create viewport viewport = sg.ViewPort( proj, camera ) @@ -149,6 +144,12 @@ guiroot:buildSceneGraph() guiroot:calcMinMax() guiroot:layout() +-- Setup the gui viewport +guiproj = sg.PixelProjection() +guiviewport = sg.ViewPort( guiproj ) +guiviewport.Rect = awful.math.Rectu32( 0, 0, 800, 600 ) +guiviewport.bClearColorBuffer = false + -- Setup the frame update function. eventmanager = awful.gui.EventManager.GetInstance() @@ -168,10 +169,6 @@ app.MouseButtonEvent:connect( ) eventmanager.DefaultHandler = guiroot -guiproj = sg.PixelProjection() -guiviewport = sg.ViewPort( guiproj ) -guiviewport.Rect = awful.math.Rectu32( 0, 0, 800, 600 ) -guiviewport.bClearColorBuffer = false spin = 0 @@ -179,12 +176,6 @@ app.FrameUpdate:connect( function( deltatime ) - --rc.Offset = awful.math.Vector2f() - - --rc:clear() - - - sg.RenderContext.ClearAll() guicontext = sg.RenderContext( guiviewport ) @@ -203,12 +194,6 @@ app.FrameUpdate:connect( sg.RenderContext.RenderAll() - --rc:prepare() - ---rc:clear() - -- guiroot:render( rc ) - --rc:setColor( 1, 1, 0 ) - --rc:drawText( 0, 0, "FPS: ") - app:needSwap() end diff --git a/core/pointer.h b/core/pointer.h index cc79a4c..4d6d93d 100644 --- a/core/pointer.h +++ b/core/pointer.h @@ -36,6 +36,11 @@ namespace awful { decRef(); } + + P raw() const + { + return m_pObj; + } operator P() const { diff --git a/gui/BoringTheme/ButtonDecorator.cpp b/gui/BoringTheme/ButtonDecorator.cpp index 51399d7..5c9a32d 100644 --- a/gui/BoringTheme/ButtonDecorator.cpp +++ b/gui/BoringTheme/ButtonDecorator.cpp @@ -28,16 +28,16 @@ void BoringButtonDecorator::buildSceneGraph( Pointer< scenegraph::Frame >& o_pFr m_pRectFrame->setpParent( o_pFrame ); m_pRectangle = new shapes::Rectangle( m_pTheme->m_pIdleButtonMat, m_pRectFrame ); - pGroup->add( static_cast< shapes::Rectangle* >( m_pRectangle ) ); + pGroup->add( m_pRectangle.raw() ); m_pTextFrame = new scenegraph::Frame; m_pTextFrame->setpParent( o_pFrame ); m_pText = new scenegraph::Text ( m_pTheme->m_pFont, m_pTextFrame, m_pTheme->m_pTextMat ); - pGroup->add( static_cast< scenegraph::Text* >( m_pText ) ); + pGroup->add( m_pText.raw() ); - o_pRenderable = static_cast< scenegraph::Group* >( pGroup ); + o_pRenderable = pGroup.raw(); } void BoringButtonDecorator::calcMinMax() @@ -54,9 +54,6 @@ void BoringButtonDecorator::calcMinMax() void BoringButtonDecorator::layout() { const math::Rectf& rect( m_pButton->getRect() ); - -// m_labelx = ( rect.width() - m_pFont->getTextWidth( label ) ) / 2.f; - //m_labely = ( rect.height() - m_pFont->getHeight() ) / 2.f; math::Matrix44f& mtx = m_pRectFrame->getLocalToParent(); mtx.right().x() = rect.width(); diff --git a/gui/BoringTheme/WindowDecorator.cpp b/gui/BoringTheme/WindowDecorator.cpp index 1d90735..efa01f6 100644 --- a/gui/BoringTheme/WindowDecorator.cpp +++ b/gui/BoringTheme/WindowDecorator.cpp @@ -27,7 +27,7 @@ void BoringWindowDecorator::buildSceneGraph( Pointer< scenegraph::Frame >& o_pFr m_pFrame->setpParent( o_pFrame ); Pointer< scenegraph::Group > pGroup = new scenegraph::Group( o_pFrame ); - o_pRenderable = static_cast< scenegraph::Group* >( pGroup ); + o_pRenderable = pGroup.raw(); pGroup->add( new shapes::Rectangle( m_pTheme->m_pWindowMat, m_pFrame ) ); diff --git a/gui/SimpleContainer.cpp b/gui/SimpleContainer.cpp index a7ed0f4..52d958e 100644 --- a/gui/SimpleContainer.cpp +++ b/gui/SimpleContainer.cpp @@ -21,7 +21,7 @@ void SimpleContainer::buildSceneGraph() { m_pFrame = new scenegraph::Frame(); Pointer< scenegraph::Group > pGroup = new scenegraph::Group( m_pFrame ); - m_pRenderable = static_cast< scenegraph::Renderable* >( pGroup ); + m_pRenderable = pGroup.raw(); WidgetList::const_iterator it; for( it = m_Children.begin(); it != m_Children.end(); ++it ) diff --git a/scenegraph/material.aih b/scenegraph/material.aih index 716906e..60188f5 100644 --- a/scenegraph/material.aih +++ b/scenegraph/material.aih @@ -32,15 +32,6 @@ namespace awful { namespace scenegraph bool bBackfaceCulling; }; - - /* - glEnable( GL_LIGHTING ); - glEnable( GL_DEPTH_TEST ); - glShadeModel( GL_SMOOTH ); - glCullFace( GL_BACK ); - glEnable( GL_CULL_FACE ); - */ - /* class Shader { };*/ diff --git a/scenegraph/scenegraph.aidl b/scenegraph/scenegraph.aidl index 3e0a5b2..93ec57d 100644 --- a/scenegraph/scenegraph.aidl +++ b/scenegraph/scenegraph.aidl @@ -131,7 +131,7 @@ namespace awful { namespace scenegraph // dynamic and it would feel a bit inneficient to allocate/free that many // drawables, and to assign each of them their own frame etc. // something nicer using instanciation will have to be devised later, - // in the meantime fonts are renderer by letting ftgl send vertices manually) + // in the meantime fonts are rendered by letting ftgl send vertices manually) [ storable=false ] class Font { diff --git a/shapes/Rectangle.cpp b/shapes/Rectangle.cpp index e117c83..5700e29 100644 --- a/shapes/Rectangle.cpp +++ b/shapes/Rectangle.cpp @@ -32,7 +32,7 @@ void Rectangle::CreateGeometry() pIB->setIndex( 2, 2 ); pIB->setIndex( 3, 3 ); - Pointer< IndexBuffer > pTmp = static_cast< IndexBuffer16* >( pIB ); + Pointer< IndexBuffer > pTmp = pIB.raw(); ms_pGeom = new Geometry( pVB, pTmp ); ms_pGeom->addPrimitive( Primitive::t_Quads, 0, 4 ); } -- 2.11.4.GIT