void GR_CortexPrimitive::update( RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p ) { #if UT_MAJOR_VERSION_INT >= 15 GU_DetailHandleAutoReadLock handle( p.geometry ); if ( !handle.isValid() ) { m_scene = 0; m_renderable = 0; return; } const GU_Detail *detail = handle.getGdp(); #else const GU_Detail *detail = &p.geometry; #endif GA_Offset offset = detail->primitiveOffset( m_primId ); const CortexPrimitive *prim = dynamic_cast<const CortexPrimitive *>( detail->getGEOPrimitive( offset ) ); if ( !prim ) { m_scene = 0; m_renderable = 0; return; } m_renderable = IECore::runTimeCast<const IECore::Renderable>( prim->getObject() ); if ( !m_renderable ) { m_scene = 0; return; } IECoreGL::RendererPtr renderer = new IECoreGL::Renderer(); renderer->setOption( "gl:mode", new IECore::StringData( "deferred" ) ); renderer->setOption( "gl:drawCoordinateSystems", new IECore::BoolData( true ) ); renderer->worldBegin(); if ( p.dopts.boundBox() ) { const IECore::VisibleRenderable *visible = IECore::runTimeCast<const IECore::VisibleRenderable>( m_renderable ); if ( visible ) { IECore::MeshPrimitive::createBox( visible->bound() )->render( renderer.get() ); } } else { m_renderable->render( renderer.get() ); } renderer->worldEnd(); m_scene = renderer->scene(); m_scene->setCamera( 0 ); // houdini will be providing the camera }
void RenderableGadget::setRenderable( IECore::ConstVisibleRenderablePtr renderable ) { if( renderable!=m_renderable ) { m_renderable = renderable; m_scene = 0; if( m_renderable ) { IECoreGL::RendererPtr renderer = new IECoreGL::Renderer; renderer->setOption( "gl:mode", new IECore::StringData( "deferred" ) ); { IECore::WorldBlock world( renderer ); m_renderable->render( renderer.get() ); } m_scene = renderer->scene(); m_scene->setCamera( 0 ); applySelection(); } renderRequestSignal()( this ); } }