108 lines
2.9 KiB
C++
108 lines
2.9 KiB
C++
#ifndef _DDRAW_DIRECTDEVICE3D_HPP_
|
|
#define _DDRAW_DIRECTDEVICE3D_HPP_
|
|
#ifndef _COMMON_SMARTPOINTER_HPP_
|
|
#include <common/pointer.hpp>
|
|
#endif
|
|
#ifndef _DDRAW_DDRAW_HPP_
|
|
#include <ddraw/ddraw.hpp>
|
|
#endif
|
|
|
|
class Matrix;
|
|
|
|
class DirectDevice3D : public SmartPointer<IDirect3DDevice3>
|
|
{
|
|
public:
|
|
enum DrawPrimitiveFlags{DoNotClip=D3DDP_DONOTCLIP,DoNotLight=D3DDP_DONOTLIGHT,
|
|
DoNotUpdateExtents=D3DDP_DONOTUPDATEEXTENTS,WaitUntilRendered=D3DDP_WAIT};
|
|
enum TransformStateTypeFlags{World=D3DTRANSFORMSTATE_WORLD,View=D3DTRANSFORMSTATE_VIEW,
|
|
Projection=D3DTRANSFORMSTATE_PROJECTION,ForceDoubleWord=D3DTRANSFORMSTATE_FORCE_DWORD};
|
|
DirectDevice3D(void);
|
|
virtual ~DirectDevice3D();
|
|
DirectDevice3D &operator=(IDirect3DDevice3 *pIDirect3DDevice3);
|
|
BOOL setRenderState(D3DRENDERSTATETYPE renderStateType,DWORD renderState);
|
|
BOOL drawPrimitve(D3DPRIMITIVETYPE primitiveType,DWORD vertexTypeDesc,LPVOID pVertices,DWORD vertexCount,DrawPrimitiveFlags primitiveFlags=WaitUntilRendered);
|
|
BOOL setTransform(TransformStateTypeFlags transformType,Matrix &matrix);
|
|
BOOL beginScene(void);
|
|
BOOL endScene(void);
|
|
void destroy(void);
|
|
private:
|
|
DirectDevice3D(const DirectDevice3D &someDirectDevice3D);
|
|
DirectDevice3D &operator=(const DirectDevice3D &someDirectDevice3D);
|
|
};
|
|
|
|
inline
|
|
DirectDevice3D::DirectDevice3D(void)
|
|
{
|
|
}
|
|
|
|
inline
|
|
DirectDevice3D::~DirectDevice3D()
|
|
{
|
|
destroy();
|
|
}
|
|
|
|
inline
|
|
void DirectDevice3D::destroy(void)
|
|
{
|
|
if(!isOkay())return;
|
|
operator->()->Release();
|
|
SmartPointer<IDirect3DDevice3>::destroy();
|
|
}
|
|
|
|
inline
|
|
DirectDevice3D::DirectDevice3D(const DirectDevice3D &someDirectDevice3D)
|
|
{ // private implementation
|
|
*this=someDirectDevice3D;
|
|
}
|
|
|
|
inline
|
|
DirectDevice3D &DirectDevice3D::operator=(const DirectDevice3D &/*someDevice3D*/)
|
|
{ // private implementation
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
DirectDevice3D &DirectDevice3D::operator=(IDirect3DDevice3 *pIDirect3DDevice3)
|
|
{
|
|
destroy();
|
|
SmartPointer<IDirect3DDevice3>::operator=(pIDirect3DDevice3);
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
BOOL DirectDevice3D::setRenderState(D3DRENDERSTATETYPE renderStateType,DWORD renderState)
|
|
{
|
|
if(!isOkay())return FALSE;
|
|
return D3D_OK==operator->()->SetRenderState(renderStateType,renderState);
|
|
}
|
|
|
|
inline
|
|
BOOL DirectDevice3D::drawPrimitve(D3DPRIMITIVETYPE primitiveType,DWORD vertexTypeDesc,LPVOID pVertices,DWORD vertexCount,DrawPrimitiveFlags primitiveFlags)
|
|
{
|
|
if(!isOkay())return FALSE;
|
|
return D3D_OK==operator->()->DrawPrimitive(primitiveType,vertexTypeDesc,pVertices,vertexCount,primitiveFlags);
|
|
}
|
|
|
|
inline
|
|
BOOL DirectDevice3D::setTransform(TransformStateTypeFlags transformType,Matrix &matrix)
|
|
{
|
|
if(!isOkay())return FALSE;
|
|
return D3D_OK==operator->()->SetTransform(D3DTRANSFORMSTATETYPE(transformType),(D3DMATRIX*)&matrix);
|
|
}
|
|
|
|
inline
|
|
BOOL DirectDevice3D::beginScene(void)
|
|
{
|
|
if(!isOkay())return FALSE;
|
|
return D3D_OK==operator->()->BeginScene();
|
|
}
|
|
|
|
inline
|
|
BOOL DirectDevice3D::endScene(void)
|
|
{
|
|
if(!isOkay())return FALSE;
|
|
return D3D_OK==operator->()->EndScene();
|
|
}
|
|
#endif
|
|
|