#include "stdafx.h" #include "shadowAgent.h" #include "CameraManager.h" cShadowAgent* cShadowAgent::mpShadowAgent = NULL; cShadowAgent::cShadowAgent() : mDrawingShadow(100) { mpShadowAgent = this; } cShadowAgent::~cShadowAgent() { mDrawingShadow.RemoveAll(); } /* ------------------------------------------------------------------ * ÇÔ¼öÀ̸§ : Process( float time ) * ¸ñ Àû : 󸮺Π* ÁÖÀÇ»çÇ× : * ------------------------------------------------------------------ */ void cShadowAgent::Process( float /*time*/ ) { NiCamera* pCamera = CAMERAMAN->GetCurrentNi(); if( !pCamera ) { return; } unsigned int shadowNum = mDrawingShadow.GetSize(); cShadowGeometry* pShadow = NULL; for( unsigned int i=0; iProcess( 0.0f, pCamera ); else { int a=0; a=1; } } } /* ------------------------------------------------------------------ * ÇÔ¼öÀ̸§ : Render( NiRenderer* pRenderer ) * ¸ñ Àû : Ãâ·ÂºÎ * ÁÖÀÇ»çÇ× : * ------------------------------------------------------------------ */ void cShadowAgent::Render( NiRenderer* pRenderer ) { NiPropertyState* pState = pRenderer->GetPropertyState(); pRenderer->SetPropertyState( mpPropertyState ); unsigned int shadowNum = mDrawingShadow.GetSize(); cShadowGeometry* pShadow = NULL; for( unsigned int i=0; iGetShadowGeometry()->RenderImmediate( pRenderer ); } pRenderer->SetPropertyState( pState ); /// ¸ðµÎ 󸮰¡ µÇ¸é °»½ÅÇÏ´Ù. mDrawingShadow.RemoveAll(); } /* ------------------------------------------------------------------ * ÇÔ¼öÀ̸§ : AddDrawingShadow( cShadowGeometry* pShadow ) * ¸ñ Àû : ÇöÀç ÇÁ·¹ÀÓ¿¡ ±×·ÁÁ®¾ß ÇÒ ±×¸²ÀÚ °´Ã¼ µî·Ï * ÁÖÀÇ»çÇ× : * ------------------------------------------------------------------ */ void cShadowAgent::AddDrawingShadow( cShadowGeometry* pShadow ) { mDrawingShadow.Add( pShadow ); } /* ------------------------------------------------------------------ * ÇÔ¼öÀ̸§ : CreateShadow( unsigned int detail, unsigned int maxTriangleCount ) * ¸ñ Àû : ±×¸²ÀÚ °´Ã¼ »ý¼º¿ë ÀÎÅÍÆäÀ̽º Á¦°ø * ÁÖÀÇ»çÇ× : * ------------------------------------------------------------------ */ cShadowGeometry* cShadowAgent::CreateShadow( unsigned int detail, unsigned int maxTriangleCount ) { cShadowGeometry* pGeom = cShadowGeometry::Create( this, detail, maxTriangleCount ); return pGeom; }