1746 lines
43 KiB
C++
1746 lines
43 KiB
C++
#include "stdafx.h"
|
|
#include "KRenderDevice.h"
|
|
#include "SGameSky.h"
|
|
#include "SEnvPrimitive.h"
|
|
#include "K3DTypes.h"
|
|
#include "KSeqModel.h"
|
|
#include "K3DCamera.h"
|
|
#include "KResourceManager.h"
|
|
|
|
#include "KRenderObjectEtc.h"
|
|
|
|
#include <dump/XException.h>
|
|
|
|
#include <mmo/ArTime.h>
|
|
#include "TerrainPrimitive.h"
|
|
|
|
//#include "SDebug_Util.h"
|
|
|
|
#include "SGameWeather.h" // [sonador] to include 'lerp' function in namespace 'env_fx'
|
|
#include "SGameLightning.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include <kfile/KFileManager.h>
|
|
//#include "SGameMilesSoundMgr.h"
|
|
|
|
const int CLOUD_MAX = 190;
|
|
const float START_TIME = 6000.f;
|
|
const float END_TIME = 4000.f;
|
|
const float DEFAULT_HEIGHT = 500.0f;
|
|
// { [sonador]
|
|
const int THUNDER_CLOUD_MAX = 3;
|
|
const float DEFAULT_HEIGHT_THUNDER_CLOUD = 510.0f;
|
|
// }
|
|
|
|
#ifdef SKYBOX_CLOUD
|
|
#else
|
|
//float fRotSpeed[] =
|
|
//{
|
|
// 0.2f,
|
|
// // 0.2f,
|
|
// // 0.3f,
|
|
// // 0.4f,
|
|
// // 0.5f,
|
|
//};
|
|
//
|
|
//bool SGameCloud::m_bProcessPause = false;
|
|
//
|
|
//float SCloudObject::s_fFactor = 0.1f;
|
|
//float SCloudObject::s_fLightningFactor = 1.0f;
|
|
//DWORD SCloudObject::s_dwDuration = 250;
|
|
//int SCloudObject::s_nFlashCount = 3;
|
|
//K3DColor SCloudObject::s_sDestColor = K3DColor( 0xffdae7fe );
|
|
//std::string SCloudObject::s_strSound = "";
|
|
//float SCloudObject::s_fSoundSpeed = 0;
|
|
//
|
|
//SCloudObject::SCloudObject()
|
|
//: nWidth ( 0 )
|
|
//, nHeight ( 0 )
|
|
//, vPosition ( 0, 0, 0 )
|
|
//, vStartPosition ( 0, 0, 0 )
|
|
//, fVisibilityCap ( 1 )
|
|
//, fVisibility ( 0 )
|
|
//, color ( 0x00000000 )
|
|
//, bActive ( false )
|
|
//, pVecCloud ( 0 )
|
|
//, dwStartTime ( 0 )
|
|
//, dwOldTime ( 0 )
|
|
//, fRotSpeed ( 0.1f )
|
|
//, eStep ( APPEAR )
|
|
//, dwThunderBegin ( 0 )
|
|
//, bLightningEnable ( false )
|
|
//{
|
|
//}
|
|
//
|
|
//void SCloudObject::SetPosition( float x, float y, float z )
|
|
//{
|
|
// if( vStartPosition.x == 0.f &&
|
|
// vStartPosition.y == 0.f &&
|
|
// vStartPosition.z == 0.f )
|
|
// vStartPosition = vPosition;
|
|
// vPosition.Set( x, y, z );
|
|
//}
|
|
//
|
|
//void SCloudObject::SetColor( const K3DColor& _color )
|
|
//{
|
|
// color.r = (unsigned char)(_color.r * 255);
|
|
// color.g = (unsigned char)(_color.g * 255);
|
|
// color.b = (unsigned char)(_color.b * 255);
|
|
//}
|
|
//
|
|
//void SCloudObject::SetColor( const KColor& _color )
|
|
//{
|
|
// color.r = _color.r;
|
|
// color.g = _color.g;
|
|
// color.b = _color.b;
|
|
//}
|
|
//
|
|
//void SCloudObject::SetVisibility( float _visibility )
|
|
//{
|
|
// fVisibility = std::min( _visibility, fVisibilityCap );
|
|
// fVisibility = std::max( 0.f, std::min( 1.0f, fVisibility ) );
|
|
// color.a = (unsigned char)( 255 * fVisibility );
|
|
//}
|
|
//
|
|
//void SCloudObject::SetVisibilityCap( float _cap )
|
|
//{
|
|
// fVisibilityCap = _cap;
|
|
//}
|
|
//
|
|
//K3DVector SCloudObject::GetVertexPosition( EVtxPos _pos_type ) const
|
|
//{
|
|
// K3DVector vResult;
|
|
//
|
|
// switch( _pos_type )
|
|
// {
|
|
// case UL:
|
|
// vResult.Set( vPosition.x - nWidth / 2.f, vPosition.y - nHeight / 2.f, vPosition.z );
|
|
// break;
|
|
// case UR:
|
|
// vResult.Set( vPosition.x + nWidth / 2.f, vPosition.y - nHeight / 2.f, vPosition.z );
|
|
// break;
|
|
// case BL:
|
|
// vResult.Set( vPosition.x - nWidth / 2.f, vPosition.y + nHeight / 2.f, vPosition.z );
|
|
// break;
|
|
// case BR:
|
|
// vResult.Set( vPosition.x + nWidth / 2.f, vPosition.y + nHeight / 2.f, vPosition.z );
|
|
// break;
|
|
// }
|
|
//
|
|
// return vResult;
|
|
//}
|
|
//
|
|
//void SCloudObject::checkStartTime( DWORD dwTime_msec_ )
|
|
//{
|
|
// if( dwStartTime == 0 )
|
|
// dwStartTime = dwTime_msec_;
|
|
//}
|
|
//
|
|
//void SCloudObject::ResetStartTime()
|
|
//{
|
|
// dwStartTime = 0;
|
|
//}
|
|
//
|
|
//void SCloudObject::resetPosition()
|
|
//{
|
|
// vPosition.x = (K3DVALUE)(-rand()%8000);
|
|
// vPosition.y = (K3DVALUE)(-rand()%8000);
|
|
//}
|
|
//
|
|
//void SCloudObject::ChangeStep( EStep step )
|
|
//{
|
|
// eStep = step;
|
|
// //dwStartTime = 0;
|
|
//}
|
|
//
|
|
//void SCloudObject::processByStep( DWORD elapsed_time , const KColor& _cloud_color )
|
|
//{
|
|
// //1)처음 나타나면, 0~1 서서히 나타난다.
|
|
// //2)모두 보이면, 이동 시작
|
|
// //3)이동이 끝나면 1~0 서서히 사라진다.
|
|
//
|
|
// switch( eStep )
|
|
// {
|
|
// case APPEAR:
|
|
// this->onAppear( elapsed_time );
|
|
// break;
|
|
// case DISAPPEAR:
|
|
// this->onDisappear( elapsed_time );
|
|
// break;
|
|
// case MOVE:
|
|
// this->onMove( elapsed_time );
|
|
// break;
|
|
// case THUNDER:
|
|
// this->onThunder( elapsed_time );
|
|
// break;
|
|
// default:
|
|
// break;
|
|
// }
|
|
//}
|
|
//
|
|
//void SCloudObject::movePosition()
|
|
//{
|
|
// vPosition.x += fRotSpeed;
|
|
// vPosition.y += fRotSpeed;
|
|
//}
|
|
//
|
|
//bool SCloudObject::IsOutOfBound() const
|
|
//{
|
|
// return ( vPosition.x > 1800.f || vPosition.y > 1800.f );
|
|
//}
|
|
//
|
|
//void SCloudObject::Update( DWORD _time, const KColor& _cloud_color )
|
|
//{
|
|
// this->checkStartTime( _time );
|
|
//
|
|
// DWORD elapsed_time = _time - dwStartTime;
|
|
//
|
|
// this->SetColor( _cloud_color );
|
|
// this->SetVisibilityCap( (float)_cloud_color.a / 255 );
|
|
// this->processByStep( elapsed_time, _cloud_color );
|
|
// this->movePosition();
|
|
//
|
|
// if( this->IsOutOfBound() && !this->IsStep( DISAPPEAR ) )
|
|
// {
|
|
// this->ChangeStep( DISAPPEAR );
|
|
// this->ResetStartTime();
|
|
// }
|
|
//}
|
|
//
|
|
//void SCloudObject::onAppear( DWORD elapsed_time )
|
|
//{
|
|
// if ( elapsed_time > START_TIME )
|
|
// {
|
|
// //종료
|
|
// this->ChangeStep( MOVE );
|
|
// this->ResetStartTime();
|
|
// }
|
|
// else
|
|
// {
|
|
// this->SetVisibility( (float)elapsed_time / START_TIME );
|
|
// }
|
|
//}
|
|
//
|
|
//void SCloudObject::onDisappear( DWORD elapsed_time )
|
|
//{
|
|
// if( elapsed_time < END_TIME )
|
|
// {
|
|
// this->SetVisibility( 1.f - ( (float)elapsed_time / END_TIME ) );
|
|
// }
|
|
// else
|
|
// {
|
|
// //this->SetActivity( (rand() % 2) == 1 ); // 랜덤하게 활동여부를 설정하는 이유는?
|
|
// this->resetPosition();
|
|
// this->ResetStartTime();
|
|
// this->ChangeStep( APPEAR );
|
|
// }
|
|
//}
|
|
//
|
|
//void SCloudObject::onMove( DWORD elapsed_time )
|
|
//{
|
|
// this->SetVisibility( fVisibilityCap );
|
|
//}
|
|
//
|
|
//void SCloudObject::onThunder( DWORD elapsed_time )
|
|
//{
|
|
// this->SetVisibility( fVisibilityCap );
|
|
//
|
|
// if( elapsed_time <= s_dwDuration + dwThunderBegin )
|
|
// {
|
|
// float ftheta = K3D_PI * (float)( elapsed_time - dwThunderBegin )
|
|
// * s_nFlashCount / (float)s_dwDuration;
|
|
// float fwave = sinf( ftheta );
|
|
// fwave = fabs( fwave );
|
|
//
|
|
// color.a = (unsigned char)( fwave * 255.0f );
|
|
// }
|
|
// else
|
|
// {
|
|
// this->ChangeStep( MOVE );
|
|
// }
|
|
//}
|
|
//
|
|
//
|
|
//SThunderCloudObject::SThunderCloudObject()
|
|
//: SCloudObject()
|
|
//{
|
|
//}
|
|
//
|
|
//SThunderCloudObject::~SThunderCloudObject()
|
|
//{
|
|
//}
|
|
//
|
|
//void SThunderCloudObject::onAppear( DWORD elapsed_time )
|
|
//{
|
|
// this->SetActivity( false );
|
|
//}
|
|
//
|
|
//void SThunderCloudObject::onDisappear( DWORD elapsed_time )
|
|
//{
|
|
// this->SetActivity( false );
|
|
//}
|
|
//
|
|
//void SThunderCloudObject::onMove( DWORD elapsed_time )
|
|
//{
|
|
// this->SetActivity( false );
|
|
//}
|
|
//
|
|
//void SThunderCloudObject::onThunder( DWORD elapsed_time )
|
|
//{
|
|
// this->SetVisibility( fVisibilityCap );
|
|
//
|
|
// if( elapsed_time <= s_dwDuration + dwThunderBegin )
|
|
// {
|
|
// float ftheta = K3D_PI * (float)( elapsed_time - dwThunderBegin )
|
|
// * s_nFlashCount / (float)s_dwDuration;
|
|
// float fwave = sinf( ftheta );
|
|
// fwave = fabs( fwave );
|
|
//
|
|
// color.a = (unsigned char)( fwave * 255.0f );
|
|
// }
|
|
// else
|
|
// {
|
|
// this->SetActivity( false );
|
|
// }
|
|
//}
|
|
#endif
|
|
|
|
// =======================================================================
|
|
// SGameCloud
|
|
// =======================================================================
|
|
#ifdef SKYBOX_CLOUD
|
|
//SGameCloud::SGameCloud( int cloud_count )
|
|
//: m_dwTime ( 0 )
|
|
//, m_nCloudCount ( cloud_count )
|
|
//, m_CloudColor ( 255, 255, 255, 255 )
|
|
//, m_bEnableThunder ( false )
|
|
//, m_pThunderCloud ( 0 )
|
|
//, m_pLightning ( 0 )
|
|
//, m_pSoundMgr ( 0 )
|
|
//, m_pDevice ( 0 )
|
|
//{
|
|
//}
|
|
//
|
|
//SGameCloud::~SGameCloud()
|
|
//{
|
|
// SAFE_DELETE( m_pMat );
|
|
// SAFE_DELETE_ARRAY( m_pCloud );
|
|
//
|
|
// if( m_pVB )
|
|
// m_pDevice->DelReloadVertexList( m_pVB );
|
|
//}
|
|
//
|
|
//void SGameCloud::Init( K3DRenderDevice *pDevice, K3DIndexBuffer * pIndexBuf )
|
|
//{
|
|
// m_pDevice = pDevice;
|
|
//
|
|
// DWORD dwFormat = 0;
|
|
// m_pVB = pDevice->CreateVertexBufferUsePoolDefault( sizeof(K3DVERTEX_CLOUD), dwFormat, 4*m_nCloudCount, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY ); //기본 사각형
|
|
// if( m_pVB && m_pVB->IsValidVtx() )
|
|
// {
|
|
// // m_spVB = pDevice->CreateVertexBufferBlend( sizeof(K3DBLENDEDBUMPVERTEX), dwFormat, 4*m_nCloudCount ); //기본 사각형
|
|
//
|
|
// this->initVB();
|
|
//
|
|
// m_spIB = NULL; // Index Buf
|
|
// m_spTexture = NULL;
|
|
// m_spAlphaTexture = NULL;
|
|
//
|
|
// m_pMat = new K3DMaterial;
|
|
// m_pMat->SetAmbient( K3DColor( 1.f, 1.f, 1.f, 1.f ) );
|
|
// m_pMat->SetDiffuse( K3DColor( 1.f, 1.f, 1.f, 1.f ) );
|
|
// m_pMat->SetSpecular( K3DColor( 0.f, 0.f, 0.f, 1.f ) );
|
|
// m_pMat->SetSpecularPower( 1.0f );
|
|
//
|
|
// m_pParentMat = NULL; // SkyBox 위치
|
|
// K3DMatrixIdentity( m_LocalMat ); // 구름 위치
|
|
// K3DMatrixIdentity( m_WorldMat );
|
|
//
|
|
// m_pPrimitive = new SCloudPrimitive; // Render Object
|
|
// m_pPrimitive->SetTransparent( true );
|
|
// m_pPrimitive->SetTransform( &m_LocalMat, &m_WorldMat );
|
|
// m_pPrimitive->SetVertexBuffer( m_pVB );
|
|
// m_pPrimitive->SetMaterial( m_pMat );
|
|
//
|
|
// this->initCloudObjects();
|
|
// }
|
|
//}
|
|
//
|
|
//void SGameCloud::Process( DWORD dwTime )
|
|
//{
|
|
// if( IsProcessPause() ) return;
|
|
//
|
|
// if( m_pVB == NULL || !m_pVB->IsValidVtx() ) return;
|
|
//
|
|
// m_dwTime = dwTime;
|
|
//
|
|
// // [sonador] Lock / Unlock 을 짧은 시간에 수행하기 위해 update 를 분리하였음.
|
|
// for( int it = 0; it < m_nCloudCount; ++it )
|
|
// {
|
|
// if( m_pCloud[ it ].IsActive() )
|
|
// this->processCloudObject( it );
|
|
// }
|
|
//
|
|
// K3DVERTEX_CLOUD* vtx = NULL;
|
|
// int nVtxSize;
|
|
// int nPrimCnt = 0;
|
|
// //D3DLOCK_NOOVERWRITE 옵션이 일부 그래픽 카드에서 문제 발생되어 수정됨.
|
|
//#if defined( _DEBUG )
|
|
// m_pVB->Lock( (void**)&vtx, nVtxSize, D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD );
|
|
//#else
|
|
// m_pVB->Lock( (void**)&vtx, nVtxSize, D3DLOCK_DISCARD );
|
|
//#endif
|
|
// assert(vtx && "m_pVB->Lock( (void**)&vtx, nVtxSize );");
|
|
//
|
|
// if( vtx == NULL ) return;
|
|
//
|
|
// for(int it = 0; it < m_nCloudCount; ++it)
|
|
// {
|
|
// if( m_pCloud[ it ].IsActive() )
|
|
// {
|
|
// this->updateVB( &vtx[ nPrimCnt * 4 ], m_pCloud[ it ] );
|
|
// }
|
|
// else
|
|
// {
|
|
// vtx[ nPrimCnt * 4 + 0 ].color.a = 0;
|
|
// vtx[ nPrimCnt * 4 + 1 ].color.a = 0;
|
|
// vtx[ nPrimCnt * 4 + 2 ].color.a = 0;
|
|
// vtx[ nPrimCnt * 4 + 3 ].color.a = 0;
|
|
// }
|
|
// ++nPrimCnt;
|
|
// }
|
|
//
|
|
// m_pVB->Unlock();
|
|
// m_pPrimitive->SetVertexCnt( nPrimCnt * 4 );
|
|
// /*K3DMatrix mat;
|
|
// K3DMatrixIdentity( mat );
|
|
// //K3DMatrixRotationAxis( &mat, m_pVecCloud, (10.f*K3D_PI/180.f) );
|
|
// K3DMatrixIdentity( m_LocalMat );
|
|
// K3DMatrixSetPosVector( m_LocalMat, m_Pos );
|
|
// K3DMatrixMultiply( &m_LocalMat, &mat, &m_LocalMat );
|
|
//
|
|
// if( m_pParentMat )
|
|
// K3DMatrixMultiply( &m_LocalMat, &m_LocalMat, m_pParentMat );*/
|
|
//}
|
|
//
|
|
//void SGameCloud::Render( KViewportObject *viewport )
|
|
//{
|
|
// if( m_pPrimitive && m_pPrimitive->GetVertexCnt() > 0 )
|
|
// {
|
|
// viewport->Register( m_pPrimitive, KRenderObject::RENDEREFX_CLOUD );
|
|
// }
|
|
//}
|
|
//
|
|
//void SGameCloud::SetHeight( int i, float fz )
|
|
//{
|
|
// if( i >=0 && i < m_nCloudCount )
|
|
// {
|
|
// m_pCloud[i].vPosition.z = fz;
|
|
// }
|
|
// else
|
|
// {
|
|
// assert( !"SGameCloud : refered wrong index" );
|
|
// }
|
|
//
|
|
// //if( m_pThunderCloud )
|
|
// // m_pThunderCloud->SetHeight( i, fz );
|
|
//}
|
|
//
|
|
//void SGameCloud::SetPosition( int i, float fx, float fy, float fz )
|
|
//{
|
|
// if( i >=0 && i < m_nCloudCount )
|
|
// {
|
|
// m_pCloud[i].SetPosition( fx, fy, fz );
|
|
// }
|
|
// else
|
|
// {
|
|
// assert( !"SGameCloud : refered wrong index" );
|
|
// }
|
|
//
|
|
// //if( m_pThunderCloud )
|
|
// // m_pThunderCloud->SetPosition( i, fz, fy, fz );
|
|
//}
|
|
//
|
|
//void SGameCloud::SetMaxVisibility( int i, float fVis )
|
|
//{
|
|
// if( i >=0 && i < m_nCloudCount )
|
|
// {
|
|
// m_pCloud[i].SetVisibilityCap( fVis );
|
|
// }
|
|
// else
|
|
// {
|
|
// assert( !"SGameCloud : refered wrong index" );
|
|
// }
|
|
//
|
|
// //if( m_pThunderCloud )
|
|
// // m_pThunderCloud->SetMaxVisibility( i, fVis );
|
|
//}
|
|
//
|
|
//void SGameCloud::SetVisibility( int i, float fVis )
|
|
//{
|
|
// if( i >=0 && i < m_nCloudCount )
|
|
// {
|
|
// m_pCloud[i].SetVisibility( fVis );
|
|
// }
|
|
// else
|
|
// {
|
|
// assert( !"SGameCloud : refered wrong index" );
|
|
// }
|
|
//
|
|
// //if( m_pThunderCloud )
|
|
// // m_pThunderCloud->SetVisibility( i, fVis );
|
|
//}
|
|
//
|
|
//void SGameCloud::SetCloudColor( int i, K3DColor & color )
|
|
//{
|
|
// if( i >=0 && i < m_nCloudCount )
|
|
// {
|
|
// m_pCloud[ i ].SetColor( color );
|
|
// }
|
|
// else
|
|
// {
|
|
// assert(0);
|
|
// }
|
|
//
|
|
// //if( m_pThunderCloud )
|
|
// // m_pThunderCloud->SetCloudColor( i, color );
|
|
//}
|
|
//
|
|
//void SGameCloud::SetCloudColor( KColor & color )
|
|
//{
|
|
// m_CloudColor = color;
|
|
//
|
|
// if( m_pThunderCloud )
|
|
// m_pThunderCloud->SetCloudColor( color );
|
|
//}
|
|
//
|
|
//void SGameCloud::SetEnableThunderFx( bool bEnable )
|
|
//{
|
|
// m_bEnableThunder = bEnable;
|
|
//}
|
|
//
|
|
//void SGameCloud::SetThunderCloud( SGameCloud* pThunderCloud )
|
|
//{
|
|
// m_pThunderCloud = pThunderCloud;
|
|
//}
|
|
//
|
|
//void SGameCloud::SetLightning( env_fx::SGameLightning* pLightning )
|
|
//{
|
|
// m_pLightning = pLightning;
|
|
//}
|
|
//
|
|
//void SGameCloud::SetTransform( K3DMatrix* pParentMatrix )
|
|
//{
|
|
// SetParentMat( pParentMatrix );
|
|
// m_pPrimitive->SetTransform( pParentMatrix, pParentMatrix );
|
|
//
|
|
// if( m_pThunderCloud )
|
|
// m_pThunderCloud->SetTransform( pParentMatrix );
|
|
//
|
|
// if( m_pLightning )
|
|
// m_pLightning->SetParentMatrix( pParentMatrix );
|
|
//}
|
|
//
|
|
//SCloudObject* SGameCloud::GetFirstDeactiveCloud()
|
|
//{
|
|
// SCloudObject* pCloud = std::find_if(
|
|
// &m_pCloud[ 0 ], &m_pCloud[ m_nCloudCount ], SFindFirstDeactiveCloud() );
|
|
//
|
|
// if( pCloud != &m_pCloud[ m_nCloudCount ] )
|
|
// return pCloud;
|
|
//
|
|
// return 0;
|
|
//}
|
|
//
|
|
//void SGameCloud::SetSoundManager( SGameMilesSoundMgr* pSoundMgr )
|
|
//{
|
|
// m_pSoundMgr = pSoundMgr;
|
|
//}
|
|
//
|
|
//void SGameCloud::initVB()
|
|
//{
|
|
// K3DVERTEX_CLOUD* vtx = NULL;
|
|
// int nVtxSize;
|
|
// m_pVB->Lock( (void**)&vtx, nVtxSize, D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD );
|
|
// assert(vtx && "m_pVB->Lock( (void**)&vtx, nVtxSize );");
|
|
//
|
|
// if( vtx == NULL ) return;
|
|
//
|
|
// for( int n=0; 4 * m_nCloudCount > n; )
|
|
// {
|
|
// int nRand = rand() % 150 + 255;
|
|
// vtx[n].position = K3DVector( (float)-m_nWidth/2.f, (float)-m_nHeight/2.f, 0 );
|
|
// vtx[n].color = m_CloudColor;
|
|
// vtx[n].color.a = nRand;
|
|
// vtx[n].normal = K3DVector( 0.f, 0.f, -1.f);
|
|
// vtx[n].texcoord0.x = 0.f;
|
|
// vtx[n].texcoord0.y = 0.f;
|
|
// //vtx[n].texcoord1.x = 0.f;
|
|
// //vtx[n].texcoord1.y = 0.f;
|
|
// n++;
|
|
// vtx[n].position = K3DVector( m_nWidth / 2.f, (float)-m_nHeight/2.f, 0 );
|
|
// vtx[n].color = m_CloudColor;
|
|
// vtx[n].color.a = nRand;
|
|
// vtx[n].normal = K3DVector( 0.f, 0.f, -1.f);
|
|
// vtx[n].texcoord0.x = 1.f;
|
|
// vtx[n].texcoord0.y = 0.f;
|
|
// //vtx[n].texcoord1.x = 1.f;
|
|
// //vtx[n].texcoord1.y = 0.f;
|
|
// n++;
|
|
// vtx[n].position = K3DVector( (float)-m_nWidth/2.f, m_nHeight / 2.f, 0 );
|
|
// vtx[n].color = m_CloudColor;
|
|
// vtx[n].color.a = nRand;
|
|
// vtx[n].normal = K3DVector( 0.f, 0.f, -1.f);
|
|
// vtx[n].texcoord0.x = 0.0f;
|
|
// vtx[n].texcoord0.y = 1.f;
|
|
// //vtx[n].texcoord1.x = 0.0f;
|
|
// //vtx[n].texcoord1.y = 1.f;
|
|
// n++;
|
|
// vtx[n].position = K3DVector( m_nWidth / 2.f, m_nHeight / 2.f, 0 );
|
|
// vtx[n].color = m_CloudColor;
|
|
// vtx[n].color.a = nRand;
|
|
// vtx[n].normal = K3DVector( 0.f, 0.f, -1.f);
|
|
// vtx[n].texcoord0.x = 1.0f;
|
|
// vtx[n].texcoord0.y = 1.f;
|
|
// //vtx[n].texcoord1.x = 1.0f;
|
|
// //vtx[n].texcoord1.y = 1.f;
|
|
// n++;
|
|
// }
|
|
// m_pVB->Unlock();
|
|
// m_pVB->Backup();
|
|
//}
|
|
//
|
|
//void SGameCloud::updateVB( K3DVERTEX_CLOUD* vtx, const SCloudObject& cloud )
|
|
//{
|
|
// vtx[ 0 ].position = cloud.GetVertexPosition( SCloudObject::UL );
|
|
// vtx[ 1 ].position = cloud.GetVertexPosition( SCloudObject::UR );
|
|
// vtx[ 2 ].position = cloud.GetVertexPosition( SCloudObject::BL );
|
|
// vtx[ 3 ].position = cloud.GetVertexPosition( SCloudObject::BR );
|
|
//
|
|
// for( short p = 0; p < 4; p++)
|
|
// {
|
|
// vtx[ p ].color = cloud.color;
|
|
// vtx[ p ].normal = K3DVector( 0.f, 0.f, -1.f);
|
|
// }
|
|
//
|
|
// vtx[ 0 ].texcoord0.Set( 0, 0 );
|
|
// vtx[ 1 ].texcoord0.Set( 1, 0 );
|
|
// vtx[ 2 ].texcoord0.Set( 0, 1 );
|
|
// vtx[ 3 ].texcoord0.Set( 1, 1 );
|
|
// //vtx[ 0 ].texcoord1.Set( 0, 0 );
|
|
// //vtx[ 1 ].texcoord1.Set( 1, 0 );
|
|
// //vtx[ 2 ].texcoord1.Set( 0, 1 );
|
|
// //vtx[ 3 ].texcoord1.Set( 1, 1 );
|
|
//}
|
|
//
|
|
//void SGameCloud::initCloudObjects()
|
|
//{
|
|
// m_pCloud = new SCloudObject[ m_nCloudCount ];
|
|
//
|
|
// for(int i = 0; i < m_nCloudCount; ++i)
|
|
// {
|
|
// m_pCloud[i].nWidth = 1000+rand()/16000;//(float)(rand()/10000)+1400;
|
|
// m_pCloud[i].nHeight = 1000+rand()/10000;//(float)(rand()/10000)+1400;
|
|
// m_pCloud[i].dwStartTime = 0;
|
|
// m_pCloud[i].dwOldTime = 0;
|
|
// m_pCloud[i].fRotSpeed = fRotSpeed[0/*rand()%5*/];
|
|
// m_pCloud[i].fVisibility = 0.8f;
|
|
// m_pCloud[i].eStep = SCloudObject::MOVE;
|
|
// }
|
|
//}
|
|
//
|
|
//void SGameCloud::processCloudObject( int nIndex )
|
|
//{
|
|
// assert( nIndex >= 0 && nIndex < m_nCloudCount && "wrong index" );
|
|
// m_pCloud[ nIndex ].Update( m_dwTime, m_CloudColor );
|
|
//
|
|
// if( m_bEnableThunder && m_pThunderCloud &&
|
|
// m_pCloud[ nIndex ].IsStep( SCloudObject::MOVE ) &&
|
|
// (float)( rand() % 100000 ) * 0.001f <= SCloudObject::s_fFactor )
|
|
// {
|
|
// SCloudObject* pCloud = m_pThunderCloud->GetFirstDeactiveCloud();
|
|
// if( pCloud )
|
|
// {
|
|
// pCloud->SetActivity( true );
|
|
// pCloud->ResetStartTime();
|
|
// pCloud->vPosition = m_pCloud[ nIndex ].vPosition;
|
|
// pCloud->vPosition.z = DEFAULT_HEIGHT_THUNDER_CLOUD;
|
|
// pCloud->ChangeStep( SCloudObject::THUNDER );
|
|
// pCloud->nWidth = m_pCloud[ nIndex ].nWidth;
|
|
// pCloud->nHeight = m_pCloud[ nIndex ].nHeight;
|
|
// }
|
|
//
|
|
// // make lightning effect
|
|
// if( m_pLightning )
|
|
// {
|
|
// float fRand = env_fx::util::GetRandomNumberInRange( 0.0f, 100.0f );
|
|
// if( fRand <= SCloudObject::s_fLightningFactor )
|
|
// {
|
|
// //bLightningEnable = true;
|
|
// m_pLightning->Emit( m_pCloud[ nIndex ].vPosition );
|
|
//
|
|
// if( SCloudObject::s_strSound.size() > 0 )
|
|
// _addSoundEvent( m_pCloud[ nIndex ].vPosition );
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
//
|
|
//void SGameCloud::_addSoundEvent( const K3DVector& addedPosition )
|
|
//{
|
|
// SSoundEvent* se = new SSoundEvent();
|
|
// se->activeTime = m_dwTime
|
|
// + (DWORD)( SCloudObject::s_fSoundSpeed * addedPosition.Magnitude() );
|
|
// se->activePos = addedPosition;
|
|
//
|
|
// m_ctSoundEvents.push( se );
|
|
//}
|
|
//
|
|
//void SGameCloud::_procSoundEvent()
|
|
//{
|
|
// while( !m_ctSoundEvents.empty() )
|
|
// {
|
|
// SSoundEvent* se = 0;
|
|
// se = m_ctSoundEvents.front();
|
|
// if( se->activeTime >= m_dwTime )
|
|
// {
|
|
// //if( m_pSoundMgr )
|
|
// //{
|
|
// // m_pSoundMgr->PlaySound3D(
|
|
// // SCloudObject::s_strSound.c_str(),
|
|
// // se->activePos.x, se->activePos.y, se->activePos.z,
|
|
// // 100, false, false, false );
|
|
// //
|
|
// //}
|
|
// SAFE_DELETE( se );
|
|
// m_ctSoundEvents.pop();
|
|
// continue;
|
|
// }
|
|
// break;
|
|
// }
|
|
//}
|
|
|
|
//SGameThunderCloud::SGameThunderCloud( int cloud_count )
|
|
//: SGameCloud ( cloud_count )
|
|
//{
|
|
//}
|
|
//
|
|
//SGameThunderCloud::~SGameThunderCloud()
|
|
//{
|
|
//}
|
|
//
|
|
//void SGameThunderCloud::initCloudObjects()
|
|
//{
|
|
// m_pCloud = new SThunderCloudObject[ m_nCloudCount ];
|
|
//
|
|
// for(int i = 0; i < m_nCloudCount; ++i)
|
|
// {
|
|
// m_pCloud[i].nWidth = 1000+rand()/16000;//(float)(rand()/10000)+1400;
|
|
// m_pCloud[i].nHeight = 1000+rand()/10000;//(float)(rand()/10000)+1400;
|
|
// m_pCloud[i].dwStartTime = 0;
|
|
// m_pCloud[i].dwOldTime = 0;
|
|
// m_pCloud[i].fRotSpeed = fRotSpeed[0/*rand()%5*/];
|
|
// m_pCloud[i].fVisibility = 0.8f;
|
|
// m_pCloud[i].eStep = SCloudObject::MOVE;
|
|
// }
|
|
//}
|
|
#endif
|
|
|
|
//============================================================================
|
|
//============================================================================
|
|
//해와 달
|
|
SGameSunMoon::SGameSunMoon()
|
|
{
|
|
m_pSun = new KSeqModel;
|
|
m_pMoon = new KSeqModel;
|
|
m_pAurora[0]= new KSeqModel;
|
|
m_pAurora[1]= new KSeqModel;
|
|
m_pAurora[2]= new KSeqModel;
|
|
|
|
// m_pSun->AddAnimation( "default", "wfx01.nx3" );
|
|
// m_pMoon->AddAnimation( "default", "wfx01.nx" );
|
|
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
m_pSun->AddAnimation( "default", "sky_zone001_sun.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pMoon->AddAnimation( "default", "sky_zone001_moon.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pAurora[0]->AddAnimation( "default", "rcfx_orora01.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pAurora[1]->AddAnimation( "default", "rcfx_orora02.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pAurora[2]->AddAnimation( "default", "rcfx_orora03.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
|
|
m_pSun->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP );
|
|
m_pMoon->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP );
|
|
m_pAurora[0]->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP );
|
|
m_pAurora[1]->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP );
|
|
m_pAurora[2]->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP );
|
|
|
|
m_fRadiusX = 4200.f;
|
|
m_fRadiusZ = 500.f;
|
|
m_fScale = 1.0f;
|
|
|
|
m_vSunPos = K3DVector( 0.f, 0.f, 0.f );
|
|
m_vMoonPos = K3DVector( 0.f, 0.f, 0.f );
|
|
|
|
m_nHour = 0;
|
|
m_nMin = 0;
|
|
m_nSec = 0;
|
|
|
|
m_bVisibleSun = false;
|
|
m_bVisibleMoon = false;
|
|
|
|
m_fVisibilitySun = -1.f;
|
|
m_fVisibilityMoon = -1.f;
|
|
for ( int i = 0; i < MAX_AURORA; ++i )
|
|
{
|
|
m_bVisibleAurora[i] =false;
|
|
m_fVisibilityAurora[i] = -1.f;
|
|
m_matAurora[i] = m_pAurora[i]->GetTransform();
|
|
m_fScaleAurora[i] = 1.0f;
|
|
m_fHeightAurora[i] = 0.0f;
|
|
m_fAngleAurora[i] = 0.0f;
|
|
}
|
|
|
|
|
|
m_dwOldTime = 0;
|
|
m_dwVisibleTime = 2000;
|
|
}
|
|
|
|
SGameSunMoon::~SGameSunMoon()
|
|
{
|
|
SAFE_DELETE( m_pSun );
|
|
SAFE_DELETE( m_pMoon );
|
|
|
|
for ( int i = 0; i < MAX_AURORA; ++i )
|
|
SAFE_DELETE( m_pAurora[ i ] );
|
|
}
|
|
|
|
void SGameSunMoon::SetPosition( const K3DVector* vPos )
|
|
{
|
|
m_vPlayerPos = *vPos;
|
|
|
|
for ( int i = 0; i < MAX_AURORA; ++i )
|
|
m_pAurora[i]->SetPosition( m_vPlayerPos.x, m_vPlayerPos.y , m_vPlayerPos.z + m_fHeightAurora[i] );
|
|
}
|
|
|
|
void SGameSunMoon::SetUniformScale( float scale )
|
|
{
|
|
m_fScale = scale;
|
|
K3DMatrix mat = m_pSun->GetTransform();
|
|
mat._11 = mat._22 = mat._33 = scale;
|
|
m_pSun->SetTransform( mat );
|
|
mat = m_pMoon->GetTransform();
|
|
mat._11 = mat._22 = mat._33 = scale;
|
|
m_pMoon->SetTransform( mat );
|
|
|
|
for ( int i = 0; i < MAX_AURORA; ++i )
|
|
{
|
|
m_matAurora[i]._11 = m_matAurora[i]._22 = m_matAurora[i]._33 = scale;
|
|
RecalcAuroraMatrix( i );
|
|
}
|
|
}
|
|
|
|
|
|
void SGameSunMoon::RecalcAuroraMatrix( int nAurora )
|
|
{
|
|
K3DMatrix matScale, matRotate, matResult;
|
|
|
|
K3DMatrixRotationZ( matRotate, m_fAngleAurora[nAurora] * D3DX_PI / 180.0f );
|
|
K3DMatrixScaling( matScale, m_fScaleAurora[nAurora], m_fScaleAurora[nAurora], m_fScaleAurora[nAurora] );
|
|
|
|
K3DMatrixMultiply( matResult, m_matAurora[ nAurora ], matRotate );
|
|
K3DMatrixMultiply( matResult, matResult, matScale );
|
|
|
|
|
|
|
|
m_pAurora[ nAurora ]->SetTransform( matResult );
|
|
}
|
|
|
|
|
|
void SGameSunMoon::SetTime( int nHour, int nMin, int nSec )
|
|
{
|
|
m_nHour = nHour;
|
|
m_nMin = nMin;
|
|
m_nSec = nSec;
|
|
}
|
|
|
|
void SGameSunMoon::SetVisibilitySun( bool bVisible, float fVisibility, DWORD dwOldTime )
|
|
{
|
|
if( m_fVisibilitySun != fVisibility )
|
|
{
|
|
m_fVisibilitySun = fVisibility;
|
|
m_bVisibleSun = bVisible;
|
|
m_dwOldTime = dwOldTime;
|
|
}
|
|
}
|
|
|
|
void SGameSunMoon::SetVisibilityMoon( bool bVisible, float fVisibility, DWORD dwOldTime )
|
|
{
|
|
if( m_fVisibilityMoon != fVisibility )
|
|
{
|
|
m_fVisibilityMoon = fVisibility;
|
|
m_bVisibleMoon = bVisible;
|
|
m_dwOldTime = dwOldTime;
|
|
}
|
|
}
|
|
|
|
#ifdef _DEV_AURORA
|
|
//#include "../../XModule/XConsole.h"
|
|
|
|
void myOutputDebugString(LPCTSTR pszStr, ...)
|
|
{
|
|
|
|
TCHAR szMsg[256];
|
|
va_list args;
|
|
va_start(args, pszStr);
|
|
_vstprintf_s(szMsg, 256, pszStr, args);
|
|
OutputDebugString(szMsg);
|
|
|
|
}
|
|
|
|
void SGameSunMoon::SetVisibilityAurora( bool bVisible ) // * bintitle
|
|
{
|
|
for ( int i = 0; i < MAX_AURORA; ++i )
|
|
{
|
|
// m_bVisibleAurora[ i ] = bVisible;
|
|
m_fVisibilityAurora[ i ] = 0.0f;
|
|
}
|
|
}
|
|
|
|
|
|
// Aurora 를 무작위로 선정하여 ON. * bintitle
|
|
// return : 선정된 Aurora Index.
|
|
int SGameSunMoon::RandomizeOnAurora( float fVisibility, float fAngle, float fScale, float fHeight, DWORD dwOldTime )
|
|
{
|
|
int auroraIndex = 0; //rand() % MAX_AURORA;
|
|
|
|
// 나머지 오로라는 OFF.
|
|
for( int i=0; i<MAX_AURORA; i++ )
|
|
{
|
|
if( i == auroraIndex )
|
|
continue;
|
|
m_bVisibleAurora[ i ] = false;
|
|
m_fVisibilityAurora[ i ] = 0.0f;
|
|
}
|
|
|
|
// 해당 오로라 ON.
|
|
m_fVisibilityAurora[ auroraIndex ] = fVisibility;
|
|
m_bVisibleAurora[ auroraIndex] = true;
|
|
m_dwOldTime = dwOldTime;
|
|
|
|
SetAngleAurora( auroraIndex, fAngle );
|
|
SetScaleAurora( auroraIndex, fScale );
|
|
SetHeightAurora( auroraIndex, fHeight );
|
|
|
|
// _cprint( _T("Index:%2d, visibe:%4.1f, angle:%4.1f, scale:%4.1f, height:%4.1f \n"), index, fVisibility, fAngle, fScale, fHeight );
|
|
myOutputDebugString( _T("Index:%2d, visibe:%4.1f, angle:%4.1f, scale:%4.1f, height:%4.1f \n"), auroraIndex, fVisibility, fAngle, fScale, fHeight );
|
|
|
|
return auroraIndex;
|
|
}
|
|
#endif
|
|
|
|
void SGameSunMoon::SetVisibilityAurora( int nAurora, bool bVisible, float fVisibility, DWORD dwOldTime )
|
|
{
|
|
if( m_fVisibilityAurora[nAurora] != fVisibility )
|
|
{
|
|
m_fVisibilityAurora[nAurora] = fVisibility;
|
|
m_bVisibleAurora[nAurora] = bVisible;
|
|
m_dwOldTime = dwOldTime;
|
|
}
|
|
}
|
|
|
|
void SGameSunMoon::SetScaleAurora( int nAurora, float fScale )
|
|
{
|
|
m_fScaleAurora[ nAurora ] = fScale;
|
|
|
|
RecalcAuroraMatrix( nAurora );
|
|
}
|
|
|
|
void SGameSunMoon::SetHeightAurora( int nAurora, float fHeight )
|
|
{
|
|
m_fHeightAurora[ nAurora ] = fHeight;
|
|
|
|
RecalcAuroraMatrix( nAurora );
|
|
}
|
|
|
|
|
|
void SGameSunMoon::SetAngleAurora( int nAurora, float fAngle )
|
|
{
|
|
m_fAngleAurora[ nAurora ] = fAngle;
|
|
|
|
RecalcAuroraMatrix( nAurora );
|
|
}
|
|
|
|
void SGameSunMoon::Process( DWORD dwTime )
|
|
{
|
|
static float Time = 86400.f; //24시간 * 60 * 60
|
|
|
|
float fRadiusX = m_fRadiusX * m_fScale;
|
|
float fRadiusZ = m_fRadiusZ * m_fScale;
|
|
|
|
//초단위로 움직이자
|
|
float fTime = (float)(m_nHour * 60*60) + (m_nMin * 60) + m_nSec;
|
|
float fRot = fTime * ((D3DX_PI * 2.0f) / Time);
|
|
float fRotationX = sinf(fRot) * fRadiusX;
|
|
float fRotationY = -cosf(fRot) * fRadiusX;
|
|
|
|
m_vSunPos = K3DVector( m_vPlayerPos.x + fRotationX,
|
|
m_vPlayerPos.y + fRotationY,
|
|
m_vPlayerPos.z + ( fRotationY + fRadiusZ ) );
|
|
|
|
m_pSun->SetPosition( m_vSunPos.x, m_vSunPos.y, m_vSunPos.z );
|
|
|
|
m_vMoonPos = K3DVector( m_vPlayerPos.x + (-fRotationX),
|
|
m_vPlayerPos.y + (-fRotationY),
|
|
m_vPlayerPos.z + (-fRotationY) + fRadiusZ );
|
|
|
|
m_pMoon->SetPosition( m_vMoonPos.x, m_vMoonPos.y, m_vMoonPos.z );
|
|
|
|
if( m_bVisibleSun )
|
|
{
|
|
if( (dwTime - m_dwOldTime) < m_dwVisibleTime )
|
|
{
|
|
float fLerp = ((float)(dwTime - m_dwOldTime) / m_dwVisibleTime );
|
|
float fVisible = 0.f;
|
|
|
|
if( m_fVisibilitySun > 0.f ) fVisible = fLerp;
|
|
else fVisible = 1.f - fLerp;
|
|
|
|
m_pSun->SetVisibility( fVisible );
|
|
}
|
|
else
|
|
{
|
|
m_pSun->SetVisibility( m_fVisibilitySun );
|
|
m_bVisibleSun = false;
|
|
}
|
|
}
|
|
|
|
if( m_bVisibleMoon )
|
|
{
|
|
if( (dwTime - m_dwOldTime) < m_dwVisibleTime )
|
|
{
|
|
float fLerp = ((float)(dwTime - m_dwOldTime) / m_dwVisibleTime );
|
|
float fVisible = 0.f;
|
|
|
|
if( m_fVisibilityMoon > 0.f ) fVisible = fLerp;
|
|
else fVisible = 1.f - fLerp;
|
|
|
|
m_pMoon->SetVisibility( fVisible );
|
|
}
|
|
else
|
|
{
|
|
m_pMoon->SetVisibility( m_fVisibilityMoon );
|
|
m_bVisibleMoon = false;
|
|
}
|
|
}
|
|
|
|
// 2010.03.10 *bintitle
|
|
for ( int i = 0; i < MAX_AURORA; ++i )
|
|
{
|
|
if( m_bVisibleAurora[i] )
|
|
m_pAurora[i]->SetVisibility( m_fVisibilityAurora[i] );
|
|
}
|
|
/* 삭제. 2010.03.10 *bintitle
|
|
for ( int i = 0; i < MAX_AURORA; ++i )
|
|
{
|
|
if( m_bVisibleAurora[i] )
|
|
{
|
|
|
|
if( (dwTime - m_dwOldTime) < m_dwVisibleTime )
|
|
{
|
|
float fLerp = ((float)(dwTime - m_dwOldTime) / m_dwVisibleTime );
|
|
float fVisible = 0.f;
|
|
|
|
if( m_fVisibilityAurora[i] > 0.f ) fVisible = fLerp;
|
|
else fVisible = 1.f - fLerp;
|
|
|
|
m_pAurora[i]->SetVisibility( fVisible );
|
|
}
|
|
else
|
|
{
|
|
m_pAurora[i]->SetVisibility( m_fVisibilityAurora[i] );
|
|
m_bVisibleAurora[i] = false;
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
m_pSun->Process( dwTime );
|
|
m_pMoon->Process( dwTime );
|
|
for ( int i = 0; i < MAX_AURORA; ++i )
|
|
m_pAurora[i]->Process( dwTime );
|
|
}
|
|
|
|
void SGameSunMoon::Render( KViewportObject *viewport )
|
|
{
|
|
m_pSun->Render( viewport );
|
|
m_pMoon->Render( viewport );
|
|
for (int i = 0; i < MAX_AURORA; ++i )
|
|
{
|
|
if ( m_fVisibilityAurora[i] > 0 )
|
|
{
|
|
m_pAurora[i]->Render( viewport, KRenderObject::RENDEREFX_AURORA);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
//============================================================================
|
|
//============================================================================
|
|
|
|
SGameSky::SGameSky()
|
|
: m_pCloud ( 0 )
|
|
, m_pThunderCloud ( 0 )
|
|
, m_pLightning ( 0 )
|
|
, m_pSkyLight ( 0 )
|
|
, m_pCamera ( 0 )
|
|
, m_pSkyBox ( 0 )
|
|
, m_spIB ( 0 )
|
|
, m_dwTime ( 0 )
|
|
, m_dwStartTime ( 0 )
|
|
, m_cPos ( 0.f, 0.f, 0.f )
|
|
, m_dPos ( 0.f, 0.f, 0.f )
|
|
, m_pSunMoon ( 0 )
|
|
, m_bCloudRender ( true )
|
|
, m_bProcessThunder ( true )
|
|
, m_bProcessLightning ( true )
|
|
, m_bThunderEnabled ( false )
|
|
, m_pDevice ( 0 )
|
|
#ifdef DISTANCE_VIEW
|
|
, m_pSkyboxAttr ( NULL ) // skybox attribute
|
|
, m_pDistanceViewAttr ( NULL )
|
|
, m_pDistanceViewModel ( NULL ) // distance view model
|
|
#endif
|
|
{
|
|
K3DMatrixIdentity( m_Mat );
|
|
}
|
|
|
|
SGameSky::~SGameSky()
|
|
{
|
|
#ifdef DISTANCE_VIEW
|
|
SAFE_DELETE( m_pDistanceViewModel );
|
|
SAFE_DELETE( m_pDistanceViewAttr );
|
|
SAFE_DELETE( m_pSkyboxAttr );
|
|
#endif
|
|
|
|
SAFE_DELETE( m_pSkyBox );
|
|
|
|
SAFE_DELETE( m_pCloud );
|
|
SAFE_DELETE( m_pThunderCloud );
|
|
SAFE_DELETE( m_pLightning );
|
|
|
|
SAFE_DELETE( m_pSunMoon );
|
|
}
|
|
|
|
bool SGameSky::Init( K3DRenderDevice *pDevice )
|
|
{
|
|
//for( int i(0); RAIN_MAX>i; i++ )
|
|
//{
|
|
// m_pRain[i] = new KSeqModel;
|
|
// m_pRain[i]->Initialize();
|
|
// m_pRain[i]->AddAnimation( "default01", "sky_zone003_rain.nx3" );
|
|
// m_pRain[i]->PlayAnimation( GetSafeTickCount(), "default01", KSeqModel::SEQTYPE_LOOP );
|
|
// m_pRain[i]->SetParentTransform( &m_Mat );
|
|
//}
|
|
m_pDevice = pDevice;
|
|
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
KSeqModel * pSeqModel = new KSeqModel;
|
|
pSeqModel->Initialize();
|
|
pSeqModel->AddAnimation( "default01", "sky_zone001.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack ); //일반 필드
|
|
pSeqModel->AddAnimation( "default02", "sky_zone002.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack ); //하늘 도시
|
|
pSeqModel->AddAnimation( "default03", "sky_zone003.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack ); //아수라 하늘
|
|
|
|
|
|
pSeqModel->PlayAnimation( GetSafeTickCount(), "default02", KSeqModel::SEQTYPE_LOOP );
|
|
|
|
m_pSkyBox = pSeqModel;
|
|
|
|
_CID( REQ_LIGHT );
|
|
KMsgREQ_LIGHT light_msg;
|
|
m_pSkyBox->Perform( id_REQ_LIGHT, light_msg );
|
|
m_pSkyBox->SetPosition( 0,0,0 );
|
|
|
|
if( !light_msg.m_pLightList.empty() )
|
|
{ //있으면
|
|
m_pSkyLight = light_msg.m_pLightList[0];
|
|
}
|
|
|
|
int nSel = rand()%4;
|
|
|
|
LPCSTR TEXTURE_NAME[4] = {"cloud01.DDS", "cloud02.DDS", "cloud03.DDS", "cloud04.DDS"};
|
|
m_spTexture = KTextureManager::GetManager()->GetTexture( TEXTURE_NAME[nSel], &loadpack, true, KTextureManager::GetManager()->GetMipMapBiasLevel() );
|
|
|
|
//K3DTextureSPtr spAlphaTex;
|
|
//spAlphaTex = KTextureManager::GetManager()->GetTexture( "purple_circle.dds",
|
|
// &loadpack, true, KTextureManager::GetManager()->GetMipMapBiasLevel() );
|
|
|
|
//assert( spAlphaTex && "alpha texture was not loaded!!" );
|
|
|
|
//방향 설정 8~10개 정도
|
|
//방향에 따라 스피드 다르다.
|
|
//거리에 따라 Visibility 다르다.
|
|
//거리에 따라 각도 다르다.
|
|
//
|
|
|
|
// make normal clouds
|
|
|
|
m_pCloud = new SGameCloud(CLOUD_MAX);
|
|
|
|
m_pCloud->Init( pDevice );
|
|
m_pCloud->SetTexture( m_spTexture );
|
|
//m_pCloud->SetAlphaTexture( spAlphaTex );
|
|
|
|
for( int i(0); i < CLOUD_MAX; i++ )
|
|
{
|
|
m_pCloud->SetPosition( i, (K3DVALUE)(-rand()%7000+1500), (K3DVALUE)(-rand()%7000+1500
|
|
), DEFAULT_HEIGHT );
|
|
// m_pCloud->SetActive( i, (rand() % 2) == 1 );
|
|
m_pCloud->SetActive( i, true );
|
|
}
|
|
|
|
m_pCloud->SetVectorCloud( &m_VecCloud );
|
|
m_pCloud->SetTransform( &m_Mat );
|
|
|
|
//m_pIB = CTerrainPrimitive::CreateCommonIndexBuffer( CLOUD_MAX, pDevice );
|
|
m_spIB = pDevice->CreateIndexBuffer( CLOUD_MAX*3*2 );
|
|
|
|
WORD *idxb;
|
|
int idxSize;
|
|
m_spIB->Lock((void **)&idxb, idxSize);
|
|
assert(idxb && "m_pIB->Lock((void **)&idxb, idxSize);");
|
|
|
|
for(int idxit = 0; idxit < CLOUD_MAX*3*2; ) {
|
|
idxb[idxit] = idxit/6*4+3; ++idxit;
|
|
idxb[idxit] = idxit/6*4+1; ++idxit;
|
|
idxb[idxit] = idxit/6*4+0; ++idxit;
|
|
idxb[idxit] = idxit/6*4+3; ++idxit;
|
|
idxb[idxit] = idxit/6*4+0; ++idxit;
|
|
idxb[idxit] = idxit/6*4+2; ++idxit;
|
|
}
|
|
m_spIB->Unlock();
|
|
SetIndexBuffer( m_spIB );
|
|
|
|
m_pSunMoon = new SGameSunMoon;
|
|
|
|
#ifdef CLOUD_LUA
|
|
m_rCloudMaker.SetDevice( this->m_pDevice );
|
|
#endif
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameSky::SetSkyType( DWORD dwSkyType )
|
|
{
|
|
if( m_dwSkyType == dwSkyType ) return false;
|
|
|
|
//변하는 처리 넣자~
|
|
|
|
m_dwSkyType = dwSkyType;
|
|
if( m_dwSkyType == 0 ) //일반 하늘
|
|
{
|
|
if( m_pSkyBox ) m_pSkyBox->PlayAnimation( GetSafeTickCount(), "default01", KSeqModel::SEQTYPE_LOOP );
|
|
//for( int i(0); CLOUD_MAX>i; i++ )
|
|
// m_pCloud[i].SetCloudColor( K3DColor( .15f, .15f, .15f ) );
|
|
}
|
|
else if( m_dwSkyType == 1 ) //데바 마을 하늘
|
|
{
|
|
if( m_pSkyBox ) m_pSkyBox->PlayAnimation( GetSafeTickCount(), "default02", KSeqModel::SEQTYPE_LOOP );
|
|
//for( int i(0); CLOUD_MAX>i; i++ )
|
|
// m_pCloud[i].SetCloudColor( K3DColor( .15f, .15f, .15f ) );
|
|
}
|
|
else if( m_dwSkyType == 2 ) //아수라 마을 하늘
|
|
{
|
|
if( m_pSkyBox ) m_pSkyBox->PlayAnimation( GetSafeTickCount(), "default03", KSeqModel::SEQTYPE_LOOP );
|
|
{
|
|
//for( int i(0); CLOUD_MAX>i; i++ )
|
|
// m_pCloud[i].SetCloudColor( K3DColor( .2f, .2f, .2f ) );
|
|
}
|
|
}
|
|
|
|
_CID( REQ_LIGHT );
|
|
KMsgREQ_LIGHT light_msg;
|
|
if( m_pSkyBox ) m_pSkyBox->Perform( id_REQ_LIGHT, light_msg );
|
|
|
|
if( !light_msg.m_pLightList.empty() )
|
|
{ //있으면
|
|
m_pSkyLight = light_msg.m_pLightList[0];
|
|
}
|
|
|
|
#ifdef CLOUD_LUA
|
|
m_rCloudMaker.makeCloud( 0 );
|
|
#endif
|
|
|
|
return true;
|
|
}
|
|
|
|
void SGameSky::SetCloudSpeed( float fSpeed )
|
|
{
|
|
for( int i(0); CLOUD_MAX>i; i++ )
|
|
{
|
|
m_pCloud->SetSpeed( i, fSpeed );
|
|
}
|
|
}
|
|
|
|
void SGameSky::SetVisibility( float fVisibility )
|
|
{
|
|
for( int i(0); CLOUD_MAX>i; i++ )
|
|
{
|
|
m_pCloud->SetMaxVisibility( i, fVisibility );
|
|
}
|
|
}
|
|
|
|
void SGameSky::SetCloudColor( KColor color )
|
|
{
|
|
m_pCloud->SetCloudColor( color );
|
|
}
|
|
|
|
void SGameSky::SetThunderEnable( bool bEnable )
|
|
{
|
|
m_bThunderEnabled = bEnable;
|
|
#ifdef SKYBOX_CLOUD
|
|
#else
|
|
m_pCloud->SetEnableThunderFx( bEnable );
|
|
|
|
if( true == bEnable )
|
|
{
|
|
if( m_pThunderCloud == 0 )
|
|
{
|
|
this->createThunderCloud();
|
|
m_pCloud->SetThunderCloud( m_pThunderCloud );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_pCloud->SetThunderCloud( 0 );
|
|
SAFE_DELETE( m_pThunderCloud );
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void SGameSky::SetLightningEnable( bool bEnable )
|
|
{
|
|
#ifdef SKYBOX_CLOUD
|
|
#else
|
|
if( true == bEnable )
|
|
{
|
|
if( m_pLightning == 0 )
|
|
{
|
|
m_pLightning = new SGameCloud::lightning_type( 3 );
|
|
m_pLightning->Init( m_pDevice );
|
|
m_pLightning->SetParentMatrix( &m_Mat );
|
|
m_pCloud->SetLightning( m_pLightning );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_pCloud->SetLightning( 0 );
|
|
SAFE_DELETE( m_pLightning );
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void SGameSky::SetThunderProcess( bool bFlag )
|
|
{
|
|
m_bProcessThunder = bFlag;
|
|
}
|
|
|
|
void SGameSky::SetLightningProcess( bool bFlag )
|
|
{
|
|
m_bProcessLightning = bFlag;
|
|
}
|
|
|
|
void SGameSky::SetThunderAttribute( const env_fx::SThunderAttr* pAttr )
|
|
{
|
|
if( pAttr )
|
|
{
|
|
#ifdef SKYBOX_CLOUD
|
|
#else
|
|
SCloudObject::s_fFactor = pAttr->fFactor;
|
|
SCloudObject::s_fLightningFactor = pAttr->fLightningFactor;
|
|
SCloudObject::s_dwDuration = pAttr->dwDuration;
|
|
SCloudObject::s_nFlashCount = pAttr->nFlashCount;
|
|
SCloudObject::s_sDestColor = pAttr->sColor;
|
|
#endif
|
|
}
|
|
}
|
|
|
|
void SGameSky::SetLightningAttribute( const env_fx::SLightningAttr* pAttr )
|
|
{
|
|
if( m_pLightning )
|
|
m_pLightning->SetAttribute( *pAttr );
|
|
}
|
|
|
|
void SGameSky::SetPosition( const K3DVector &pos )
|
|
{
|
|
m_pSkyBox->SetPosition( pos );
|
|
|
|
K3DMatrixTranslation( m_Mat, pos.x, pos.y, pos.z );
|
|
|
|
m_pSunMoon->SetPosition( &pos );
|
|
}
|
|
|
|
void SGameSky::SetPosition( float x, float y, float z )
|
|
{
|
|
m_pSkyBox->SetPosition( x, y, z );
|
|
|
|
K3DMatrixTranslation( m_Mat, x, y, z );
|
|
|
|
m_pSunMoon->SetPosition( &K3DVector( x,y,z ) );
|
|
|
|
#ifdef DISTANCE_VIEW
|
|
if( m_pDistanceViewModel )
|
|
m_pDistanceViewModel->SetPosition( x, y, 0.0f );
|
|
#endif
|
|
|
|
#ifdef CLOUD_LUA
|
|
// m_rCloudMaker.SetPosition( x + g_fTestX, y + g_fTestY, z + 20.0f + g_fTestZ );
|
|
// m_rCloudMaker.UpdatePosition( x, y, z );
|
|
m_rCloudMaker.UpdatePosition( 0.0f, 0.0f, 0.0f );
|
|
// m_rCloudMaker.SetPosition( 0.0f, 0.0f, 0.0f );
|
|
#endif
|
|
}
|
|
|
|
void SGameSky::SetUniformScale( float scale )
|
|
{
|
|
K3DMatrix mat = m_pSkyBox->GetTransform();
|
|
mat._11 = mat._22 = mat._33 = scale;
|
|
m_pSkyBox->SetTransform( mat );
|
|
m_pSunMoon->SetUniformScale( scale );
|
|
}
|
|
|
|
void SGameSky::SetIndexBuffer( K3DIndexBuffer * pIB )
|
|
{
|
|
m_pCloud->SetIndexBuffer( pIB );
|
|
}
|
|
|
|
void SGameSky::SetVisibilitySun( bool bVisible, float fVisibility, DWORD dwOldTime )
|
|
{
|
|
m_pSunMoon->SetVisibilitySun( bVisible, fVisibility, dwOldTime );
|
|
}
|
|
|
|
void SGameSky::SetVisibilityMoon( bool bVisible, float fVisibility, DWORD dwOldTime )
|
|
{
|
|
m_pSunMoon->SetVisibilityMoon( bVisible, fVisibility, dwOldTime );
|
|
}
|
|
|
|
#ifdef _DEV_AURORA
|
|
// 정의된 Aurora 전부를 OFF.
|
|
void SGameSky::SetAuroraRender( bool bFlag )
|
|
{
|
|
m_pSunMoon->SetVisibilityAurora( bFlag );
|
|
}
|
|
|
|
// 하나의 무작위 Aurora를 선택 ON.
|
|
// return : 선택된 Aurora Index.
|
|
int SGameSky::RandomizeOnAurora( float fVisibility, float fAngle, float fScale, float fHeight, DWORD dwOldTime )
|
|
{
|
|
return m_pSunMoon->RandomizeOnAurora( fVisibility, fAngle, fScale, fHeight, dwOldTime );
|
|
}
|
|
#endif
|
|
|
|
void SGameSky::SetVisibilityAurora( int nAurora, bool bVisible, float fVisibility, DWORD dwOldTime )
|
|
{
|
|
m_pSunMoon->SetVisibilityAurora( nAurora, bVisible, fVisibility, dwOldTime );
|
|
}
|
|
|
|
void SGameSky::SetAngleAurora( int nAurora, float fAngle )
|
|
{
|
|
m_pSunMoon->SetAngleAurora( nAurora, fAngle );
|
|
}
|
|
|
|
void SGameSky::SetScaleAurora( int nAurora, float fScale )
|
|
{
|
|
m_pSunMoon->SetScaleAurora( nAurora, fScale );
|
|
}
|
|
|
|
void SGameSky::SetHeightAurora( int nAurora, float fHeight)
|
|
{
|
|
m_pSunMoon->SetHeightAurora( nAurora, fHeight );
|
|
}
|
|
|
|
void SGameSky::SetCloudRender( bool bFlag )
|
|
{
|
|
m_bCloudRender = bFlag;
|
|
}
|
|
|
|
void SGameSky::createThunderCloud()
|
|
{
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
K3DTextureSPtr spAlphaTex;
|
|
spAlphaTex = KTextureManager::GetManager()->GetTexture( "thunder_cloud.dds",
|
|
&loadpack, true, KTextureManager::GetManager()->GetMipMapBiasLevel() );
|
|
|
|
assert( spAlphaTex && "alpha texture was not loaded!!" );
|
|
|
|
// { [sonador] make thunder clouds
|
|
|
|
m_pThunderCloud = new SGameThunderCloud( THUNDER_CLOUD_MAX );
|
|
|
|
m_pThunderCloud->Init( m_pDevice );
|
|
m_pThunderCloud->SetTexture( spAlphaTex );
|
|
|
|
for( int i(0); i < THUNDER_CLOUD_MAX; i++ )
|
|
{
|
|
m_pThunderCloud->SetPosition( i, (K3DVALUE)(-rand()%7000+1500), (K3DVALUE)(-rand()%7000+1500
|
|
), DEFAULT_HEIGHT_THUNDER_CLOUD );
|
|
// m_pCloud->SetActive( i, (rand() % 2) == 1 );
|
|
m_pThunderCloud->SetActive( i, false );
|
|
}
|
|
|
|
m_pThunderCloud->SetVectorCloud( &m_VecCloud );
|
|
m_pThunderCloud->SetTransform( &m_Mat );
|
|
|
|
//m_pIB = CTerrainPrimitive::CreateCommonIndexBuffer( CLOUD_MAX, pDevice );
|
|
m_spIBThunderCloud = m_pDevice->CreateIndexBuffer( THUNDER_CLOUD_MAX*3*2 );
|
|
|
|
WORD *idxb;
|
|
int idxSize;
|
|
m_spIBThunderCloud->Lock((void **)&idxb, idxSize);
|
|
assert(idxb && "m_pIB->Lock((void **)&idxb, idxSize);");
|
|
|
|
for(int idxit = 0; idxit < THUNDER_CLOUD_MAX*3*2; ) {
|
|
idxb[idxit] = idxit/6*4+3; ++idxit;
|
|
idxb[idxit] = idxit/6*4+1; ++idxit;
|
|
idxb[idxit] = idxit/6*4+0; ++idxit;
|
|
idxb[idxit] = idxit/6*4+3; ++idxit;
|
|
idxb[idxit] = idxit/6*4+0; ++idxit;
|
|
idxb[idxit] = idxit/6*4+2; ++idxit;
|
|
}
|
|
m_spIBThunderCloud->Unlock();
|
|
m_pThunderCloud->SetIndexBuffer( m_spIBThunderCloud );
|
|
|
|
// } [sonador] make thunder clouds
|
|
}
|
|
|
|
//void SGameSky::destroyThunderCloud()
|
|
//{
|
|
// SAEF_DELETE( m_pThunderCloud );
|
|
//}
|
|
|
|
void SGameSky::Process( DWORD dwTime )
|
|
{
|
|
if( m_dwTime == dwTime ) return;
|
|
|
|
//if( m_dwTime - m_dwStartTime < 1000 )
|
|
//{
|
|
// m_dwTime = dwTime;
|
|
// K3DVector calPos;
|
|
// K3DVectorLerp( &calPos, &m_dPos, &m_cPos, ((m_dwTime - m_dwStartTime)/1000.f) );
|
|
// m_pSkyBox->SetPosition( calPos );
|
|
//}
|
|
|
|
m_pSkyBox->Process( dwTime );
|
|
|
|
K3DVectorCross( m_VecCloud, m_pCamera->GetUpVector(), m_pCamera->GetViewVector() );
|
|
m_VecCloud.Normalize();
|
|
|
|
m_pSunMoon->Process( dwTime );
|
|
|
|
if( m_bCloudRender )
|
|
{
|
|
#ifdef CLOUD_LUA
|
|
m_rCloudMaker.Process( dwTime );
|
|
#else
|
|
m_pCloud->Process( dwTime );
|
|
#endif
|
|
m_pSunMoon->Process( dwTime );
|
|
|
|
if( m_bThunderEnabled )
|
|
{
|
|
if( m_pThunderCloud && m_bProcessThunder )
|
|
{
|
|
m_pThunderCloud->Process( dwTime );
|
|
}
|
|
if( m_pLightning && m_bProcessLightning )
|
|
{
|
|
m_pLightning->SetCameraPosition( m_pCamera->GetCamPos() );
|
|
m_pLightning->Process( dwTime );
|
|
}
|
|
}
|
|
}
|
|
|
|
#ifdef DISTANCE_VIEW
|
|
if( m_pDistanceViewModel )
|
|
m_pDistanceViewModel->Process( dwTime );
|
|
#endif
|
|
|
|
//if( m_dwSkyType == 2 ) //아수라 마을 하늘
|
|
//{
|
|
// for( int i(0); RAIN_MAX>i; i++ )
|
|
// {
|
|
// m_pRain[i]->SetPosition( (float)(rand()%500), (float)(rand()%500), (float)(rand()%1000) );
|
|
// m_pRain[i]->Process( dwTime );
|
|
// }
|
|
//}
|
|
m_dwTime = dwTime;
|
|
}
|
|
|
|
void SGameSky::Render( KViewportObject *viewport )
|
|
{
|
|
m_pSkyBox->Render( viewport, KRenderObject::RENDEREFX_SKY );
|
|
|
|
m_pSunMoon->Render( viewport );
|
|
|
|
if( m_bCloudRender )
|
|
{
|
|
#ifdef CLOUD_LUA
|
|
m_rCloudMaker.Render( viewport );
|
|
#else
|
|
m_pCloud->Render( viewport );
|
|
#endif
|
|
|
|
if( m_bThunderEnabled )
|
|
{
|
|
if( m_pThunderCloud && m_bProcessThunder )
|
|
m_pThunderCloud->Render( viewport );
|
|
if( m_pLightning && m_bProcessLightning )
|
|
m_pLightning->Render( viewport );
|
|
}
|
|
}
|
|
|
|
//if( m_dwSkyType == 2 ) //아수라 마을 하늘
|
|
//{
|
|
// for( int i(0); RAIN_MAX>i; i++ )
|
|
// {
|
|
// m_pRain[i]->Render( viewport );
|
|
// }
|
|
//}
|
|
#ifdef DISTANCE_VIEW
|
|
if( m_pDistanceViewModel )
|
|
m_pDistanceViewModel->Render( viewport );
|
|
#endif
|
|
}
|
|
|
|
#ifdef DISTANCE_VIEW
|
|
env_fx::SSkyBoxAttr* SGameSky::GetSkyThemeInfo() const
|
|
{
|
|
return m_pSkyboxAttr;
|
|
}
|
|
|
|
void SGameSky::SetSkyThemeInfo( env_fx::SSkyBoxAttr* pSkyBoxInfo )
|
|
{
|
|
if( pSkyBoxInfo == NULL )
|
|
return ;
|
|
|
|
m_pSkyboxAttr = pSkyBoxInfo;
|
|
}
|
|
|
|
env_fx::SDistanceViewAttr* SGameSky::GetDistanceViewInfo() const
|
|
{
|
|
return m_pDistanceViewAttr;
|
|
}
|
|
|
|
void SGameSky::SetDistanceViewInfo( env_fx::SDistanceViewAttr* pDistanceViewInfo )
|
|
{
|
|
if( pDistanceViewInfo == NULL )
|
|
return ;
|
|
|
|
m_pDistanceViewAttr = pDistanceViewInfo;
|
|
|
|
// distance view
|
|
//if( false == CreateDistanceView( m_pSkyboxAttr->distance_view_nx3.c_str() ) )
|
|
//{
|
|
// int nError = 0;
|
|
//}
|
|
}
|
|
|
|
bool SGameSky::CreateCloudCluster( int nTypeCloud )
|
|
{
|
|
// fine( 0 ), cloudy( 1 ), foggy( 2 ), rainy( 3 ), snowy( 4 )
|
|
if( nTypeCloud < 0 || nTypeCloud > 4 )
|
|
return false;
|
|
|
|
if( nTypeCloud == 0 )
|
|
{
|
|
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameSky::CreateCloudByType( int nTypeCloud )
|
|
{
|
|
// fine( 0 ), cloudy( 1 ), foggy( 2 ), rainy( 3 ), snowy( 4 )
|
|
if( nTypeCloud < 0 || nTypeCloud > 4 )
|
|
return false;
|
|
|
|
if( nTypeCloud == 0 )
|
|
{
|
|
// m_pCloud->
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameSky::CreateDistanceView( const char* pFileName )
|
|
{
|
|
if( pFileName == NULL )
|
|
return false;
|
|
if( strlen( pFileName ) < 3 )
|
|
return false;
|
|
|
|
SAFE_DELETE(m_pDistanceViewModel);
|
|
m_strDistanceViewModelFilename = "";
|
|
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
m_pDistanceViewModel = new KSeqModel;
|
|
m_pDistanceViewModel->Initialize();
|
|
m_pDistanceViewModel->AddAnimation( "default", pFileName, KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pDistanceViewModel->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP );
|
|
|
|
m_strDistanceViewModelFilename = pFileName;
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameSky::ChangeDistanceView( int local_id )
|
|
{
|
|
if( m_pDistanceViewAttr == NULL )
|
|
return false;
|
|
|
|
env_fx::SLocalModelInfo* pLV = m_pDistanceViewAttr->find( local_id );
|
|
if( pLV == NULL )
|
|
return false;
|
|
|
|
if( m_strDistanceViewModelFilename.size() && m_pDistanceViewModel )
|
|
{
|
|
if( m_strDistanceViewModelFilename == pLV->model_name )
|
|
return true;
|
|
}
|
|
|
|
// 원경 모델을 만든다
|
|
if( 0 == CreateDistanceView( pLV->model_name.c_str() ) )
|
|
return false;
|
|
|
|
// 구름을 만든다
|
|
if( 0 == CreateCloudCluster( pLV->cloud_type ) )
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
#endif
|
|
|
|
#ifdef CLOUD_LUA
|
|
void SGameSky::ChangeCloudColor(int nR, int nG, int nB)
|
|
{
|
|
m_rCloudMaker.ChangeCloudColor(nR, nG, nB);
|
|
}
|
|
|
|
void SGameSky::ChangeCloud(int nCloudSetID)
|
|
{
|
|
m_rCloudMaker.SetWillCloudID( nCloudSetID );
|
|
|
|
FadeInOutCloud( FADE_IN );
|
|
}
|
|
|
|
void SGameSky::FadeInOutCloud(int nFadeState)
|
|
{
|
|
m_rCloudMaker.FadeInOutCloud( nFadeState );
|
|
}
|
|
#endif |