/** * Set up the class to create line features on a terrain. * * \param pTerr The terrain you will generate the contour lines on. * \param fset The featureset to receive the polylines. * \return True if successful. */ bool vtContourConverter::Setup(vtTerrain *pTerr, vtFeatureSetLineString *fset) { if (!pTerr) return false; if (!SetupTerrain(pTerr)) return false; m_pLS = fset; return true; }
/* * Set up all elements of the scene using [importer] to load any assets from disk. * * [ambientLightObject] - Global scene object that contains the global ambient light. * [directLightObject] - Global scene object that contains the global directional light. * [playerObject] - Scene object that contains the player mesh & renderer. */ void PoolScene::Setup(GTE::AssetImporter& importer, GTE::SceneObjectSharedPtr ambientLightObject, GTE::SceneObjectSharedPtr directionalLightObject, GTE::SceneObjectSharedPtr playerObject) { importer.SetBoolProperty(GTE::AssetImporterBoolProperty::PreserveFBXPivots, false); // get reference to the engine's object manager GTE::EngineObjectManager * objectManager = GTE::Engine::Instance()->GetEngineObjectManager(); sceneRoot = objectManager->CreateSceneObject(); ASSERT(sceneRoot.IsValid(), "Could not create scene root for pool scene!\n"); SetupTerrain(importer); SetupStructures(importer); SetupPlants(importer); SetupExtra(importer); SetupWaterSurface(importer); SetupLights(importer, playerObject); this->directionalLightObject = directionalLightObject; this->playerObject = playerObject; }
/** * Set up the class to create geometry on a terrain. * * \param pTerr The terrain you will generate the contour lines on. * \param color The colors of the generated lines. * \param fHeight The height above the terrain to drape the lines. Generally * you will want to use a small offset value here, to keep the lines from * colliding with the terrain itself. * \return A geometry node which contains the contours. */ vtGeode *vtContourConverter::Setup(vtTerrain *pTerr, const RGBf &color, float fHeight) { if (!pTerr) return NULL; if (!SetupTerrain(pTerr)) return NULL; m_fHeight = fHeight; // Create material and geometry to contain the vector geometry vtMaterialArrayPtr pMats = new vtMaterialArray; pMats->AddRGBMaterial1(color, false, false, true); m_pGeode = new vtGeode; m_pGeode->setName("Contour Geometry"); m_pGeode->SetMaterials(pMats); m_pMF = new vtGeomFactory(m_pGeode, osg::PrimitiveSet::LINE_STRIP, 0, 30000, 0); return m_pGeode; }