本文整理汇总了C++中LPDIRECT3DDEVICE类的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE类的具体用法?C++ LPDIRECT3DDEVICE怎么用?C++ LPDIRECT3DDEVICE使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LPDIRECT3DDEVICE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: d3d_vertex_buffer_new
LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev,
unsigned length, unsigned usage,
unsigned fvf, D3DPOOL pool, void *handle)
{
HRESULT hr;
LPDIRECT3DVERTEXBUFFER buf;
#ifndef _XBOX
if (usage == 0)
{
if (dev->GetSoftwareVertexProcessing())
usage = D3DUSAGE_SOFTWAREPROCESSING;
}
#endif
#if defined(HAVE_D3D8)
hr = IDirect3DDevice8_CreateVertexBuffer(dev, length, usage, fvf, pool,
&buf);
#elif defined(HAVE_D3D9)
hr = IDirect3DDevice9_CreateVertexBuffer(dev, length, usage, fvf, pool,
&buf, NULL);
#else
hr = dev->CreateVertexBuffer(length, usage, fvf, pool, &buf, NULL);
#endif
if (FAILED(hr))
return NULL;
return buf;
}
示例2: d3d_disable_blend_func
void d3d_disable_blend_func(void *data)
{
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
if (!dev)
return;
dev->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
}
示例3: d3d_set_render_state
void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value)
{
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
if (!dev)
return;
dev->SetRenderState(state, value);
}
示例4: d3d_enable_blend_func
void d3d_enable_blend_func(void *data)
{
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
if (!dev)
return;
dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
dev->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
}
示例5: d3d_set_render_state
void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value)
{
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
if (!dev)
return;
#if defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DDevice9_SetRenderState(dev, state, value);
#else
dev->SetRenderState(state, value);
#endif
}
示例6: d3d_set_vertex_shader
HRESULT d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index,
void *data)
{
#if defined(_XBOX1)
return dev->SetVertexShader(index);
#elif defined(_XBOX360)
LPDIRECT3DVERTEXSHADER shader = (LPDIRECT3DVERTEXSHADER)data;
D3DDevice_SetVertexShader(dev, shader);
return S_OK;
#else
LPDIRECT3DVERTEXSHADER shader = (LPDIRECT3DVERTEXSHADER)data;
return dev->SetVertexShader(shader);
#endif
}
示例7: d3d_enable_alpha_blend_texture_func
void d3d_enable_alpha_blend_texture_func(void *data)
{
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
if (!dev)
return;
#ifndef _XBOX360
/* Also blend the texture with the set alpha value. */
dev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
dev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
dev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
#endif
}
示例8: d3d_set_vertex_declaration
void d3d_set_vertex_declaration(void *data, void *vertex_data)
{
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
#if defined(HAVE_D3D9)
LPDIRECT3DVERTEXDECLARATION decl = (LPDIRECT3DVERTEXDECLARATION)vertex_data;
#endif
if (!dev)
return;
#ifdef _XBOX1
d3d_set_vertex_shader(dev, D3DFVF_XYZ | D3DFVF_TEX1, NULL);
#elif defined(HAVE_D3D9)
dev->SetVertexDeclaration(decl);
#endif
}
示例9: d3d_frame_postprocess
void d3d_frame_postprocess(void *data)
{
#if defined(_XBOX1)
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
global_t *global = global_get_ptr();
if (!dev)
return;
if (!d3d_restore_device(dev))
return;
dev->SetFlickerFilter(global->console.screen.flicker_filter_index);
dev->SetSoftDisplayFilter(global->console.softfilter_enable);
#endif
}
示例10: d3d_draw_primitive
void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
D3DPRIMITIVETYPE type, unsigned start, unsigned count)
{
#if defined(_XBOX1)
D3DDevice_DrawVertices(type, start, D3DVERTEXCOUNT(type, count));
#elif defined(_XBOX360)
D3DDevice_DrawVertices(dev, type, start, D3DVERTEXCOUNT(type, count));
#else
if (SUCCEEDED(dev->BeginScene()))
{
dev->DrawPrimitive(type, start, count);
dev->EndScene();
}
#endif
}
示例11: d3d_device_free
void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d)
{
if (dev)
dev->Release();
if (pd3d)
pd3d->Release();
}
示例12: d3d_texture_new
LPDIRECT3DTEXTURE d3d_texture_new(LPDIRECT3DDEVICE dev,
const char *path, unsigned width, unsigned height,
unsigned miplevels, unsigned usage, D3DFORMAT format,
D3DPOOL pool, unsigned filter, unsigned mipfilter,
D3DCOLOR color_key, void *src_info_data,
PALETTEENTRY *palette)
{
HRESULT hr;
LPDIRECT3DTEXTURE buf;
D3DXIMAGE_INFO *src_info = (D3DXIMAGE_INFO*)src_info_data;
if (path)
hr = D3DXCreateTextureFromFileExA(dev,
path, width, height, miplevels, usage, format,
pool, filter, mipfilter, color_key, src_info,
palette, &buf);
else
{
hr = dev->CreateTexture(width, height, miplevels, usage,
format, pool, &buf
#ifndef _XBOX1
, NULL
#endif
);
}
if (FAILED(hr))
return NULL;
return buf;
}
示例13: d3d_set_transform
void d3d_set_transform(LPDIRECT3DDEVICE dev,
D3DTRANSFORMSTATETYPE state, CONST D3DMATRIX *matrix)
{
#ifdef _XBOX1
D3DDevice_SetTransform(state, matrix);
#elif !defined(_XBOX360)
/* XBox 360 D3D9 does not support fixed-function pipeline. */
dev->SetTransform(state, matrix);
#endif
}
示例14: d3d_set_viewports
void d3d_set_viewports(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp)
{
#if defined(_XBOX360)
D3DDevice_SetViewport(dev, vp);
#elif defined(_XBOX1)
D3DDevice_SetViewport(vp);
#else
dev->SetViewport(vp);
#endif
}
示例15: d3d_vertex_declaration_new
bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev,
const void *vertex_data, void **decl_data)
{
#ifndef _XBOX1
const D3DVERTEXELEMENT *vertex_elements = (const D3DVERTEXELEMENT*)vertex_data;
LPDIRECT3DVERTEXDECLARATION **vertex_decl = (LPDIRECT3DVERTEXDECLARATION**)decl_data;
if (SUCCEEDED(dev->CreateVertexDeclaration(vertex_elements, (IDirect3DVertexDeclaration9**)vertex_decl)))
return true;
#endif
return false;
}