x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
Light.cpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\DarkPuzzle\GameEngine\Light.cpp
Girar
Efecto
Propiedad
Historial
#pragma once //#include "DXUT.h" #include "DarkPuzzle.h" #include "Light.h" #include "GameEngine.h" namespace DarkBattle{ list
lightPool; list
::iterator currentIterator = lightPool.begin(); const char* Light::lightNames[] = {"LampPost","LightEye"}; int Light::identifyLightType(const char* name){ for (int i=0;i
GetTransformMatrix(); D3DXMATRIX trans; D3DXMatrixTranslation(&trans,0,0,15.0f); return ret*trans; } D3DXMATRIX Light::getLampPostTransform(){ D3DXMATRIX ret = pInstance->GetTransformMatrix(); D3DXMATRIX trans; D3DXMatrixTranslation(&trans,0,0,11.0f); return ret*trans; } Light* Light::CreateLight(const Game3DInstance* pInstance, int type){ assert(type
=0); return new Light(pInstance,lightNames[type]); } Light::Light(const Game3DInstance* pInstance, const char* name){ //this->currentIterator = NULL; this->pInstance = pInstance; assert(this->pInstance!=NULL); this->getTransform = NULL; this->lightFallOff = 0.5f; this->pLightRange = &GameEngine::PointLightRange; this->lightColor[0] = this->lightColor[1] = this->lightColor[2] = 1; this->isSpotLight = false; //parse the name, init the corresponding light parameters int lightType = identifyLightType(name); assert(lightType!=LIGHT_NOTLIGHT);//only valid light is added here if (lightType==LightTypesConst::LightEye){ this->isSpotLight = true; this->pLightRange = &GameEngine::SpotLightRange; this->lightColor[1] = this->lightColor[2] = 0; //red light this->lightFallOff = 0.2f; this->getTransform = &Light::getLightEyeTransform; }else if (lightType==LightTypesConst::LamPost){ this->lightColor[0] = this->lightColor[1] = 0; //blue light this->getTransform = &Light::getLampPostTransform; } assert(this->getTransform!=NULL); //add the light to the lightPool lightPool.push_back(this); } D3DXVECTOR3 Light::GetLightDirection(){ D3DXMATRIX matRot; D3DXMatrixRotationZ(&matRot, pInstance->GetAngle()); D3DXVECTOR3 ret = D3DXVECTOR3(0,-1,-1); D3DXVec3TransformCoord(&ret,&ret,&matRot); return ret; } Light* Light::IterationBegin(){ //assert(currentIterator==NULL); currentIterator = lightPool.begin(); assert(currentIterator!=lightPool.end());//there must be at least one light return *currentIterator; } bool Light::IterationEnd(){ if (currentIterator == lightPool.end()){ currentIterator = lightPool.begin(); return true; }else return false; } Light* Light::IterationNextElement(){ currentIterator++; if (currentIterator==lightPool.end()){ return NULL; } Light* ret = *currentIterator; assert(ret!=NULL); return ret; } float Light::GetLightRadius(){ return GameEngine::SpotLightRadius; } };
Light.cpp
Dirección de la página
Dirección del archivo
Anterior
48/65
Siguiente
Descargar
( 2 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.