Ejemplo n.º 1
0
void CreateLight()
{

    // Fill in a light structure defining our light
    D3DLIGHT8 light;
    memset( &light, 0, sizeof(D3DLIGHT8) );
    light.Type    = D3DLIGHT_POINT;
    light.Ambient = (D3DXCOLOR)D3DCOLOR_RGBA(0,0,0,255);
    light.Diffuse = (D3DXCOLOR)D3DCOLOR_RGBA(255,255,255,255);
    light.Specular = (D3DXCOLOR)D3DCOLOR_RGBA(150,150,150,255);
    light.Range   = 300.0f;
    light.Position = D3DXVECTOR3(0,-5,5);
    light.Attenuation0 = 0.5f;
    light.Attenuation1 = 0.02f;
    light.Attenuation2 = 0.0f;

    // Create a direction for our light - it must be normalized
    light.Direction = g_lightDir;

    // Tell the device about the light and turn it on
    g_pd3dDevice->SetLight( 0, &light );
    g_pd3dDevice->LightEnable( 0, TRUE );
    d3dSetRenderState( D3DRS_LIGHTING, TRUE );

}
Ejemplo n.º 2
0
	//================================================================================
	//!	メソッド名	CKAGEO_BALL::コンストラクタ
	//
	//	引数		inDev			Direct3Dデバイス
	//				inKind			ボールの種類
	//	更新		2008/08/26		<新規>
	//================================================================================
	CKAGEO_BALL::CKAGEO_BALL(CONST DEV		inDev,
							KAGEO_BALL_KIND	inKind)	:
	CMESH(inDev, getBallTextureName(inKind))
	{
	//	属性の初期化
		this->activate		= FALSE;
		this->hitG			= NULL;
		this->iFrame		= 0;
		this->sStaticHit	= NULL;

	//	ボールの種類により、初期化処理分岐
		switch(inKind)
		{
		//	シャドウボール
			case	eKOBALL_SHADOW:
			//	見えない影を、見える影にするメッセージ
				this->judgMessage	= eTMSG_NO_SEE_SHADOW;
				this->reactMessage	= eREAMSG_SHADOW_HIT;
				this->setThisMessage(eTMSG_SHADOW_BALL);
			//	エフェクト関連
				this->iEffectCnt	= 3;
				strcpy_s(this->effectName, sizeof(effectName), EFFECT_SHADOW);
			//	煙の色
				this->smokeColor	= D3DCOLOR_RGBA(10, 10, 10, 255);
			//	音を生成
				this->sStaticHit	= new SSTATIC(SOUND_SHADOWB_HIT);
				break;

		//	シャインボール
			case	eKOBALL_SHINE:
			//	見える影を、見えない影にするメッセージ
				this->judgMessage	= eTMSG_SEE_SHADOW;
				this->reactMessage	= eREAMSG_SHINE_HIT;
				this->setThisMessage(eTMSG_SHINE_BALL);
			//	エフェクト関連
				this->iEffectCnt	= 3;
				strcpy_s(this->effectName, sizeof(effectName), EFFECT_SHINE);
			//	音を生成
				this->sStaticHit	= new SSTATIC(SOUND_SHINEB_HIT);
			//	煙の色
				this->smokeColor	= D3DCOLOR_RGBA(255, 255, 200, 255);
				break;

		//	上記以外(エラー数値)
			default:
				this->judgMessage	= eTMSG_NOMSG;
				this->reactMessage	= eREAMSG_NOMSG;
				this->setThisMessage(eTMSG_NOMSG);
				this->iEffectCnt	= 100000;
				strcpy_s(this->effectName, sizeof(effectName), "");
				this->smokeColor	= D3DCOLOR_RGBA(255, 255, 255, 255);
				return;
		}

	//	エフェクトの登録
		C3D_EFFECT_CENTER*	effectCenter = C3D_EFFECT_CENTER::getInstance();
		effectCenter->addEffects(
			this->effectName,
			new C3D_EFFECT(inDev, this->effectName, VEC3(0.0f,0.0f,0.0f)));
	}
Ejemplo n.º 3
0
//===========================================================
//	頂点の設定
//===========================================================
void MakeVertexFade(LPDIRECT3DDEVICE9 pDevice){

	//頂点座標	※時計回り注意
	g_aFadeVertex[0].vtx = D3DXVECTOR3(g_tFade.fTexPosX, g_tFade.fTexPosY, 0.0f);	//(X, Y, Z)
	g_aFadeVertex[1].vtx = D3DXVECTOR3(g_tFade.fTexPosX + g_tFade.nTexSizeX, g_tFade.fTexPosY, 0.0f);
	g_aFadeVertex[2].vtx = D3DXVECTOR3(g_tFade.fTexPosX, g_tFade.fTexPosY + g_tFade.nTexSizeY, 0.0f);
	g_aFadeVertex[3].vtx = D3DXVECTOR3(g_tFade.fTexPosX + g_tFade.nTexSizeX, g_tFade.fTexPosY + g_tFade.nTexSizeY, 0.0f);
				   
	//rhw		   
	g_aFadeVertex[0].rhw = 
	g_aFadeVertex[1].rhw = 
	g_aFadeVertex[2].rhw = 
	g_aFadeVertex[3].rhw = 1.0f;	//すべてに1.0fを入れる
				   
	//頂点カラー	  
	g_aFadeVertex[0].diffuse = D3DCOLOR_RGBA(255, 255, 255, g_tFade.nFadeAlpha);
	g_aFadeVertex[1].diffuse = D3DCOLOR_RGBA(255, 255, 255, g_tFade.nFadeAlpha);
	g_aFadeVertex[2].diffuse = D3DCOLOR_RGBA(255, 255, 255, g_tFade.nFadeAlpha);
	g_aFadeVertex[3].diffuse = D3DCOLOR_RGBA(255, 255, 255, g_tFade.nFadeAlpha);
				   
	//テクスチャ座標nCntの設定
	g_aFadeVertex[0].tex = D3DXVECTOR2(0,0);
	g_aFadeVertex[1].tex = D3DXVECTOR2(1,0);
	g_aFadeVertex[2].tex = D3DXVECTOR2(0,1);
	g_aFadeVertex[3].tex = D3DXVECTOR2(1,1);
}
Ejemplo n.º 4
0
void Screen3D::BlankArea( RECT& Dimensions)
{

	// Figure out the vertices for the main window
	ScreenVertex WindowVertices[4];

	WindowVertices[0].z   = 0;WindowVertices[1].z   = 0;WindowVertices[2].z   = 0;WindowVertices[3].z   = 0;
	WindowVertices[0].RHW = 1;	WindowVertices[1].RHW = 1; WindowVertices[2].RHW = 1; WindowVertices[3].RHW = 1;
	WindowVertices[0].color = D3DCOLOR_RGBA(R, G, B, 255);WindowVertices[1].color = D3DCOLOR_RGBA(R, G, B, 255);
	WindowVertices[2].color = D3DCOLOR_RGBA(R, G, B, 255);WindowVertices[3].color = D3DCOLOR_RGBA(R, G, B, 255);

	WindowVertices[0].x   = Dimensions.left;
	WindowVertices[0].y   = Dimensions.top;

	
	WindowVertices[1].x   = Dimensions.right;
	WindowVertices[1].y   = Dimensions.top;

	WindowVertices[2].x   = Dimensions.left;
	WindowVertices[2].y   = Dimensions.bottom;

	WindowVertices[3].x   = Dimensions.right;
	WindowVertices[3].y   = Dimensions.bottom;

	PolygonsRendered += 2;
	DrawCalls++;

	D3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,   FALSE);
	D3DDevice->SetRenderState(D3DRS_SRCBLEND,           D3DBLEND_SRCALPHA);
	D3DDevice->SetRenderState(D3DRS_DESTBLEND,          D3DBLEND_INVSRCALPHA);
	SetFVF(D3DFVF_SCREENVERTEX);
	D3DDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, WindowVertices,  sizeof(ScreenVertex));

}
Ejemplo n.º 5
0
BSP::BSP(const char* bspName, AABB boundingBox, int numShaders)
{
    _name = bspName;
    _boundingBox = boundingBox;
    _numShaders  = numShaders;
    if( _numShaders ) 
    {
        _shaders = new Shader*[_numShaders];
        memset( _shaders, 0, sizeof(Shader*)*_numShaders );
    }
    else 
    {
        _shaders = NULL;
    }
    _root = NULL;

    _renderFrameId = 0;

    _fogMode    = D3DFOG_NONE;
    _fogStart   = 300000;
    _fogEnd     = 500000;
    _fogDensity = 0.000005f;
    _fogColor   = D3DCOLOR_RGBA( 255, 255, 255, 255 );

    _shadowCastDirection = Vector( 0,-1,0 );
    _shadowCastColor     = D3DCOLOR_RGBA( 0, 0, 0, 96 );
    _shadowCastDepth     = 100000.0f;

    // create shadow volume pipeline
    _shadowVolume = new ShadowVolume( 4096 );

    _postRenderCallback = NULL;
    _postRenderCallbackData = NULL;
}
Ejemplo n.º 6
0
BOOL CDrawGraphics::Fade(CTexture *Tex,int Fade)
{
	//フェード処理
	DWORD t=0;
	DWORD tp=0;
	//Ctrlが押されている間
	//不透明でないならば直す
	if(CtrlOn==TRUE){
		if(Tex->VertexDataTbl[3].color==D3DCOLOR_RGBA(255,255,255,255))return 0;
		for(int i=0;i<4;i++){
			Tex->VertexDataTbl[i].color=D3DCOLOR_RGBA(255,255,255,255);
		}
		return 0;
	}
	

	FadeFlag=TRUE;
	
	switch(Fade){
		MSG msg;
		case FadeOut:
			t=GetTickCount();
			tp=t;
			for(int Alpha=255;Alpha>=0;Alpha-=AFade){
				while(tp+FadeTime>=t){
					t=GetTickCount();
				}
				tp=t;
				for(int i=0;i<4;i++){
					Tex->VertexDataTbl[i].color=D3DCOLOR_RGBA(255,255,255,Alpha);
				}
				if(CtrlOn==FALSE)PeekMessage(&msg,NULL,0,0,PM_REMOVE);//フェード中のクリックやらは無視(Ctrlキー押下時を除く)
				Update();
			}
			break;
		case FadeIn:
			//MessageBox(NULL,"fadein","",MB_OK);
			t=GetTickCount();
			tp=t;
			for(int Alpha=0;Alpha<=255;Alpha+=AFade){
				while(tp+FadeTime>=t){
					t=GetTickCount();
				}
				tp=t;
				for(int i=0;i<4;i++){
					Tex->VertexDataTbl[i].color=D3DCOLOR_RGBA(255,255,255,Alpha);
				}
				if(CtrlOn==FALSE)PeekMessage(&msg,NULL,0,0,PM_REMOVE);//フェード中のクリックやらは無視(Ctrlキー押下時を除く)
				Update();
			}
			break;
		default:
			return 0;
	}
	
	FadeFlag=FALSE;
	return 0;
}
Ejemplo n.º 7
0
void CRender::DrawString(bool CenterText, float x, float y, COLOR32 Color, PCoreString szText, ...)
{
	char szBuffer[1024];
	GET_VA_ARGS(szText, szBuffer);

	if (CenterText)
		x -= GetStringWidth(szBuffer) / 2;

	RECT Rect = { (int)x, (int)y, 0, 0 };
	RECT ShadowRect = { (int)x + 1, (int)y, 0, 0 };
	RECT ShadowRect2 = { (int)x + 1, (int)y + 1, 0, 0 };
	RECT ShadowRect3 = { (int)x, (int)y + 1, 0, 0 };
	RECT ShadowRect4 = { (int)x - 1, (int)y + 1, 0, 0 };
	RECT ShadowRect5 = { (int)x - 1, (int)y, 0, 0 };
	RECT ShadowRect6 = { (int)x - 1, (int)y - 1, 0, 0 };
	RECT ShadowRect7 = { (int)x, (int)y - 1, 0, 0 };
	RECT ShadowRect8 = { (int)x + 1, (int)y - 1, 0, 0 };
	pD3DFont->DrawText(NULL, szBuffer, -1, &ShadowRect, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(0, 0, 0, Color.a - 25));
	pD3DFont->DrawText(NULL, szBuffer, -1, &ShadowRect2, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(0, 0, 0, Color.a - 25));
	pD3DFont->DrawText(NULL, szBuffer, -1, &ShadowRect3, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(0, 0, 0, Color.a - 25));
	pD3DFont->DrawText(NULL, szBuffer, -1, &ShadowRect4, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(0, 0, 0, Color.a - 25));
	pD3DFont->DrawText(NULL, szBuffer, -1, &ShadowRect5, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(0, 0, 0, Color.a - 25));
	pD3DFont->DrawText(NULL, szBuffer, -1, &ShadowRect6, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(0, 0, 0, Color.a - 25));
	pD3DFont->DrawText(NULL, szBuffer, -1, &ShadowRect7, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(0, 0, 0, Color.a - 25));
	pD3DFont->DrawText(NULL, szBuffer, -1, &ShadowRect8, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(0, 0, 0, Color.a - 25));
	pD3DFont->DrawText(NULL, szBuffer, -1, &Rect, DT_LEFT | DT_NOCLIP, D3DCOLOR_RGBA(Color.r, Color.g, Color.g, Color.a));
}
Ejemplo n.º 8
0
	//================================================================================
	//!	メソッド名	CSCENE_MOVIE4::render
	//
	//	機能		描画
	//	更新		2009/02/17	<新規>
	//================================================================================
	void
	CSCENE_MOVIE4::render(void)
	{
	//	描画開始
		gDev->renderBegin(D3DCOLOR_RGBA(255,255,255,0));

		DEV	inDev	= this->gDev->getDevice();

	//	オブジェクトのソート
		this->camera->updateCamera();
		this->objMap->squeezeSortByCameraPosition(
			this->camera, &this->camera->getViewPointFinish());

	//	ライトの更新
		this->updateLight();

	//	Zテクスチャシェーダでテクスチャに深度値情報を書き込む
		this->shaderZTexture->begin();
		this->objMap->squeezeDrawWithZTexSha(this->shaderZTexture);
		this->shaderZTexture->end();

		this->gDev->bufferClear(D3DCOLOR_RGBA(255,255,255,255));

	//	空の描画
		gDev->spriteBegin();
		sky->draw(gDev->getSprite());
		gDev->spriteEnd();

	//	カメラでデバイス更新
		this->camera->viewTransform(inDev);

	//	深度バッファシェーダで描画
		this->shaderDepthBuf->setCameraViewProjMatrix(
			&((*this->camera->getMatrixView()) * (*this->camera->getMatrixProjection())));

		kageo->draw(inDev);
		kagemi->draw(inDev);

		this->shaderDepthBuf->begin();
		this->objMap->squeezeDrawWithDepthSha(this->shaderDepthBuf);
		this->shaderDepthBuf->end();

	//	シネマスコープの描画
		direction->directCinemaScopePaintOut();

	//	フォントの描画
		gDev->spriteBegin();
		executeDrawTelop();
		gDev->spriteEnd();

	//	幕の描画
		gDev->renderCurtainInDev();
		gDev->renderEnd();
	}
Ejemplo n.º 9
0
	bool UpdateColor()
	{
		DWORD color = D3DCOLOR_RGBA(255, 255, 255, 255);

		if (m_targetted)
			color = D3DCOLOR_RGBA(0, 255, 0, 255);
		else if (m_highlight)
			color = D3DCOLOR_RGBA(0, 255, 255, 255);

		return SetColor(color);
	}
Ejemplo n.º 10
0
/*******************************************************************************
* MakeVertexTitleGameStart
*******************************************************************************/
HRESULT MakeVertexTitleGameStart(LPDIRECT3DDEVICE9 pDevice)
{

	if(FAILED(pDevice->CreateVertexBuffer(
		sizeof(VERTEX_2D)*NUM_VERTEX,	//頂点データのバッファサイズ 
		D3DUSAGE_WRITEONLY, 
		FVF_VERTEX_2D,					//頂点フォーマット
		D3DPOOL_MANAGED, 
		&g_pVtxBufferTitleGameStart,			//頂点バッファインターフェースのポインタ
		NULL)))
	{
		return E_FAIL;
	}
	{
	//頂点バッファの中身を埋める
	VERTEX_2D *pVtx;

	//頂点データの範囲をロックし、頂点バッファへのポインタを取得
	g_pVtxBufferTitleGameStart->Lock( 0, 0, (void**)&pVtx, 0);

	//頂点座標の設定
	pVtx[0].vtx = D3DXVECTOR3(POLYGON_POS_X_GAMESTART - POLYGON_SIZE_X_GAMESTART/2, POLYGON_POS_Y_GAMESTART - POLYGON_SIZE_Y_GAMESTART/2, 0.0f);
	pVtx[1].vtx = D3DXVECTOR3(POLYGON_POS_X_GAMESTART + POLYGON_SIZE_X_GAMESTART/2, POLYGON_POS_Y_GAMESTART - POLYGON_SIZE_Y_GAMESTART/2, 0.0f);
	pVtx[2].vtx = D3DXVECTOR3(POLYGON_POS_X_GAMESTART - POLYGON_SIZE_X_GAMESTART/2, POLYGON_POS_Y_GAMESTART + POLYGON_SIZE_Y_GAMESTART/2, 0.0f);
	pVtx[3].vtx = D3DXVECTOR3(POLYGON_POS_X_GAMESTART + POLYGON_SIZE_X_GAMESTART/2, POLYGON_POS_Y_GAMESTART + POLYGON_SIZE_Y_GAMESTART/2, 0.0f);

	//rhw
	pVtx[0].rhw = 1.0f;
	pVtx[1].rhw = 1.0f;
	pVtx[2].rhw = 1.0f;
	pVtx[3].rhw = 1.0f;


	//color
	pVtx[0].col = D3DCOLOR_RGBA(255,255,255,255);
	pVtx[1].col = D3DCOLOR_RGBA(255,255,255,255);
	pVtx[2].col = D3DCOLOR_RGBA(255,255,255,255);
	pVtx[3].col = D3DCOLOR_RGBA(255,255,255,255);


	//テクスチャ座標指定
	pVtx[0].tex = D3DXVECTOR2(0.0f, 0.0f);
	pVtx[1].tex = D3DXVECTOR2(1.0f, 0.0f);
	pVtx[2].tex = D3DXVECTOR2(0.0f, 1.0f);
	pVtx[3].tex = D3DXVECTOR2(1.0f, 1.0f);
	
	//D3DXCreateTextureFromFile(pDevice,POLYGON_TEXTURENAME_GAMESTART,&g_pTextureTitleGameStart);
	
	g_pVtxBufferTitleGameStart->Unlock();

	}
	return S_OK;
}
Ejemplo n.º 11
0
//=============================================================================
// 頂点情報の作成
//=============================================================================
HRESULT MakeVertexPlaybar(LPDIRECT3DDEVICE9 pDevice)
{
	// オブジェクトの頂点バッファを生成
	if( FAILED( pDevice->CreateVertexBuffer(sizeof(VERTEX_2D) * NUM_VERTEX * MAX_PLAYBAR,		// 頂点データ用に確保するバッファサイズ(バイト単位)
											D3DUSAGE_WRITEONLY,									// 頂点バッファの使用法 
											FVF_VERTEX_2D,										// 使用する頂点フォーマット
											D3DPOOL_MANAGED,									// リソースのバッファを保持するメモリクラスを指定
											&g_pD3DVtxBuffPlaybar,								// 頂点バッファインターフェースへのポインタ
											NULL)))												// NULLに設定
	{
		return E_FAIL;
	}

	{//頂点バッファの中身を埋める
		VERTEX_2D *pVtx;

		// 頂点データの範囲をロックし、頂点バッファへのポインタを取得
		g_pD3DVtxBuffPlaybar->Lock(0, 0, (void**)&pVtx, 0);


		for(int nCntPlayBar = 0; nCntPlayBar < MAX_PLAYBAR; nCntPlayBar++, pVtx += 4)
		{
		// 頂点座標の設定
			//pVtx[0].vtx = D3DXVECTOR3(g_playbar[PLAYBAR_MAX].pos.x - PLAYBAR_SIZE_X / 2, g_playbar[PLAYBAR_MAX].pos.y - PLAYBAR_SIZE_Y / 2, 0.0f);
			//pVtx[1].vtx = D3DXVECTOR3(g_playbar[PLAYBAR_MAX].pos.x + PLAYBAR_SIZE_X / 2, g_playbar[PLAYBAR_MAX].pos.y - PLAYBAR_SIZE_Y / 2, 0.0f);
			//pVtx[2].vtx = D3DXVECTOR3(g_playbar[PLAYBAR_MAX].pos.x - PLAYBAR_SIZE_X / 2, g_playbar[PLAYBAR_MAX].pos.y + PLAYBAR_SIZE_Y / 2, 0.0f);
			//pVtx[3].vtx = D3DXVECTOR3(g_playbar[PLAYBAR_MAX].pos.x + PLAYBAR_SIZE_X / 2, g_playbar[PLAYBAR_MAX].pos.y + PLAYBAR_SIZE_Y / 2, 0.0f);

			// rhwの設定
			pVtx[0].rhw = 1.0f;
			pVtx[1].rhw = 1.0f;
			pVtx[2].rhw = 1.0f;
			pVtx[3].rhw = 1.0f;

			// 反射光の設定
			pVtx[0].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
			pVtx[1].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
			pVtx[2].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
			pVtx[3].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);

			//// テクスチャ座標の設定
			//pVtx[0].tex = D3DXVECTOR2(0.0f, 0.0f);
			//pVtx[1].tex = D3DXVECTOR2(TEX_PATTERN_SIZE_X, 0.0f);
			//pVtx[2].tex = D3DXVECTOR2(0.0f, TEX_PATTERN_SIZE_Y);
			//pVtx[3].tex = D3DXVECTOR2(TEX_PATTERN_SIZE_X, TEX_PATTERN_SIZE_Y);

			// 頂点データをアンロックする
			g_pD3DVtxBuffPlaybar->Unlock();
		}
	}

	return S_OK;
}
Ejemplo n.º 12
0
void CReloadProcess::Draw( int iX, int iY, int iModuleID, int iGraphicID, float fProcessRate )
{
	//sprintf( g_MsgBuf, "%d", 100 - (int)( fProcessRate * 100 ) );
	//drawFontf( g_GameDATA.m_hFONT[ FONT_NORMAL ], true, 2,2 ,g_dwBLACK, g_MsgBuf );
	CTDrawImpl* pDrawObj = g_itMGR.GetDrawImplPtr();
	pDrawObj->DrawCover( iX,
						 iY,
						iModuleID, 
						iGraphicID,
						D3DCOLOR_RGBA( 255, 255, 255, 255 ),
						D3DCOLOR_RGBA(   0,   0,   0, 110 ),
						fProcessRate );
}
Ejemplo n.º 13
0
//-------------------------------------------------------------
// ������ ����
//-------------------------------------------------------------
void CBigSquare::RestoreDeviceObjects( FLOAT sx, FLOAT sy )
{
	SHADOWVERTEX* v;
	m_pVB->Lock( 0, 0, (void**)&v, 0 );
	v[0].p = D3DXVECTOR4(  0, sy, 0.0f, 1.0f );
	v[1].p = D3DXVECTOR4(  0,  0, 0.0f, 1.0f );
	v[2].p = D3DXVECTOR4( sx, sy, 0.0f, 1.0f );
	v[3].p = D3DXVECTOR4( sx,  0, 0.0f, 1.0f );
	v[0].color = D3DCOLOR_RGBA(0,0,0,0x7f);
	v[1].color = D3DCOLOR_RGBA(0,0,0,0x7f);
	v[2].color = D3DCOLOR_RGBA(0,0,0,0x7f);
	v[3].color = D3DCOLOR_RGBA(0,0,0,0x7f);
	m_pVB->Unlock();
}
Ejemplo n.º 14
0
D3DCOLOR ConvertColor(gl::Color color)
{
    return D3DCOLOR_RGBA(gl::unorm<8>(color.red),
                         gl::unorm<8>(color.green),
                         gl::unorm<8>(color.blue),
                         gl::unorm<8>(color.alpha));
}
Ejemplo n.º 15
0
	//================================================================================
	//!	メソッド名	CYAMAKAGE_WEAPON::コンストラクタ
	//
	//	引数		inDev			Direct3Dデバイス
	//				inKind			ボールの種類
	//	更新		2009/02/17		<新規>
	//================================================================================
	CYAMAKAGE_WEAPON::CYAMAKAGE_WEAPON(CONST DEV inDev)	:
	CSKIN_MESH(inDev, NAME_YAMAKAGE_WEAPON)
	{
	//	属性の初期化
		this->player			= NULL;
		this->viewG				= NULL;
		this->stageG			= NULL;
		this->weaponAction		= eOPEYW_MAX;
		this->iSmokeFrame		= 0;
		this->iMoveFrame		= 0;
		this->targetLoc			= VEC3(0.0f, 0.0f, 0.0f);
		this->ssEnemyBallShot	= new SSTATIC("shot_shadow");

	//	オリジナル「エネミーボール」の生成
		this->originEnemyBall
			= new CENEMY_BALL(inDev, eENEMYB_STRAIGHT, "shadow_ball", EFFECT_SHADOW);
		this->originEnemyBall->setEffectColor(D3DCOLOR_RGBA(100,100,100,255));
		this->originEnemyBall->setReactMessage(eREAMSG_ENEMY_ATTACK_LV1);

	//	エフェクトの登録
		C3D_EFFECT_CENTER*	effectCenter = C3D_EFFECT_CENTER::getInstance();
		effectCenter->addEffects(
			EFFECT_SMOKE, new C3D_EFFECT(inDev, EFFECT_SMOKE, VEC3(0.0f,0.0f,0.0f)));

	//	浮遊中に変更
		this->setWeaponAction(eOPEYW_FLOATING);
	//	アニメーションの初期化
		this->changeAnimationAndBlend(0);
	//	オブジェクトの種類を見える影に変更
		this->setThisMessage(eTMSG_SEE_SHADOW);
	}
Ejemplo n.º 16
0
 Engine::Engine()
 {
     srand((unsigned int)time(NULL));
     p_maximizeProcessor = false;
     p_frameCount_core = 0;
     p_frameRate_core = 0;
     p_frameCount_real = 0;
     p_frameRate_real = 0;
     p_ambientColor = D3DCOLOR_RGBA(255,255,255, 0);
     p_windowHandle = 0;
     p_pauseMode = false;
     p_versionMajor = VERSION_MAJOR;
     p_versionMinor = VERSION_MINOR;
     p_revision = REVISION;
     
     //set default values
     this->setAppTitle("Advanced2D");
     this->setScreenWidth(640);
     this->setScreenHeight(480);
     this->setColorDepth(32);
     this->setFullscreen(false);
     
     //window handle must be set later on for DirectX!
     this->setWindowHandle(0);
 
 }
Ejemplo n.º 17
0
    void DirectX3DGraphics::fillRectangle(const Rectangle& rectangle)
    {
        if (mClipStack.empty())
        {
            throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?");
        }

        const ClipRectangle& top = mClipStack.top();
       
        DWORD color = D3DCOLOR_RGBA(mColor.r, mColor.g, mColor.b, mColor.a);
        Vertex vertices[]=
        {
           {(float)rectangle.x + top.xOffset, 
            (float)rectangle.y + rectangle.height + top.yOffset, 0.0f, 1.0f, color},
           {(float)rectangle.x + top.xOffset, 
            (float)rectangle.y + top.yOffset, 0.0f, 1.0f, color},
           {(float)rectangle.x + rectangle.width + top.xOffset, 
            (float)rectangle.y + rectangle.height + top.yOffset, 0.0f, 1.0f, color},
           {(float)rectangle.x + rectangle.width + top.xOffset, 
            (float)rectangle.y + top.yOffset, 0.0f, 1.0f, color}
        };

        mDevice->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
        mDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vertices, sizeof(Vertex));
    }
Ejemplo n.º 18
0
StereoView::StereoView(ProxyHelper::ProxyConfig& config)
{
	OutputDebugString("Created SteroView\n");
	initialized = false;
	game_type = config.game_type;
	stereo_mode = config.stereo_mode;
	swapEyes = config.swap_eyes;
	stereoEnabled = true;

	// set all member pointers to NULL to prevent uninitialized objects being used
	m_pActualDevice = NULL;
	backBuffer = NULL;
	leftTexture = NULL;
	rightTexture = NULL;
	
	leftSurface = NULL;
	rightSurface = NULL;
	
	screenVertexBuffer = NULL;
	lastVertexShader = NULL;
	lastPixelShader = NULL;
	lastTexture = NULL;
	lastTexture1 = NULL;
	lastVertexDeclaration = NULL;
	lastRenderTarget0 = NULL;
	lastRenderTarget1 = NULL;
	viewEffect = NULL;
	sb = NULL;

	g_color = D3DCOLOR_RGBA(255,255,0,255);
}
Ejemplo n.º 19
0
//***************************************************************
//	描画
//***************************************************************
void	CRenderer::Draw()
{

			//画面クリア
	m_D3DDevice->Clear(0,NULL,(D3DCLEAR_TARGET |
					D3DCLEAR_ZBUFFER),
					//フレームバッファと深度バッファクリア
					D3DCOLOR_RGBA(0,0,0,0),
					//クリア色
					1.0f,
					//クリア	Z値
					0);	//ステンシル値
	if(SUCCEEDED( m_D3DDevice->BeginScene() ))
	{

		//カメラセット
		CCamera::SetCamera(m_D3DDevice);

		//全描画
		CScene::DrawAll(m_D3DDevice);

		//描画終了
		m_D3DDevice->EndScene();
		
	}

	//裏画面と表画面を切り替え
	m_D3DDevice->Present(NULL,NULL,NULL,NULL);
}
Ejemplo n.º 20
0
void ProgressBar::Progress( std::string text, float prc )
{	
	long width = SCREEN_WIDTH;
	long height = SCREEN_HEIGHT;
	std::ostringstream output;
	output << text << ": " << (prc * 100) << "%";
	
	int rectwidth = 400;
	int rectheight = 50;

	int left = ( width / 2) - (rectwidth / 2);
	int top = ( height / 2) - (rectheight / 2);	

	sCore.DeviceHandler()->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0L);
	sCore.DeviceHandler()->BeginScene();

	RECT rc = {left, top - 100, left + rectwidth, top + rectheight};
	gProgressFont->DrawTextA(NULL, (LPCSTR)output.str().c_str(), -1, &rc, DT_CENTER | DT_VCENTER | DT_NOCLIP, 0xff000000);
	
	//Progress bar
	D3DRECT r;
	r.x1 = left; r.x2 = left + rectwidth;
	r.y1 = top; r.y2 = top + rectheight;
	sCore.DeviceHandler()->Clear(1, &r, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, 1.0f, 0L);
	r.x1 = left + 2; r.x2 = left + rectwidth - 2;
	r.y1 = top + 2; r.y2 = top + rectheight - 2;
	sCore.DeviceHandler()->Clear(1, &r, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0L);
	r.x1 = left + 2; r.x2 = r.x1 + (rectwidth - 4) * prc;
	r.y1 = top + 2; r.y2 = top + rectheight - 2;
	sCore.DeviceHandler()->Clear(1, &r, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_RGBA( 135, 206, 250, 255 ), 1.0f, 0L);

	sCore.DeviceHandler()->EndScene();
	sCore.DeviceHandler()->Present( 0, 0, 0, 0 );
}
Ejemplo n.º 21
0
void
QuantumFlash::UpdateVerts(const Point& cam_pos)
{
    if (length < radius) {
        length += radius/80;
        width  += 1;
    }

    for (int i = 0; i < npolys; i++) {
        Matrix& m = beams[i];
        
        m.Yaw(0.05);
        Point vpn = Point(m(2,0), m(2,1), m(2,2));

        Point head  = loc;
        Point tail  = loc - vpn * length;
        Point vtail = tail - head;
        Point vcam  = cam_pos - loc;
        Point vtmp  = vcam.cross(vtail);
        vtmp.Normalize();
        Point vlat  = vtmp * -width;

        verts->loc[4*i+0] = head + vlat;
        verts->loc[4*i+1] = tail + vlat * 8;
        verts->loc[4*i+2] = tail - vlat * 8;
        verts->loc[4*i+3] = head - vlat;

        DWORD color = D3DCOLOR_RGBA((BYTE) (255*shade), (BYTE) (255*shade), (BYTE) (255*shade), 255);

        for (int n = 0; n < 4; n++) {
            verts->diffuse[4*i+n] = color;
        }
    }
}
Ejemplo n.º 22
0
HRESULT CPic::Render(RECT *Rect, D3DXVECTOR2 *pScaling, D3DXVECTOR3 *pRotationCenter, FLOAT Rotation, D3DXVECTOR3 *pTranslation, BOOL bAlpha)
{
	
	//render
	spr->Begin( D3DXSPRITE_ALPHABLEND );

	m_pd3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
	m_pd3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
	if(bAlpha) m_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE);

	D3DXMATRIX mat;
	D3DXMatrixScaling( &mat, pScaling->x, pScaling->y, 1);

	spr->SetTransform( &mat );
	spr->Draw(tex,
			  Rect, 
			  pRotationCenter, 
			  pTranslation, 
			  D3DCOLOR_RGBA(255,255,255,255)
			  ); 

	m_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE); 

	spr->End();
	
	return S_OK;
}
Ejemplo n.º 23
0
//=============================================================================
// 描画
//=============================================================================
void CRenderer :: Draw(int nType)
{
	//描画用初期化
	m_pD3DDevice ->Clear(0,NULL,(D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL),
						D3DCOLOR_RGBA(100,100,100,0),
						1.0f,
						0);


	if(SUCCEEDED(m_pD3DDevice->BeginScene()))//描画の開始
	{
		//カメラの設定
		m_pCamera->Set(m_pD3DDevice);

		switch(nType)
		{
			case 0:Cform::DrawAll(m_pCamera->GetMtxView(),m_pCamera->GetRotCamera());
					break;
			case 1:Cform::DrawGame(m_pCamera->GetMtxView(),m_pCamera->GetRotCamera());
					break;
			case 2:Cform::DrawPause(m_pCamera->GetMtxView(),m_pCamera->GetRotCamera());
					break;
		}

#ifdef _DEBUG
		// デバッグ処理
		CDebugProc::Draw();
#endif
		m_pD3DDevice->EndScene();//描画の終了
	}

	m_pD3DDevice ->Present(NULL,NULL,NULL,NULL);
}
Ejemplo n.º 24
0
void Node::SetD3DColor()
{
	_d3dColor = D3DCOLOR_RGBA((int)_Color4F.r,
		(int)_Color4F.g,
		(int)_Color4F.b,
		(int)_Color4F.a);
}
Ejemplo n.º 25
0
_MEMBER_FUNCTION_IMPL(GUIFont, drawText)
{
	CEGUI::Font * pFont = sq_getinstance<CEGUI::Font *>(pVM);

	if(!pFont)
	{
		sq_pushbool(pVM, false);
		return 1;
	}

	const char* text;
	SQBool sbRelative;
	float x, y;
	sq_getfloat(pVM, -4, &x);
	sq_getfloat(pVM, -3, &y);
	sq_getstring(pVM, -2, &text);
	sq_getbool(pVM, -1, &sbRelative);

	// Get our GUI instance
	CGUI * pGUI = g_pClient->GetGUI();
	
	if(sbRelative != 0) 
	{
		x *= pGUI->GetDisplayWidth();
		y *= pGUI->GetDisplayHeight();
	}

	pGUI->DrawText(text, CEGUI::Vector2( x, y ), (CEGUI::colour)D3DCOLOR_RGBA(255, 255, 255, 255), pFont, true, true);
	sq_pushbool(pVM, true);
	return 1;
}
Ejemplo n.º 26
0
static void Antialiasing_None(void)
{
	LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();

	device->BeginScene(); 

	// `設定轉換矩陣`
	Matrix4x4 ident_matrix; ident_matrix.Identity();

	device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &ident_matrix);
	device->SetTransform(D3DTS_VIEW, (D3DMATRIX *) &ident_matrix);
	device->SetTransform(D3DTS_WORLD, (D3DMATRIX *) &g_world_matrix);

	device->SetRenderState(D3DRS_ZENABLE, FALSE);

	// `消除畫面`
	device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, D3DCOLOR_RGBA(0,0,255,255), 1.0f, 0);
	// `畫出3角形`
	device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
	device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
	device->SetRenderState(D3DRS_TEXTUREFACTOR, 0xffffffff);
	device->SetFVF(D3DFVF_XYZ);
	device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, g_Triangle, sizeof(Vector4));
	// `宣告所有的繪圖指令都下完了`
	device->EndScene(); 
	// `把背景backbuffer的畫面呈現出來`
	device->Present( NULL, NULL, NULL, NULL );
}
Ejemplo n.º 27
0
void RCDrawText::execute( Renderer& renderer )
{
   DX9Renderer& dxRenderer = static_cast< DX9Renderer& >( renderer );

   ID3DXFont* dxFont = dxRenderer.getFont( m_font );
   if ( !dxFont )
   {
      return;
   }

   // draw text
   static int textLen = -1;

   DWORD format = DT_WORDBREAK;
   switch( m_justification )
   {
   case TJ_LEFT:     format |= DT_LEFT;   break;
   case TJ_CENTERED: format |= DT_CENTER; break;
   case TJ_RIGHT:    format |= DT_RIGHT;  break;
   default: break;
   }

   dxFont->DrawText( NULL,
      m_text.c_str(), 
      textLen, 
      &m_overlaySize, 
      format, 
      D3DCOLOR_RGBA( ( ( int )( m_color.r * 255 ) ), 
      ( ( int )( m_color.g * 255 ) ),
      ( ( int )( m_color.b * 255 ) ),
      ( ( int )( m_color.a * 255 ) ) ) );
}
Ejemplo n.º 28
0
//---------------------------------------------------------------------------------------
// デバッグ文字列描画
//---------------------------------------------------------------------------------------
void CGraphics::DrawText(int nX, int nY, LPCTSTR psz)
{
#if _DEBUG
	RECT rcStr = {nX, nY, m_nWidth, m_nHeight};
	m_pFont->DrawText(NULL, psz, -1, &rcStr, DT_LEFT, D3DCOLOR_RGBA(0, 0, 0, 255));
#endif
}
Ejemplo n.º 29
0
void CSkillCommandDelay::Draw( int iX, int iY )
{
	if( m_bCanCastSkill )
		return;

	if( m_hCoverTexture == 0 )
	{
		return;
	}

	m_iAnimationFrame = ( ANI_FRAME * m_iProgressRatio ) / 100;

	int x = ( m_iAnimationFrame % 3 ) * 40;
	int y = ( m_iAnimationFrame / 3 ) * 40;

	RECT rt = { x, y, x + 40, y + 40 };

	////// Transform
	D3DXMATRIX mat;		
	D3DXMatrixTranslation( &mat, iX, iY , 0.0f );
	::setTransformSprite( mat );

	::drawSprite( m_hCoverTexture, 
					&rt,
					NULL,
					&D3DXVECTOR3( 0, 0, 0 ),								
					D3DCOLOR_RGBA( 255, 255, 255, 255 ) );
}
Ejemplo n.º 30
0
void CDlgColorConfig::OnOK()
{
	// TODO: 在此添加专用代码和/或调用基类
	UpdateData(true);
	m_D3DColor=D3DCOLOR_RGBA(m_ColorRed,m_ColorGreen,m_ColorBlue,m_ColorAlpha);
	CPropertyConfigDialog::OnOK();
}