本文整理汇总了C++中GraphicsDevice::CastD3D9方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsDevice::CastD3D9方法的具体用法?C++ GraphicsDevice::CastD3D9怎么用?C++ GraphicsDevice::CastD3D9使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsDevice
的用法示例。
在下文中一共展示了GraphicsDevice::CastD3D9方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderBox
void Indicator::RenderBox(GraphicsDevice &GD, MatrixController &MC, float Radius, const Rectangle3f &Rect, RGBColor Color)
{
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Min.x, Rect.Min.y, Rect.Min.z), Vec3f(Rect.Max.x, Rect.Min.y, Rect.Min.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Max.x, Rect.Min.y, Rect.Min.z), Vec3f(Rect.Max.x, Rect.Max.y, Rect.Min.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Max.x, Rect.Max.y, Rect.Min.z), Vec3f(Rect.Min.x, Rect.Max.y, Rect.Min.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Min.x, Rect.Max.y, Rect.Min.z), Vec3f(Rect.Min.x, Rect.Min.y, Rect.Min.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Min.x, Rect.Min.y, Rect.Min.z), Vec3f(Rect.Min.x, Rect.Min.y, Rect.Max.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Max.x, Rect.Min.y, Rect.Min.z), Vec3f(Rect.Max.x, Rect.Min.y, Rect.Max.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Max.x, Rect.Max.y, Rect.Min.z), Vec3f(Rect.Max.x, Rect.Max.y, Rect.Max.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Min.x, Rect.Max.y, Rect.Min.z), Vec3f(Rect.Min.x, Rect.Max.y, Rect.Max.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Min.x, Rect.Min.y, Rect.Max.z), Vec3f(Rect.Max.x, Rect.Min.y, Rect.Max.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Max.x, Rect.Min.y, Rect.Max.z), Vec3f(Rect.Max.x, Rect.Max.y, Rect.Max.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Max.x, Rect.Max.y, Rect.Max.z), Vec3f(Rect.Min.x, Rect.Max.y, Rect.Max.z), Color);
RenderCylinder(GD, MC, Radius, Vec3f(Rect.Min.x, Rect.Max.y, Rect.Max.z), Vec3f(Rect.Min.x, Rect.Min.y, Rect.Max.z), Color);
Matrix4 Scale = Matrix4::Scaling(Rect.Dimensions());
Matrix4 Translate = Matrix4::Translation(Rect.Min);
MC.World = Scale * Translate;
LPDIRECT3DDEVICE9 Device = GD.CastD3D9().GetDevice();
D3DCOLOR D3DColor = RGBColor(90, 90, 90);
Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_BLENDFACTOR);
Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVBLENDFACTOR);
Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
Device->SetRenderState(D3DRS_BLENDFACTOR, D3DColor);
_Box.SetColor(Color);
_Box.Render();
Device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
}
示例2: file
void D3D9PixelShader::Reset(GraphicsDevice &graphics)
{
FreeMemory();
HRESULT hr;
_device = graphics.CastD3D9().GetDevice();
Assert(_device != NULL, "_device == NULL");
DWORD dwShaderFlags = 0;
#ifdef DEBUG_PS
dwShaderFlags |= D3DXSHADER_SKIPOPTIMIZATION | D3DXSHADER_DEBUG;
#endif
LPD3DXBUFFER pCode = NULL;
LPD3DXBUFFER pErrors = NULL;
PersistentAssert(Utility::FileExists(_shaderFile), String("Shader file not found: ") + _shaderFile);
// Assemble the vertex shader from the file
hr = D3DXCompileShaderFromFile( _shaderFile.CString(), NULL, NULL, "PShaderEntry",
"ps_3_0", dwShaderFlags, &pCode,
&pErrors, &_constantTable );
String ErrorString;
if(pErrors)
{
char *ErrorMessage = (char *)pErrors->GetBufferPointer();
DWORD ErrorLength = pErrors->GetBufferSize();
ofstream file("ShaderDebug.txt");
for(UINT i = 0; i < ErrorLength; i++)
{
file << ErrorMessage[i];
ErrorString += String(ErrorMessage[i]);
}
file.close();
}
PersistentAssert(!FAILED(hr), String("D3DXCompileShaderFromFile failed: ") + ErrorString);
hr = _device->CreatePixelShader( (DWORD*)pCode->GetBufferPointer(),
&_shader );
if(pErrors)
{
pErrors->Release();
}
if(pCode)
{
pCode->Release();
}
PersistentAssert(!FAILED(hr), "CreatePixelShader failed");
}
示例3: FreeMemory
void D3D9Font::Reset(GraphicsDevice &graphics)
{
FreeMemory();
_Device = graphics.CastD3D9().GetDevice();
Assert(_Device != NULL, "Device == NULL");
HRESULT hr;
hr = D3DXCreateFont(
_Device,
_FontHeight, // Height
0, // Width
_FontWeight, // Weight
1, // MipLevels, 0 = autogen mipmaps
FALSE, // Italic
DEFAULT_CHARSET, // CharSet
OUT_DEFAULT_PRECIS, // OutputPrecision
DEFAULT_QUALITY, // Quality
DEFAULT_PITCH | FF_DONTCARE, // PitchAndFamily
_FontName.CString(), // pFaceName
&_Font); // ppFont
Assert(SUCCEEDED(hr) && _Font != NULL, "D3DXCreateFont failed");
}
示例4: Reset
void D3D9VertexShader::Init(const String &Filename, GraphicsDevice &GD)
{
_ShaderFile = Filename;
Reset(GD.CastD3D9().GetDevice());
}
示例5:
void D3D9Texture::Reset(GraphicsDevice &graphics)
{
_Device = graphics.CastD3D9().GetDevice();
}