コード例 #1
0
ファイル: devicedx8.cpp プロジェクト: skopp/rush
void JRenderServer::RecreateDefaultRes()
{
    m_pDevice->ResourceManagerDiscardBytes( 0 );
    m_pDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &m_pBackBuffer );
    m_pDevice->GetDepthStencilSurface( &m_pDepthStencil );

    for (int i = 0; i < m_VBuffers.size(); i++) 
    {
        VBInstance& vb = m_VBuffers[i];
        CreateVB( vb.m_Name.c_str(), vb.m_Size, !vb.m_bDynamic );
    }

    for (int i = 0; i < m_IBuffers.size(); i++) 
    {
        IBInstance& ib = m_IBuffers[i];
        CreateIB( ib.m_Name.c_str(), ib.m_Size, !ib.m_bDynamic );
    }

    for (int i = 0; i < m_Textures.size(); i++) 
    {
        TextureFile& tex = m_Textures[i];
        if (tex.m_Prop.m_PoolType == PoolType_Video)
        {
            CreateTexture( tex.m_Prop );
        }
    }

    CreateQuadIB();
} // JRenderServer::RecreateDefaultRes
コード例 #2
0
ファイル: CameraWorkBase.cpp プロジェクト: yoonhada/nlinelast
VOID CameraWorkBase::CreateImage( LPIMAGE _pImage, LPINFO _pInfo )
{
	//	Vertex는 외부에서 받아온다
	if( _pImage->pVB == NULL && _pImage->pIB == NULL )
	{	//	처음 만들거나 iNumVertices정보가 변경되었을때
		
		//	Create VertexBuffer
		_pImage->iNumVertices	= _pInfo->iNumVertices;
		
		CreateVB( &_pImage->pVB, _pImage->iNumVertices, sizeof( VERTEX ), VERTEX::FVF );
		SetVB( _pImage->pVB, _pInfo->pVertex, _pImage->iNumVertices, sizeof( VERTEX ) );

		//	Create IndexBuffer
		_pImage->iNumIndices	= _pInfo->iNumIndices;

		CreateIB( &_pImage->pIB, _pImage->iNumIndices, sizeof( INDEX ) );
		SetIB( _pImage->pIB, _pInfo->pIndex, _pImage->iNumIndices, sizeof( INDEX) );

		return;
	}

	LPVOID pVertices;
	if( FAILED( _pImage->pVB->Lock( 0, sizeof( VERTEX ) * _pInfo->iNumVertices, (LPVOID*)&pVertices, 0 ) ) )
	{
		MessageBox( NULL, L"CreateImage_Course(){ ... pVB->Lock failed ... }", NULL, MB_OK );
		return;
	}

	memcpy( pVertices, _pInfo->pVertex, sizeof( VERTEX ) * _pInfo->iNumVertices );

	_pImage->pVB->Unlock();
}
コード例 #3
0
ファイル: NormalLine.cpp プロジェクト: yoonhada/nlinelast
VOID NormalLine::Create( D3DCOLOR _Color, INT _iNumVertex, LPD3DXVECTOR3 _pPosition, LPD3DXVECTOR3 _pNormal )
{
	INT iNumVertex = _iNumVertex * 2;
	LPVERTEX pVertex = new VERTEX[ iNumVertex ];

	INT k = 0;
	for( INT i=0 ; i<iNumVertex ; i+=2 )
	{
		pVertex[ i   ].pos		= _pPosition[ k ];
		pVertex[ i   ].color	= _Color;

		pVertex[ i+1 ].pos		= _pPosition[ k ] + _pNormal[ k ];
		pVertex[ i+1 ].color	= _Color;

		k++;
	}
	
	LPDATA	pData = new DATA;

	pData->iNumLine = _iNumVertex;

	CreateVB( &pData->pVB, iNumVertex, sizeof( VERTEX ), VERTEX::FVF );
	SetVB( pData->pVB, pVertex, iNumVertex,  sizeof( VERTEX ) );

	m_pDataList.push_back( pData );

	SAFE_DELETE_ARRAY( pVertex );
}
コード例 #4
0
ファイル: GUI.cpp プロジェクト: SinYocto/Zee
void Button::CreateVertexBuffer()
{
	VertexXYZRHWUV vertexData[4];
	vertexData[0] = VertexXYZRHWUV((float)screenRect.left, (float)screenRect.top, 0, 1, 0, 0);
	vertexData[1] = VertexXYZRHWUV((float)screenRect.right, (float)screenRect.top, 0, 1, 1, 0);
	vertexData[2] = VertexXYZRHWUV((float)screenRect.left, (float)screenRect.bottom, 0, 1, 0, 1);
	vertexData[3] = VertexXYZRHWUV((float)screenRect.right, (float)screenRect.bottom, 0, 1, 1, 1);

	CreateVB(gEngine->GetDriver()->GetD3DDevice(), &vertexBuffer, vertexData, 4, XYZRHW_UV);
}
コード例 #5
0
void CAMeshSHSkin::MakeVIB (const CAModelVIB& modelVIB)
{
	m_dwFVF = CAVertex::FVF;

	m_nNumVertices	= (int)modelVIB.m_listVertex.size ();
	m_nNumTriangles = (int)modelVIB.m_listIndex.size ();

	CreateVB (modelVIB);
	CreateIB (modelVIB);
}
コード例 #6
0
ファイル: CameraWorkBase.cpp プロジェクト: yoonhada/nlinelast
VOID CameraWorkBase::CreateImage_Box( LPIMAGE _pImage )
{
	INT iNumVertices	= 8;
	INT iNumIndices		= 12;

	_pImage->iNumVertices	= iNumVertices;
	_pImage->iNumIndices	= iNumIndices;

	//	Init Vertex
	VERTEX	aVertex[ 8 ];
	
	aVertex[ 0 ].vecPos = D3DXVECTOR3( -1.0f, 1.0f, -1.0f );
	aVertex[ 1 ].vecPos = D3DXVECTOR3( 1.0f, 1.0f, -1.0f );
	aVertex[ 2 ].vecPos = D3DXVECTOR3( -1.0f, 1.0f, 1.0f );
	aVertex[ 3 ].vecPos = D3DXVECTOR3( 1.0f, 1.0f, 1.0f );
	aVertex[ 4 ].vecPos = D3DXVECTOR3( -1.0f, -1.0f, -1.0f );
	aVertex[ 5 ].vecPos = D3DXVECTOR3( 1.0f, -1.0f, -1.0f );
	aVertex[ 6 ].vecPos = D3DXVECTOR3( -1.0f, -1.0f, 1.0f );
	aVertex[ 7 ].vecPos = D3DXVECTOR3( 1.0f, -1.0f, 1.0f );

	aVertex[ 0 ].dColor	= m_dColBox;
	aVertex[ 1 ].dColor	= m_dColBox;
	aVertex[ 2 ].dColor	= m_dColBox;
	aVertex[ 3 ].dColor	= m_dColBox;
	aVertex[ 4 ].dColor	= m_dColBox;
	aVertex[ 5 ].dColor	= m_dColBox;
	aVertex[ 6 ].dColor	= m_dColBox;
	aVertex[ 7 ].dColor	= m_dColBox;

	//	Init Index
	INDEX	aIndex[ 12 ];
	
	aIndex[ 0 ]._0 = 0;		aIndex[ 0 ]._1 = 1;	
	aIndex[ 1 ]._0 = 0;		aIndex[ 1 ]._1 = 2;	
	aIndex[ 2 ]._0 = 2;		aIndex[ 2 ]._1 = 3;	
	aIndex[ 3 ]._0 = 3;		aIndex[ 3 ]._1 = 1;	

	aIndex[ 4 ]._0 = 0;		aIndex[ 4 ]._1 = 4;	
	aIndex[ 5 ]._0 = 1;		aIndex[ 5 ]._1 = 5;	
	aIndex[ 6 ]._0 = 2;		aIndex[ 6 ]._1 = 6;	
	aIndex[ 7 ]._0 = 3;		aIndex[ 7 ]._1 = 7;	

	aIndex[ 8 ]._0 = 4;		aIndex[ 8 ]._1 = 5;	
	aIndex[ 9 ]._0 = 5;		aIndex[ 9 ]._1 = 7;	
	aIndex[ 10 ]._0 = 6;	aIndex[ 10 ]._1 = 7;	
	aIndex[ 11 ]._0 = 6;	aIndex[ 11 ]._1 = 4;	

	//	Init VertexBuffer, IndexBuffer
	CreateVB( &_pImage->pVB, iNumVertices, sizeof( VERTEX ), VERTEX::FVF );
	SetVB( _pImage->pVB, aVertex, iNumVertices, sizeof( VERTEX ) );

	CreateIB( &_pImage->pIB, iNumIndices, sizeof( INDEX ) );
	SetIB( _pImage->pIB, aIndex, iNumIndices, sizeof( INDEX) );
}
コード例 #7
0
ファイル: CRoad.cpp プロジェクト: BruceKen2014/Dex
CRoad::CRoad(LPDIRECT3DDEVICE9 device, D3DXVECTOR3 pos, float width, float length, int id, int dir, float tileX, float tileY):CSoundObject()
{
	m_device = device;
	m_pos = pos;
	m_width = width;
	m_length = length;
	m_dir = dir;
	m_tileX = tileX;
	m_tileY = tileY;
	m_id   = id;
	CreateVB();
}
コード例 #8
0
ファイル: ShadowMapRenderer.cpp プロジェクト: SinYocto/Zee
void ShadowMapRenderer::createGaussianBlurQuadVB()
{
	SAFE_RELEASE(mBlurQuadVB);

	VertexXYZRHWUV quadVerts[4];
	quadVerts[0] = VertexXYZRHWUV(0, 0, 0, 1, 0, 0); 
	quadVerts[1] = VertexXYZRHWUV(SHADOW_MAP_SIZE, 0, 0, 1, 1, 0); 
	quadVerts[2] = VertexXYZRHWUV(0, SHADOW_MAP_SIZE, 0, 1, 0, 1); 
	quadVerts[3] = VertexXYZRHWUV(SHADOW_MAP_SIZE, SHADOW_MAP_SIZE, 0, 1, 1, 1);

	CreateVB(gEngine->GetDriver()->GetD3DDevice(), &mBlurQuadVB, quadVerts, 4, XYZRHW_UV);
}
コード例 #9
0
ファイル: GUI.cpp プロジェクト: SinYocto/Zee
void ListBox::CreateItemVB(int itemIx)
{
	IDirect3DDevice9* d3dDevice = gEngine->GetDriver()->GetD3DDevice();

	VertexXYZRHWUV vertexData[4];
	int height= rect.bottom - rect.top;
	vertexData[0] = VertexXYZRHWUV((float)screenRect.left, (float)screenRect.top + (itemIx+1)*height, 0, 1, 0, 0);
	vertexData[1] = VertexXYZRHWUV((float)screenRect.right, (float)screenRect.top + (itemIx+1)*height, 0, 1, 1, 0);
	vertexData[2] = VertexXYZRHWUV((float)screenRect.left, (float)screenRect.bottom + (itemIx+1)*height, 0, 1, 0, 1);
	vertexData[3] = VertexXYZRHWUV((float)screenRect.right, (float)screenRect.bottom + (itemIx+1)*height, 0, 1, 1, 1);

	CreateVB(d3dDevice, &(items[itemIx].vertexBuffer), vertexData, 4, XYZRHW_UV);
}
コード例 #10
0
ファイル: GUI.cpp プロジェクト: SinYocto/Zee
void ListBox::CreateBodyVB()
{
	IDirect3DDevice9* d3dDevice = gEngine->GetDriver()->GetD3DDevice();

	int height= rect.bottom - rect.top;

	VertexXYZRHWUV labelVertexData[4];
	labelVertexData[0] = VertexXYZRHWUV((float)screenRect.left, (float)screenRect.top, 0, 1, 0, 0);
	labelVertexData[1] = VertexXYZRHWUV((float)screenRect.right - height, (float)screenRect.top, 0, 1, 1, 0);
	labelVertexData[2] = VertexXYZRHWUV((float)screenRect.left, (float)screenRect.bottom, 0, 1, 0, 1);
	labelVertexData[3] = VertexXYZRHWUV((float)screenRect.right - height, (float)screenRect.bottom, 0, 1, 1, 1);

	CreateVB(d3dDevice, &labelVB, labelVertexData, 4, XYZRHW_UV);
	
	VertexXYZRHWUV buttonVertexData[4];
	buttonVertexData[0] = VertexXYZRHWUV((float)screenRect.right - height, (float)screenRect.top, 0, 1, 0, 0);
	buttonVertexData[1] = VertexXYZRHWUV((float)screenRect.right, (float)screenRect.top, 0, 1, 1, 0);
	buttonVertexData[2] = VertexXYZRHWUV((float)screenRect.right - height, (float)screenRect.bottom, 0, 1, 0, 1);
	buttonVertexData[3] = VertexXYZRHWUV((float)screenRect.right, (float)screenRect.bottom, 0, 1, 1, 1);

	CreateVB(d3dDevice, &buttonVB, buttonVertexData, 4, XYZRHW_UV);
}
コード例 #11
0
ファイル: GUI.cpp プロジェクト: SinYocto/Zee
void Slider::CreateVertexBuffer()
{
	IDirect3DDevice9* d3dDevice = gEngine->GetDriver()->GetD3DDevice();

	VertexXYZRHWUV barVertexData[4];
	barVertexData[0] = VertexXYZRHWUV((float)screenRect.left, (float)screenRect.top, 0, 1, 0, 0);
	barVertexData[1] = VertexXYZRHWUV((float)screenRect.right, (float)screenRect.top, 0, 1, 1, 0);
	barVertexData[2] = VertexXYZRHWUV((float)screenRect.left, (float)screenRect.bottom, 0, 1, 0, 1);
	barVertexData[3] = VertexXYZRHWUV((float)screenRect.right, (float)screenRect.bottom, 0, 1, 1, 1);

	CreateVB(d3dDevice, &sliderBarVB, barVertexData, 4, XYZRHW_UV);

	VertexXYZRHWUV thumbVertexData[4];
	float offset = ((value - minValue)/(maxValue - minValue)) * 
		(screenRect.right - style->sliderBarSize*(screenRect.bottom - screenRect.top) - screenRect.left);

	float width = style->sliderBarSize * (screenRect.bottom - screenRect.top);
	thumbVertexData[0] = VertexXYZRHWUV(screenRect.left + offset, (float)screenRect.top, 0, 1, 0, 0);
	thumbVertexData[1] = VertexXYZRHWUV(screenRect.left + offset + width, (float)screenRect.top, 0, 1, 1, 0);
	thumbVertexData[2] = VertexXYZRHWUV(screenRect.left + offset, (float)screenRect.bottom, 0, 1, 0, 1);
	thumbVertexData[3] = VertexXYZRHWUV(screenRect.left + offset + width, (float)screenRect.bottom, 0, 1, 1, 1);

	CreateVB(d3dDevice, &sliderThumbVB, thumbVertexData, 4, XYZRHW_UV);
}
コード例 #12
0
ファイル: CTile.cpp プロジェクト: JonghaLee/RobberGame
CTile::CTile(LPDIRECT3DDEVICE9 _device, float _x, float _z)
{
	D3DXMatrixIdentity(&m_matWorld);
	
	m_pTex = NULL;
	m_pIB = NULL;
	m_pVB = NULL;
	
	
	_b = false;


	
	ZeroMemory(&m_matrl, sizeof(D3DMATERIAL9));

	CreateVB(_device, _x, _z);
	CreateIB(_device);
}
コード例 #13
0
ファイル: ShadowCell.cpp プロジェクト: yoonhada/nlinelast
HRESULT CShadowCell::Create( LPDIRECT3DDEVICE9 a_pD3dDevice, 
						FLOAT a_Vertex11, FLOAT a_Vertex12, FLOAT a_Vertex13,
					    FLOAT a_Vertex21, FLOAT a_Vertex22, FLOAT a_Vertex23,
					    FLOAT a_Vertex31, FLOAT a_Vertex32, FLOAT a_Vertex33,
					    FLOAT a_Vertex41, FLOAT a_Vertex42, FLOAT a_Vertex43,
						FLOAT a_Uv11, FLOAT a_Uv12,
						FLOAT a_Uv21, FLOAT a_Uv22,
						FLOAT a_Uv31, FLOAT a_Uv32,
						FLOAT a_Uv41, FLOAT a_Uv42, 
						LPCWSTR a_FileName )
{
	m_pD3dDevice = a_pD3dDevice;

	if( S_OK != CreateVB( a_Vertex11, a_Vertex12, a_Vertex13,
		a_Vertex21, a_Vertex22, a_Vertex23,
		a_Vertex31, a_Vertex32, a_Vertex33,
		a_Vertex41, a_Vertex42, a_Vertex43,
		a_Uv11, a_Uv12,
		a_Uv21, a_Uv22,
		a_Uv31, a_Uv32,
		a_Uv41, a_Uv42 ) )
	{
		return E_FAIL;
	}
	
	if( S_OK != CreateIB() )
	{
		return E_FAIL;
	}
	
	if( S_OK != LoadTexture( a_FileName ) )
	{
		return E_FAIL;
	}

	return S_OK;
}
コード例 #14
0
ファイル: SkyBox.cpp プロジェクト: SinYocto/Zee
void SkyBox::build()
{
	_Assert(NUM_VERTICES == 24);
	_Assert(NUM_TRIES == 12);

	Vector3* pos = New Vector3[24];
	pos[0] = DIST * Vector3(-1.0f, 1.0f,  1.0f);
	pos[1] = DIST * Vector3( 1.0f, 1.0f,  1.0f);
	pos[2] = DIST * Vector3(-1.0f, 1.0f, -1.0f);
	pos[3] = DIST * Vector3( 1.0f, 1.0f, -1.0f);

	pos[4] = DIST * Vector3( 1.0f, -1.0f,  1.0f);
	pos[5] = DIST * Vector3(-1.0f, -1.0f,  1.0f);
	pos[6] = DIST * Vector3( 1.0f, -1.0f, -1.0f);
	pos[7] = DIST * Vector3(-1.0f, -1.0f, -1.0f);

	pos[8]  = DIST * Vector3( 1.0f,  1.0f, 1.0f);
	pos[9]  = DIST * Vector3(-1.0f,  1.0f, 1.0f);
	pos[10] = DIST * Vector3( 1.0f, -1.0f, 1.0f);
	pos[11] = DIST * Vector3(-1.0f, -1.0f, 1.0f);

	pos[12] = DIST * Vector3(-1.0f,  1.0f, -1.0f);
	pos[13] = DIST * Vector3( 1.0f,  1.0f, -1.0f);
	pos[14] = DIST * Vector3(-1.0f, -1.0f, -1.0f);
	pos[15] = DIST * Vector3( 1.0f, -1.0f, -1.0f);

	pos[16] = DIST * Vector3(-1.0f,  1.0f,  1.0f);
	pos[17] = DIST * Vector3(-1.0f,  1.0f, -1.0f);
	pos[18] = DIST * Vector3(-1.0f, -1.0f,  1.0f);
	pos[19] = DIST * Vector3(-1.0f, -1.0f, -1.0f);

	pos[20] = DIST * Vector3( 1.0f,  1.0f, -1.0f);
	pos[21] = DIST * Vector3( 1.0f,  1.0f,  1.0f);
	pos[22] = DIST * Vector3( 1.0f, -1.0f, -1.0f);
	pos[23] = DIST * Vector3( 1.0f, -1.0f,  1.0f);

	Vector2 *uv = New Vector2[24];
	uv[0] = Vector2(0, 0);
	uv[1] = Vector2(1, 0);
	uv[2] = Vector2(0, 1);
	uv[3] = Vector2(1, 1);

	uv[4] = Vector2(0, 0);
	uv[5] = Vector2(1, 0);
	uv[6] = Vector2(0, 1);
	uv[7] = Vector2(1, 1);

	uv[8]  = Vector2(0, 0);
	uv[9]  = Vector2(1, 0);
	uv[10] = Vector2(0, 1);
	uv[11] = Vector2(1, 1);

	uv[12] = Vector2(0, 0);
	uv[13] = Vector2(1, 0);
	uv[14] = Vector2(0, 1);
	uv[15] = Vector2(1, 1);

	uv[16] = Vector2(0, 0);
	uv[17] = Vector2(1, 0);
	uv[18] = Vector2(0, 1);
	uv[19] = Vector2(1, 1);

	uv[20] = Vector2(0, 0);
	uv[21] = Vector2(1, 0);
	uv[22] = Vector2(0, 1);
	uv[23] = Vector2(1, 1);

	DWORD* indices = New DWORD[36];
	for(int i = 0; i < 6; i++)
	{
		indices[6*i + 0] = 4*i;
		indices[6*i + 1] = 4*i + 2;
		indices[6*i + 2] = 4*i + 1;
			
		indices[6*i + 3] = 4*i + 2;
		indices[6*i + 4] = 4*i + 3;
		indices[6*i + 5] = 4*i + 1;
	}
			
	void* vertexData = New VertexUV[NUM_VERTICES];
	for(int i = 0; i < NUM_VERTICES; ++i)
	{
		VertexUV vert = VertexUV(pos[i].x, pos[i].y, pos[i].z, uv[i].x, uv[i].y);
		((VertexUV*)vertexData)[i] = vert;
	}

	CreateVB(gEngine->GetDriver()->GetD3DDevice(), &mVertexBuffer, vertexData, NUM_VERTICES, XYZ_UV);
	CreateIB(gEngine->GetDriver()->GetD3DDevice(), &mIndexBuffer, indices, 3 * NUM_TRIES);

	delete[] pos;
	delete[] uv;
	delete[] indices;
	delete[] vertexData;
}
コード例 #15
0
ファイル: Mesh.cpp プロジェクト: SinYocto/Siny
void Mesh::CreateVertexBuffer(int nVertices)
{
	CreateVB(D3DDevice, &vertexBuffer, vertexData, nVertices, vertexType);
}