plLayer& plLayer::InitToDefault() { fState->Reset(); *fTexture = nil; SetRuntimeColor(hsColorRGBA().Set(0.5f, 0.5f, 0.5f, 1.f)); SetPreshadeColor(hsColorRGBA().Set(0.5f, 0.5f, 0.5f, 1.f)); SetAmbientColor(hsColorRGBA().Set(0,0,0,1.f)); SetOpacity(1.f); fTransform->Reset(); SetUVWSrc(0); SetLODBias(-1.f); SetSpecularColor( hsColorRGBA().Set(0,0,0,1.f)); SetSpecularPower(1.f); *fVertexShader = nil; *fPixelShader = nil; fBumpEnvXfm->Reset(); return *this; }
distantLight::distantLight(const vector &d, const rgb &dc, const rgb &sc, const rgb &ac, bool shad) { SetDirection(d); SetAmbientColor(ac); SetDiffuseColor(dc); SetSpecularColor(sc); canShadow = shad; }
pointLight::pointLight(const point &p, const rgb &dc, const rgb &sc, const rgb &ac, double cAtten, double lAtten, double qAtten) { hasPosition = true; SetPosition(p); SetAmbientColor(ac); SetDiffuseColor(dc); SetSpecularColor(sc); SetAttenuations(cAtten, lAtten, qAtten); }
void Observatory::LoadContent() { currentCamera->position = Vec3(0, 0, -5); SetAmbientColor(Colour(0.2, 0.2, 0.2)); ModelManager::getInstance()->CreatePlane("plane", 1, 1); ModelManager::getInstance()->CreatePlane("surface", 1, 1, 3, 1); ModelManager::getInstance()->CreateSkybox("skybox", 10); ModelManager::getInstance()->CreateCuboid("doorModel", 0.25f, 0.5f, 0.05f); ModelManager::getInstance()->loadModel("meteor1", "Models/meteor_01.obj", true); ModelManager::getInstance()->loadModel("meteor2", "Models/meteor_02.obj", true); ModelManager::getInstance()->loadModel("meteor3", "Models/meteor_03.obj", true); ModelManager::getInstance()->loadModel("planet", "Models/planet.obj", true); ModelManager::getInstance()->loadModel("planet2", "Models/planet.obj", true); ModelManager::getInstance()->loadModel("torch", "Models/torch.obj", true); ModelManager::getInstance()->loadTexture("floor", "Images/dungeonFloor.tif"); ModelManager::getInstance()->loadTexture("wall", "Images/dungeonWall.tif"); ModelManager::getInstance()->loadTexture("space", "Images/spaceSkybox.tif"); ModelManager::getInstance()->loadTexture("door", "Images/door.png"); ModelManager::getInstance()->loadTexture("footprint", "Images/footprint.png"); ModelManager::getInstance()->loadTexture("layerGrid", "Images/grid.png"); ModelManager::getInstance()->loadTexture("meteorTex1", "Images/meteor_texture.tif"); ModelManager::getInstance()->loadTexture("meteorTex2", "Images/meteor_texture_2.tif"); ModelManager::getInstance()->loadTexture("meteorTex3", "Images/meteor_texture_3.tif"); ModelManager::getInstance()->loadTexture("planetTex", "Images/hoth.tif"); ModelManager::getInstance()->loadTexture("planetTex1", "Images/PlanetTex.png"); ModelManager::getInstance()->loadTexture("sunTex", "Images/sun.tif"); ModelManager::getInstance()->loadTexture("aruba", "Images/aruba.tif"); ModelManager::getInstance()->loadTexture("Rim", "Images/planet_Rim.tif"); ModelManager::getInstance()->loadTexture("minerMoon", "Images/minersMoon.tif"); ModelManager::getInstance()->loadTexture("8ball", "Images/Ball8.tif"); ModelManager::getInstance()->loadTexture("torchTexture", "Images/torch_DIF.tif"); ModelManager::getInstance()->loadTexture("smoke", "Images/Smoke.png"); AudioManager::getInstance()->loadMusic("observatory", "Sounds/observatory-loop.wav"); AudioManager::getInstance()->setMusicVolume(0.0f); FontManager::getInstance()->GenerateFont("font", 72, "Font/DroidSans.ttf"); Label *shadow = new Label(this, "Project: Thomas Engine Demo", FontManager::getInstance()->GetFont("font"), Vec2(-200, 37), ScreenAnchor::BOTTOM_RIGHT, Colour::Black()); shadow->Scale(Vec3::One() * 0.4f); Label *label = new Label(this, "Project: Thomas Engine Demo", FontManager::getInstance()->GetFont("font"), Vec2(-202, 35), ScreenAnchor::BOTTOM_RIGHT, Colour::Yellow()); label->Scale(Vec3::One() * 0.4f); player = new Player(this, currentCamera); hallway = new Hallway(this, Vec3::Zero()); obr = new ObservatoryRoom(this, Vec3(0, 0, 15), player); door = new SlidingDoor(this, Vec3(0, 0, 4.9f), player); FPS_Controls::FPSMoveSpeed = 1.5f; }
void DexSkinMesh::InitShader() { D3DXMatrixIdentity(&matWVP); memset(jointsMatrix, 0, sizeof(D3DXMATRIX)* sGetMaxJointCount()); if (DexGameEngine::getEngine()->GetRender() != DexNull) { m_pShaderForMesh = DexGameEngine::getEngine()->GetRender()->GetShader(DexShaderHlslSkinMesh::getClassType()); m_pShaderForVertexToJoint = DexGameEngine::getEngine()->GetRender()->GetShader(DexShaderHlslSkinMeshVertexToJoint::getClassType()); m_pShaderForVertexNormal = DexGameEngine::getEngine()->GetRender()->GetShader(DexShaderHlslSkinMeshVertexNormal::getClassType()); } SetAmbientColor(DexColor(0.3f, 0.0f, 0.0f, 1.0f)); }
// Create. MapilVoid GLDirectionalLight::Create( const ColorARGB < MapilFloat32 >& colorDiffuse, const ColorARGB < MapilFloat32 >& colorAmbient, const ColorARGB < MapilFloat32 >& colorSpecular, const Vector3 < MapilFloat32 >& vDir, MapilFloat32 attenuation0, MapilFloat32 attenuation1, MapilFloat32 attenuation2 ) { SetDiffuseColor( colorDiffuse ); SetAmbientColor( colorAmbient ); SetSpecularColor( colorSpecular ); SetDirection( vDir ); SetAttenuation( attenuation0, attenuation1, attenuation2 ); }
plLayerDepth::plLayerDepth() { SetZFlags(hsGMatState::kZNoZRead | hsGMatState::kZNoZWrite); SetBlendFlags(hsGMatState::kBlendAdd); SetMiscFlags(hsGMatState::kMiscRestartPassHere | hsGMatState::kMiscTroubledLoner); SetPreshadeColor(hsColorRGBA().Set(0,0,0,1.f)); SetRuntimeColor(hsColorRGBA().Set(0,0,0,1.f)); SetAmbientColor(hsColorRGBA().Set(0.1f, 0.1f, 0.1f, 1.f)); SetOpacity(1.f); *fTexture = nil; }
void plLayer::CloneNoTexture( plLayerInterface *original ) { SetBlendFlags( original->GetBlendFlags() ); SetClampFlags( original->GetClampFlags() ); SetShadeFlags( original->GetShadeFlags() ); SetZFlags( original->GetZFlags() ); SetMiscFlags( original->GetMiscFlags() ); SetState( original->GetState() ); SetPreshadeColor( original->GetPreshadeColor() ); SetRuntimeColor( original->GetRuntimeColor() ); SetAmbientColor( original->GetAmbientColor() ); SetSpecularColor( original->GetSpecularColor() ); SetOpacity( original->GetOpacity() ); SetTransform( original->GetTransform() ); SetUVWSrc( original->GetUVWSrc() ); SetLODBias( original->GetLODBias() ); SetSpecularPower( original->GetSpecularPower() ); SetVertexShader( original->GetVertexShader() ); SetPixelShader( original->GetPixelShader() ); SetBumpEnvMatrix( original->GetBumpEnvMatrix() ); }
// Create. MapilVoid D3DPointLight::Create( const ColorARGB < MapilFloat32 >& colorDiffuse, const ColorARGB < MapilFloat32 >& colorAmbient, const ColorARGB < MapilFloat32 >& colorSpecular, const Vector3 < MapilFloat32 >& vPos, MapilFloat32 attenuation0, MapilFloat32 attenuation1, MapilFloat32 attenuation2 ) { Assert( !m_IsUsed, CURRENT_POSITION, TSTR( "The point light was already created." ), -1 ); m_LightIndex = AttachLightIndex(); Assert( m_LightIndex != -1, CURRENT_POSITION, TSTR( "Reached max light index." ), -2 ); m_IsUsed = MapilTrue; //Type of light m_D3DLight.Type = ::D3DLIGHT_POINT; SetDiffuseColor( colorDiffuse ); SetAmbientColor( colorAmbient ); SetSpecularColor( colorSpecular ); SetPosition( vPos ); m_D3DLight.Range = 100.0f; }