// Get default textures TexturePtr Doom3ShaderSystem::getDefaultInteractionTexture(ShaderLayer::Type t) { TexturePtr defaultTex; // Look up based on layer type switch (t) { case ShaderLayer::DIFFUSE: case ShaderLayer::SPECULAR: defaultTex = GetTextureManager().getBinding( GlobalRegistry().get(RKEY_BITMAPS_PATH) + IMAGE_BLACK ); break; case ShaderLayer::BUMP: defaultTex = GetTextureManager().getBinding( GlobalRegistry().get(RKEY_BITMAPS_PATH) + IMAGE_FLAT ); break; default: break; } return defaultTex; }
void MriDemo1::Update() { this->GlutApplication::Update(); CameraPoint = GetDragController().GetMode(VIEW_DRAG_MODE).GetDragVector() * 0.2; if (IsSpecialKeyPressed(GLUT_KEY_UP)) { CameraPoint.Z += .01; } if (IsSpecialKeyPressed(GLUT_KEY_DOWN)) { CameraPoint.Z -= .01; } UpdateSprites(); GetMriVisualiser().Update(); /* Keep checking for errors on the download, and if one occurs * just throw an exception (should kill the application). */ if ((mDicomResult != NULL) && !mDicomResult->IsSuccessful()) { THROW_VIMRID_EX(mDicomResult->GetError()); } // Keep checking to see if there are textures that need creating. if (GetTextureManager().IsCreatePending()) { GetTextureManager().CreateAll(); WRITE_DEBUG_TEXT("Textures were created."); } }
/* * Return the light falloff texture (Z dimension). */ TexturePtr CShader::lightFalloffImage() { // Construct the texture if necessary if (!_texLightFalloff) { // Create image. If there is no falloff image defined, use the // default. if (_template->getLightFalloff()) { // create the image _texLightFalloff = GetTextureManager().getBinding(_template->getLightFalloff()); } else { // Find the default light shader in the ShaderSystem and query its // falloff texture name. std::string defLight = game::current::getValue<std::string>(DEFAULT_LIGHT_PATH); MaterialPtr defLightShader = GetShaderSystem()->getMaterialForName(defLight); // Cast to a CShader so we can call getFalloffName(). CShaderPtr cshaderPtr = std::static_pointer_cast<CShader>(defLightShader); // create the image _texLightFalloff = GetTextureManager().getBinding(cshaderPtr->_template->getLightFalloff()); } } // Return the texture return _texLightFalloff; }
void RendererCommon::DEBUGDrawBox2D(const Vector& Min, const Vector& Max, unsigned int Color) { Mesh* BoxMesh = GetMeshFactory()->CreateDebugBox(Min, Max, Color); BoxMesh->m_IsDebugMesh = true; BoxMesh->SetMaterialDefinition(DEFAULT_NEWMATERIAL, this); BoxMesh->SetTexture(0, GetTextureManager()->GetTexture( DEFAULT_TEXTURE, TextureManager::ETL_Permanent)); BoxMesh->SetMaterialFlags(MAT_DEBUG_HUD); AddMesh(BoxMesh); }
void RendererCommon::DEBUGDrawLine2D(const Vector& Start, const Vector& End, unsigned int Color) { Mesh* LineMesh = GetMeshFactory()->CreateDebugLine(Start, End, Color); LineMesh->m_IsDebugMesh = true; LineMesh->SetMaterialDefinition(DEFAULT_NEWMATERIAL, this); LineMesh->SetTexture(0, GetTextureManager()->GetTexture( DEFAULT_TEXTURE, TextureManager::ETL_Permanent)); LineMesh->SetMaterialFlags(MAT_DEBUG_HUD); AddMesh(LineMesh); }
void RendererCommon::DEBUGDrawCross(const Vector& Center, const float Length, unsigned int Color) { Mesh* CrossMesh = GetMeshFactory()->CreateDebugCross(Center, Length, Color); CrossMesh->m_IsDebugMesh = true; CrossMesh->SetMaterialDefinition(DEFAULT_NEWMATERIAL, this); CrossMesh->SetTexture(0, GetTextureManager()->GetTexture( DEFAULT_TEXTURE, TextureManager::ETL_Permanent)); CrossMesh->SetMaterialFlags(MAT_DEBUG_WORLD); AddMesh(CrossMesh); }
void RendererCommon::DEBUGDrawFrustum(const View& rView, unsigned int Color) { Mesh* FrustumMesh = GetMeshFactory()->CreateDebugFrustum(rView, Color); FrustumMesh->m_IsDebugMesh = true; FrustumMesh->SetMaterialDefinition(DEFAULT_NEWMATERIAL, this); FrustumMesh->SetTexture( 0, GetTextureManager()->GetTexture(DEFAULT_TEXTURE, TextureManager::ETL_Permanent)); FrustumMesh->SetMaterialFlags(MAT_DEBUG_WORLD); AddMesh(FrustumMesh); }
void RendererCommon::DEBUGDrawTriangle(const Vector& V1, const Vector& V2, const Vector& V3, unsigned int Color) { Mesh* TriMesh = GetMeshFactory()->CreateDebugTriangle(V1, V2, V3, Color); TriMesh->m_IsDebugMesh = true; TriMesh->SetMaterialDefinition(DEFAULT_NEWMATERIAL, this); TriMesh->SetTexture(0, GetTextureManager()->GetTexture( DEFAULT_TEXTURE, TextureManager::ETL_Permanent)); TriMesh->SetMaterialFlags(MAT_DEBUG_WORLD); AddMesh(TriMesh); }
void RendererCommon::DEBUGDrawArrow(const Vector& Root, const Angles& Direction, const float Length, unsigned int Color) { Mesh* ArrowMesh = GetMeshFactory()->CreateDebugArrow(Root, Direction, Length, Color); ArrowMesh->m_IsDebugMesh = true; ArrowMesh->SetMaterialDefinition(DEFAULT_NEWMATERIAL, this); ArrowMesh->SetTexture(0, GetTextureManager()->GetTexture( DEFAULT_TEXTURE, TextureManager::ETL_Permanent)); ArrowMesh->SetMaterialFlags(MAT_DEBUG_WORLD); AddMesh(ArrowMesh); }
void RendererCommon::DEBUGDrawSphere(const Vector& Center, float Radius, unsigned int Color) { Mesh* SphereMesh = GetMeshFactory()->CreateDebugSphere(Center, Radius, Color); SphereMesh->m_IsDebugMesh = true; SphereMesh->SetMaterialDefinition(DEFAULT_NEWMATERIAL, this); SphereMesh->SetTexture( 0, GetTextureManager()->GetTexture(DEFAULT_TEXTURE, TextureManager::ETL_Permanent)); SphereMesh->SetMaterialFlags(MAT_DEBUG_WORLD); AddMesh(SphereMesh); }
TexturePtr CShader::getEditorImage() { if (!_editorTexture) { // Pass the call to the GLTextureManager to realise this image _editorTexture = GetTextureManager().getBinding( _template->getEditorTexture() ); } return _editorTexture; }
void RendererCommon::DEBUGDrawEllipsoid(const Vector& Center, const Vector& Extents, unsigned int Color) { Mesh* EllipsoidMesh = GetMeshFactory()->CreateDebugEllipsoid(Center, Extents, Color); EllipsoidMesh->m_IsDebugMesh = true; EllipsoidMesh->SetMaterialDefinition(DEFAULT_NEWMATERIAL, this); EllipsoidMesh->SetTexture( 0, GetTextureManager()->GetTexture(DEFAULT_TEXTURE, TextureManager::ETL_Permanent)); EllipsoidMesh->SetMaterialFlags(MAT_DEBUG_WORLD); AddMesh(EllipsoidMesh); }
ImageBlock::ImageBlock(const std::string& image_path, X x, Y y, X w, GG::Flags<GG::WndFlag> flags) : BlockControl(x, y, w, flags), m_graphic(0) { try { boost::shared_ptr<Texture> texture = GetTextureManager().GetTexture(image_path); m_graphic = new StaticGraphic(texture, GRAPHIC_PROPSCALE | GRAPHIC_SHRINKFIT | GRAPHIC_CENTER); AttachChild(m_graphic); } catch (GG::Texture::BadFile& errBadFile) { // No can do inside GiGi. } }
void VimridViewer::Update() { this->GlutApplication::Update(); // Calculate a general speed based on delta. VFloat deltaSpeed = GetUtility().GetDeltaTime() * 0.1; VPoint3f dragVector = getCameraDragVector(); VFloat mDragSpeed = 1; mCameraDragDelta = dragVector - mLastCameraDragVector; mCameraAnimationTarget += mCameraDragDelta * mDragSpeed * deltaSpeed; VFloat maximumY = 170.0; if (mCameraAnimationTarget.Y > maximumY) { mCameraAnimationTarget.Y = maximumY; } VFloat minimumY = 5.0; if (mCameraAnimationTarget.Y < minimumY) { mCameraAnimationTarget.Y = minimumY; } VFloat minZ = -25.0; if (mCameraAnimationTarget.Z < minZ) { mCameraAnimationTarget.Z = minZ; } VFloat maxZ = -7.5; if (mCameraAnimationTarget.Z > maxZ) { mCameraAnimationTarget.Z = maxZ; } const VFloat zSpeed = 0.03; const VFloat fpSpeed = 0.03; const VFloat esSpeed = 0.01; if (IsSpecialKeyPressed(GLUT_KEY_UP)) { mCameraAnimationTarget.Z += zSpeed * deltaSpeed; } if (IsSpecialKeyPressed(GLUT_KEY_DOWN)) { mCameraAnimationTarget.Z -= zSpeed * deltaSpeed; } if (IsSpecialKeyPressed(GLUT_KEY_PAGE_UP)) { GetFixationPoint() -= fpSpeed * deltaSpeed; } if (IsSpecialKeyPressed(GLUT_KEY_PAGE_DOWN)) { GetFixationPoint() += fpSpeed * deltaSpeed; } if (IsSpecialKeyPressed(GLUT_KEY_LEFT)) { GetEyeSeparation() -= esSpeed * deltaSpeed; } if (IsSpecialKeyPressed(GLUT_KEY_RIGHT)) { GetEyeSeparation() += esSpeed * deltaSpeed; } UpdateSprites(); GetMriVisualiser().Update(); // Keep checking to see if there are textures that need creating. if (GetTextureManager().IsCreatePending()) { GetTextureManager().CreateAll(); WRITE_DEBUG_TEXT("Textures were created."); } string te = (GetUtility().IsTrackdEnabled() ? "Enabled" : "Disabled"); string se = (IsStereoEnabled() ? "Enabled" : "Disabled"); ADD_STATUS_LINE( "[Motion Sensing: " << te << "] " << "[Stereography: " << se << "]"); VFloat fp = GetFixationPoint(); VFloat es = GetEyeSeparation(); ADD_STATUS_LINE( "[Fixation Point: " << fp << "] " << "[Eye Separation: " << es << "]"); ADD_STATUS_LINE("[Smooth Cursor: " << GetUtility().GetCursorPositionSmooth() << "]"); /* HACK: Big hack! This needs making more robust, currently it just * looks at the Y axis and the code is very difficult to modify. Should * also be abstracted out of this class. */ /*VFloat minimumY = 5.0; VFloat maximumY = 170.0; VPoint3f baseCamera = this->GlutApplication::GetCameraVector(); if (GetCameraVector().Y < minimumY) { // Only counter if the cursor was moved down. if ((mLastCameraVector.Y - GetCameraVector().Y) > 0) { // Record the amount that the user has over-stepped. mCameraCouteract.Y = baseCamera.Y - minimumY; } } if (GetCameraVector().Y > maximumY) { // Counter if moved upward. if ((mLastCameraVector.Y - GetCameraVector().Y) < 0) { mCameraCouteract.Y = baseCamera.Y - maximumY; } } ADD_STATUS_LINE("[Camera Counteract: " << mCameraCouteract << "]"); mLastCameraVector = GetCameraVector();*/ /* Smoothly move the camera toward the target based on delta time so * it's constant over all computers. Don't bother altering if the sync * is only off by 0.1 point (otherwise camera twich occurs). */ VPoint3f animateDistance = mCameraAnimationTarget - mCameraAnimationBuffer; //if ((trimSync > VPoint3f(0.1, 0.1, 0.1)) || (trimSync < VPoint3f(-0.1, -0.1, -0.1))) { const VFloat animateSpeed = 0.05; mCameraAnimationBuffer += animateDistance * animateSpeed * deltaSpeed; } mLastCameraDragVector = dragVector; if (!mMenuAutoShown) { // Reset cursor so it appears centered in menu. GetUtility().ResetCursor(); // Show during init to ensure UI container has been setup. mMainMenu->Show(); mMenuAutoShown = true; } }
bool CShader::isEditorImageNoTex() { return (getEditorImage() == GetTextureManager().getShaderNotFound()); }
CShader::~CShader() { unrealise(); GetTextureManager().checkBindings(); }