void OGRE3DRenderSystem::setVisualisationMode(NxOgre::Enums::VisualDebugger type) { if (Ogre::MaterialManager::getSingletonPtr()->resourceExists("OGRE3DRenderSystem.VisualDebugger") == false) { Ogre::MaterialPtr material = Ogre::MaterialManager::getSingletonPtr()->create("OGRE3DRenderSystem.VisualDebugger", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); material->getTechnique(0)->getPass(0)->setDepthBias(1); material->getTechnique(0)->getPass(0)->setAmbient(1,1,1); material->getTechnique(0)->getPass(0)->setSelfIllumination(1,1,1); material->getTechnique(0)->setLightingEnabled(false); } if (mVisualDebuggerRenderable == 0) { mVisualDebuggerRenderable = createRenderable(NxOgre::Enums::RenderableType_VisualDebugger, "OGRE3DRenderSystem.VisualDebugger"); ::NxOgre::World::getWorld()->getVisualDebugger()->setRenderable(mVisualDebuggerRenderable); mVisualDebuggerRenderable->setCastShadows(false); mVisualDebuggerNode = mSceneManager->getRootSceneNode()->createChildSceneNode(); mVisualDebuggerNode->attachObject(mVisualDebuggerRenderable); } ::NxOgre::World::getWorld()->getVisualDebugger()->setVisualisationMode(type); if (type == NxOgre::Enums::VisualDebugger_ShowNone) mVisualDebuggerNode->setVisible(false); else mVisualDebuggerNode->setVisible(true); mVisualDebuggerShown = (type != NxOgre::Enums::VisualDebugger_ShowNone); }
NxOgre::SoftBody* OGRE3DRenderSystem::createSoftBody(const NxOgre::SoftBodyDescription& description, const Ogre::String& materialName) { OGRE3DRenderable* renderable = createRenderable(NxOgre::Enums::RenderableType_SoftBody); mSceneManager->getRootSceneNode()->attachObject(renderable); renderable->setMaterial(materialName); return mScene->createSoftBody(description, renderable, NxOgre::Enums::Priority_MediumLow); }
TexturePtr LinearGradient::createAsTexture(int width, int height) { const float w = static_cast<float>(width); const float h = static_cast<float>(height); const float sa = std::abs(std::sin(-angle_ / 180.0f * static_cast<float>(M_PI))); const float ca = std::abs(std::cos(-angle_ / 180.0f * static_cast<float>(M_PI))); //const float length = std::min(ca < FLT_EPSILON ? FLT_MAX : width / ca, sa < FLT_EPSILON ? FLT_MAX : height / sa); //const float length = std::min(ca < FLT_EPSILON ? w : 2.0f * ca * w, sa < FLT_EPSILON ? h : 2.0f * sa * h); WindowPtr wnd = WindowManager::getMainWindow(); CameraPtr cam = std::make_shared<Camera>("ortho_lg", 0, width, 0, height); auto grad = createRenderable(); grad->setCamera(cam); grad->setScale(ca < FLT_EPSILON ? w : 2.0f * w / ca, sa < FLT_EPSILON ? h : 2.0f * h / sa); grad->setPosition(w/2.0f, h/2.0f); RenderTargetPtr rt = RenderTarget::create(width, height); rt->getTexture()->setFiltering(-1, Texture::Filtering::LINEAR, Texture::Filtering::LINEAR, Texture::Filtering::POINT); rt->getTexture()->setAddressModes(-1, Texture::AddressMode::CLAMP, Texture::AddressMode::CLAMP); rt->setCentre(Blittable::Centre::TOP_LEFT); rt->setClearColor(Color(0,0,0,0)); { RenderTarget::RenderScope rs(rt, rect(0, 0, width, height)); grad->preRender(wnd); wnd->render(grad.get()); } return rt->getTexture(); }
void TerrainGrid::onSceneReset(void) { if (mBaseSceneNode) { //initTerrGridRend(); createRenderable(); } }