1 |
bearsoft |
1.1 |
///////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
|
4 |
|
|
//
|
5 |
|
|
// File: d3dxshapes.h
|
6 |
|
|
// Content: D3DX simple shapes
|
7 |
|
|
//
|
8 |
|
|
///////////////////////////////////////////////////////////////////////////
|
9 |
|
|
|
10 |
|
|
#ifndef __D3DXSHAPES_H__
|
11 |
|
|
#define __D3DXSHAPES_H__
|
12 |
|
|
|
13 |
|
|
#include <d3d.h>
|
14 |
|
|
#include <limits.h>
|
15 |
|
|
#include "d3dxerr.h"
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
typedef struct ID3DXSimpleShape *LPD3DXSIMPLESHAPE;
|
19 |
|
|
|
20 |
|
|
// {CFCD4602-EB7B-11d2-A440-00A0C90629A8}
|
21 |
|
|
DEFINE_GUID( IID_ID3DXSimpleShape,
|
22 |
|
|
0xcfcd4602, 0xeb7b, 0x11d2, 0xa4, 0x40, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8 );
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
///////////////////////////////////////////////////////////////////////////
|
26 |
|
|
// Interfaces:
|
27 |
|
|
///////////////////////////////////////////////////////////////////////////
|
28 |
|
|
|
29 |
|
|
//-------------------------------------------------------------------------
|
30 |
|
|
// ID3DXSimpleShape interface:
|
31 |
|
|
//-------------------------------------------------------------------------
|
32 |
|
|
|
33 |
|
|
DECLARE_INTERFACE_(ID3DXSimpleShape, IUnknown)
|
34 |
|
|
{
|
35 |
|
|
// IUnknown methods
|
36 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* ppvObj) PURE;
|
37 |
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
38 |
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
39 |
|
|
|
40 |
|
|
// ID3DXSimpleShape methods
|
41 |
|
|
STDMETHOD_(LPDIRECT3DVERTEXBUFFER7, GetVB)(THIS) PURE;
|
42 |
|
|
STDMETHOD_(DWORD, GetIndices)(THIS_ LPWORD *ppIndices) PURE;
|
43 |
|
|
STDMETHOD(Draw)(THIS) PURE;
|
44 |
|
|
};
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
///////////////////////////////////////////////////////////////////////////
|
49 |
|
|
// Functions:
|
50 |
|
|
///////////////////////////////////////////////////////////////////////////
|
51 |
|
|
|
52 |
|
|
#ifdef __cplusplus
|
53 |
|
|
extern "C" {
|
54 |
|
|
#endif //__cplusplus
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
//-------------------------------------------------------------------------
|
58 |
|
|
// D3DXCreatePolygon: Creates an 'n' sided polygon using the device
|
59 |
|
|
// ---------------- specified. It returns a vertex buffer that can be used
|
60 |
|
|
// for drawing or manipulation by the program later on.
|
61 |
|
|
//
|
62 |
|
|
// Params:
|
63 |
|
|
// [in] LPDIRECT3DDEVICE7 pDevice: The device to create off.
|
64 |
|
|
// [in] float sideSize: Length of a side.
|
65 |
|
|
// [in] DWORD numTexCoords: The number of texture coordinates desired
|
66 |
|
|
// in the vertex-buffer. (Default is 1)
|
67 |
|
|
// D3DX_DEFAULT is a valid input.
|
68 |
|
|
// [out] IDirect3DVertexBuffer7** ppVB: The output shape interface.
|
69 |
|
|
//-------------------------------------------------------------------------
|
70 |
|
|
HRESULT WINAPI
|
71 |
|
|
D3DXCreatePolygon(LPDIRECT3DDEVICE7 pDevice,
|
72 |
|
|
float sideSize,
|
73 |
|
|
DWORD numSides,
|
74 |
|
|
DWORD numTexCoords,
|
75 |
|
|
LPD3DXSIMPLESHAPE* ppShape );
|
76 |
|
|
|
77 |
|
|
//-------------------------------------------------------------------------
|
78 |
|
|
// D3DXCreateBox: Creates a box (cuboid) of given dimensions using the
|
79 |
|
|
// ------------ device. It returns a vertex buffer that can
|
80 |
|
|
// be used for drawing or manipulation by the program later on.
|
81 |
|
|
//
|
82 |
|
|
// Params:
|
83 |
|
|
// [in] LPDIRECT3DDEVICE7 pDevice: The device to create off.
|
84 |
|
|
// [in] float width: Width of the box (along x-axis)
|
85 |
|
|
// [in] float height: Height of the box (along y-axis)
|
86 |
|
|
// [in] float depth: Depth of the box (along z-axis)
|
87 |
|
|
// [in] DWORD numTexCoords: The number of texture coordinates desired
|
88 |
|
|
// in the vertex-buffer. Default is 1.
|
89 |
|
|
// D3DX_DEFAULT is a valid input here.
|
90 |
|
|
// [out] LPD3DXSIMPLESHAPE* ppShape: The output vertex-buffer.
|
91 |
|
|
//-------------------------------------------------------------------------
|
92 |
|
|
HRESULT WINAPI
|
93 |
|
|
D3DXCreateBox(LPDIRECT3DDEVICE7 pDevice,
|
94 |
|
|
float width,
|
95 |
|
|
float height,
|
96 |
|
|
float depth,
|
97 |
|
|
DWORD numTexCoords,
|
98 |
|
|
LPD3DXSIMPLESHAPE* ppShape );
|
99 |
|
|
|
100 |
|
|
//-------------------------------------------------------------------------
|
101 |
|
|
// D3DXCreateCylinder: Creates a cylinder of given dimensions using the
|
102 |
|
|
// ----------------- device. It returns a vertex buffer that
|
103 |
|
|
// can be used for drawing or manipulation by the program
|
104 |
|
|
// later on.
|
105 |
|
|
//
|
106 |
|
|
// Params:
|
107 |
|
|
// [in] LPDIRECT3DDEVICE7 pDevice: The device to create off.
|
108 |
|
|
// [in] float baseRadius: Base-radius (default is 1.0f, shd be >= 0.0f)
|
109 |
|
|
// [in] float topRadius: Top-radius (default is 1.0f, shd be >= 0.0f)
|
110 |
|
|
// [in] float height: Height (default is 1.0f, shd be >= 0.0f)
|
111 |
|
|
// [in] DWORD numSlices: Number of slices about the main axis.
|
112 |
|
|
// (default is 8) D3DX_DEFAULT is a valid input.
|
113 |
|
|
// [in] DWORD numStacks: Number of stacks along the main axis.
|
114 |
|
|
// (default is 8) D3DX_DEFAULT is a valid input.
|
115 |
|
|
// [in] DWORD numTexCoords: The number of texture coordinates desired
|
116 |
|
|
// in the vertex-buffer. Default is 1.
|
117 |
|
|
// D3DX_DEFAULT is a valid input here.
|
118 |
|
|
// [out] LPD3DXSIMPLESHAPE* ppShape: The output shape interface.
|
119 |
|
|
//-------------------------------------------------------------------------
|
120 |
|
|
HRESULT WINAPI
|
121 |
|
|
D3DXCreateCylinder(LPDIRECT3DDEVICE7 pDevice,
|
122 |
|
|
float baseRadius,
|
123 |
|
|
float topRadius,
|
124 |
|
|
float height,
|
125 |
|
|
DWORD numSlices,
|
126 |
|
|
DWORD numStacks,
|
127 |
|
|
DWORD numTexCoords,
|
128 |
|
|
LPD3DXSIMPLESHAPE* ppShape );
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
//-------------------------------------------------------------------------
|
132 |
|
|
// D3DXCreateTorus: Creates a torus of given dimensions using the
|
133 |
|
|
// -------------- device specified. It returns a vertex buffer that can
|
134 |
|
|
// be used for drawing or manipulation by the program later
|
135 |
|
|
// on. It draws a doughnut, centered at (0, 0, 0) whose axis
|
136 |
|
|
// is aligned with the z-axis. With the innerRadius used
|
137 |
|
|
// as the radius of the cross-section (minor-Radius) and
|
138 |
|
|
// the outerRadius used as the radius of the central 'hole'.
|
139 |
|
|
//
|
140 |
|
|
// Params:
|
141 |
|
|
// [in] LPDIRECT3DDEVICE7 pDevice: The device to create off.
|
142 |
|
|
// [in] float innerRadius: inner radius (default is 1.0f, shd be >= 0.0f)
|
143 |
|
|
// [in] float outerRadius: outer radius (default is 2.0f, shd be >= 0.0f)
|
144 |
|
|
// [in] DWORD numSides: Number of sides in the cross-section
|
145 |
|
|
// (default is 8). D3DX_DEFAULT is a valid input.
|
146 |
|
|
// [in] DWORD numRings: Number of rings making up the torus
|
147 |
|
|
// (default is 8) D3DX_DEFAULT is a valid input.
|
148 |
|
|
// [in] DWORD numTexCoords: The number of texture coordinates desired
|
149 |
|
|
// in the vertex-buffer. Default is 1.
|
150 |
|
|
// D3DX_DEFAULT is a valid input here.
|
151 |
|
|
// [out] LPD3DXSIMPLESHAPE* ppShape: The output shape interface.
|
152 |
|
|
//-------------------------------------------------------------------------
|
153 |
|
|
HRESULT WINAPI
|
154 |
|
|
D3DXCreateTorus(LPDIRECT3DDEVICE7 pDevice,
|
155 |
|
|
float innerRadius,
|
156 |
|
|
float outerRadius,
|
157 |
|
|
DWORD numSides,
|
158 |
|
|
DWORD numRings,
|
159 |
|
|
DWORD numTexCoords,
|
160 |
|
|
LPD3DXSIMPLESHAPE* ppShape );
|
161 |
|
|
|
162 |
|
|
//-------------------------------------------------------------------------
|
163 |
|
|
// D3DXCreateTeapot: Creates a teapot using the device specified.
|
164 |
|
|
// ---------------- It returns a vertex buffer that can be used for
|
165 |
|
|
// drawing or manipulation by the program later on.
|
166 |
|
|
//
|
167 |
|
|
// Params:
|
168 |
|
|
// [in] LPDIRECT3DDEVICE7 pDevice: The device to create off.
|
169 |
|
|
// [in] DWORD numTexCoords: The number of texture coordinates desired
|
170 |
|
|
// in the vertex-buffer. Default is 1.
|
171 |
|
|
// D3DX_DEFAULT is a valid input here.
|
172 |
|
|
// [out] LPD3DXSIMPLESHAPE* ppShape: The output shape interface.
|
173 |
|
|
//-------------------------------------------------------------------------
|
174 |
|
|
HRESULT WINAPI
|
175 |
|
|
D3DXCreateTeapot(LPDIRECT3DDEVICE7 pDevice,
|
176 |
|
|
DWORD numTexCoords,
|
177 |
|
|
LPD3DXSIMPLESHAPE* ppShape);
|
178 |
|
|
|
179 |
|
|
//-------------------------------------------------------------------------
|
180 |
|
|
// D3DXCreateSphere: Creates a cylinder of given dimensions using the
|
181 |
|
|
// ---------------- device specified.
|
182 |
|
|
// It returns a vertex buffer that can be used for
|
183 |
|
|
// drawing or manipulation by the program later on.
|
184 |
|
|
//
|
185 |
|
|
// Params:
|
186 |
|
|
// [in] LPDIRECT3DDEVICE7 pDevice: The device to create off.
|
187 |
|
|
// [in] float radius: radius (default is 1.0f, shd be >= 0.0f)
|
188 |
|
|
// [in] float height: Height (default is 1.0f, shd be >= 0.0f)
|
189 |
|
|
// [in] DWORD numSlices: Number of slices about the main axis
|
190 |
|
|
// (default is 8) D3DX_DEFAULT is a valid input.
|
191 |
|
|
// [in] DWORD numStacks: Number of stacks along the main axis
|
192 |
|
|
// (default is 8) D3DX_DEFAULT is a valid input.
|
193 |
|
|
// [in] DWORD numTexCoords: The number of texture coordinates desired
|
194 |
|
|
// in the vertex-buffer. Default is 1.
|
195 |
|
|
// D3DX_DEFAULT is a valid input here.
|
196 |
|
|
// [out] LPD3DXSIMPLESHAPE* ppShape: The output shape interface.
|
197 |
|
|
//-------------------------------------------------------------------------
|
198 |
|
|
HRESULT WINAPI
|
199 |
|
|
D3DXCreateSphere(LPDIRECT3DDEVICE7 pDevice,
|
200 |
|
|
float radius,
|
201 |
|
|
DWORD numSlices,
|
202 |
|
|
DWORD numStacks,
|
203 |
|
|
DWORD numTexCoords,
|
204 |
|
|
LPD3DXSIMPLESHAPE* ppShape);
|
205 |
|
|
|
206 |
|
|
#ifdef __cplusplus
|
207 |
|
|
}
|
208 |
|
|
#endif //__cplusplus
|
209 |
|
|
#endif //__D3DXSHAPES_H__
|