SceneGadget::SceneGadget() : Gadget( defaultName<SceneGadget>() ), m_paused( false ), m_renderer( IECoreScenePreview::Renderer::create( "OpenGL", IECoreScenePreview::Renderer::Interactive ) ), m_controller( nullptr, nullptr, m_renderer ), m_updateErrored( false ), m_renderRequestPending( false ) { typedef CompoundObject::ObjectMap::value_type Option; CompoundObjectPtr openGLOptions = new CompoundObject; openGLOptions->members().insert( { Option( "gl:primitive:wireframeColor", new Color4fData( Color4f( 0.2f, 0.2f, 0.2f, 1.0f ) ) ), Option( "gl:primitive:pointColor", new Color4fData( Color4f( 0.9f, 0.9f, 0.9f, 1.0f ) ) ), Option( "gl:primitive:pointWidth", new FloatData( 2.0f ) ) } ); setOpenGLOptions( openGLOptions.get() ); m_controller.updateRequiredSignal().connect( boost::bind( &SceneGadget::requestRender, this ) ); visibilityChangedSignal().connect( boost::bind( &SceneGadget::visibilityChanged, this ) ); setContext( new Context ); }
ObjectPtr FromHoudiniPolygonsConverter::doDetailConversion( const GU_Detail *geo, const CompoundObject *operands ) const { const GA_PrimitiveList &primitives = geo->getPrimitiveList(); MeshPrimitivePtr result = new MeshPrimitive(); size_t numEdges = 0; std::vector<int> vertIds; std::vector<int> vertsPerFace; GA_Offset start, end; for( GA_Iterator it( geo->getPrimitiveRange() ); it.blockAdvance( start, end ); ) { for( GA_Offset offset = start; offset < end; ++offset ) { const GA_Primitive *prim = primitives.get( offset ); if( prim->getTypeId() != GEO_PRIMPOLY ) { throw std::runtime_error( "FromHoudiniPolygonsConverter: Geometry contains non-polygon primitives" ); } size_t numPrimVerts = prim->getVertexCount(); vertsPerFace.push_back( numPrimVerts ); numEdges += numPrimVerts; std::vector<int> ids( numPrimVerts ); for( size_t j = 0; j < numPrimVerts; j++ ) { vertIds.push_back( geo->pointIndex( prim->getPointOffset( numPrimVerts - 1 - j ) ) ); } } } result->setTopology( new IntVectorData( vertsPerFace ), new IntVectorData( vertIds ) ); CompoundObjectPtr modifiedOperands = transferMeshInterpolation( geo, operands, result.get() ); if( geo->getNumVertices() ) { transferAttribs( geo, result.get(), modifiedOperands ? modifiedOperands.get() : operands ); } // check for corners and creases, which would have been extracted via transferAttribs() // as they are no different to standard attribs in Houdini. convertCorners( result.get() ); convertCreases( result.get(), vertIds, numEdges ); return result; }