Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Cutting Edge Direct 3D Programming
(Publisher: The Coriolis Group)
Author(s): Stan Trujillo
ISBN: 1576100502
Publication Date: 11/01/96

Bookmark It

Search this book:
 
Table of Contents


Index

A

Absolute values
specifying, 140
Ambient light, 190–202
adding to a scene, 75
defined, 42
demo, 191–202
AmbientLightWin class, 194–195
AmbientLightWin::CreateScene function, 196–200
render functions, 201–202
AmbientLightWin class, 194–195
class definition, 194–195
CreateScene function, 195–200
creating and loading a mesh, 197
creating the frame, 197–198
creating the light source, 198–199
creating the viewport, 199–200
render functions, 200–202
Animation, 77, 279–289
3D, 49
assigning motion attributes, 49
key-framing, 49–50
animating textures, 41–42
constructing animation sequences based on keys, 78
removing keys, 78
controlling animation sets, 80
controlling in a scene, 58
key-framing, 266
Rocket demo, 267–278
morphing, 318–340
MorphPlay demo, 319–340
options, 78
setting, 79
setting time in, 78
Target demo, 279–289
vertex, 294–307
Cube demo, 294–307
Applications
full-screen, 397
defined, 399
FullScreen demo, 429
windowed
defined, 399–400
AppWizard
creating an MFC application, 10–12
creating projects with, 9
defined, 9, 89
Direct3D custom AppWizard, 15–19
overall structure of AppWizard programs, 89–126
writing custom AppWizards, 15
ASSERT macro
defined, 98
Axis
defined, 23
scaling objects on a local axis, 34–36

C

C++
MFC
creating an application with AppWizard, 10–12
defined, 5
message map, 7, 8
modifying an application with ClassWizard, 12–14
strong type checking, 19, 20
using C++ classes to manage Direct3D interfaces, 93–94
Callback functions
adjusting an object’s rotation, 248
animating a scene, 234–235
animating a texture, 176–178
calculating rotation attributes during a drap operation, 375–376
controlling a viewport’s field-of-view, 352–353
defined, 64, 121
installing a texture, 185–186
orienting one frame according to the movement of another frame, 288–289
performing color animation, 316–317
performing vertex animation and mesh rotation, 303–306, 314–316
relocating meshes during a drag operation, 364–365
updating a morph sequence, 336–337
updating a scene, 121–123, 169–170, 276
updating an animation sequence, 288
Classes
AmbientLightWin
CreateScene function, 195–200
render functions, 200–202
class hierarchy explained, 93
Cube2Win
class definition, 309
CreateScene function, 310–313
render functions, 317–318
UpdateColors callback function, 316–317
UpdateCube callback function, 314–316
CubeWin
class definition, 295
CreateScene function, 296–303
render functions, 306–307
UpdateCube callback function, 303–306
DecalWin
class definition, 157–158
CreateScene function, 158–161
designing, 93–94
FacePickWin
class definition, 366–367
color functions, 376–377
CreateScene function, 368–371
file functions, 377–380
mouse functions, 371–373
PickFace function, 373–374
UpdateDrag callback function, 375–376
FireflyWin
class definition, 204
CreateScene function, 204–209
FullScreenWin
class definition, 430–431
CreateFPSSurface function, 440–441
CreateMenuSurface function, 437
CreateScene function, 434–437
FullScreenWin function, 433–434
KeyDown function, 445–447
Render function, 442–445
UpdateFPSSurface function, 441–442
UpdateMenuSurface function, 438–440
JadeWin
class definition, 133–134
CreateScene function, 134–143
MoveFrame function, 143–144
render functions, 144–145
MeshPickWin
class definition, 356
CreateScene function, 357–361
creating multiple meshes with frames, 359–360
creating the light source, 360–361
installing a callback function, 360
loading the mesh, 359
mouse functions, 361–364
UpdateDrag callback function, 364–365
MoleculeWin class
children functions, 265
class definition, 257
CreateChildren function, 262–264
CreateHierarchy function, 262
CreateScene function, 258–261
depth functions, 264–265
MorphPlayWin
class definition, 331–333
CreateScene function, 333–334
InitMorphSequence function, 335–336
mouse functions, 337–340
OnFileOpen function, 334–335
UpdateMorph callback function, 336–337
MorphWin class
AddMorphKey function, 330
class definition, 322–323
CreateAnimations function, 328–329
GetMorphMesh function, 331
GetNumMorphTargets function, 329
LoadMeshes function, 325–327
LoadMorphSequence function, 324–325
PrepareMorphVertices function, 329
SetMorphTime function, 330–331
MultiViewWin class
class definition, 381
CreateScene function, 382
OrbStarWin
callback functions, 169–170
CreateScene function, 163–169
RMWin
background, 93–94
constructing scenes, 108–115
helper functions 124–125
maintaining scenes, 115–123
object creation functions, 98–108
shutting down, 123–124
RMWin(modified for full-screen apps)
adding display mode support, 406
class definition, 404–405
member functions, 407
palette support, 407
removing obsolete functions, 405–406
surface support, 407
RMWin (modified for multiple views), 384–386
ConfigViewport function, 390–391
CreateDevice function, 386–389
CreateViewport function, 391
class definition, 384–385
OnSize function, 393–394
Render function, 391–393
viewport functions, 394–395
RocketWin
animation functions, 276,–278
class definition, 268
CreateScene function, 269–270
creating a frame for the rocket mesh, 275
creating the animation sequence, 272–274, 275
creating the rocket mesh, 271–272
source code, 269–270
speed functions, 278
UpdateScene callback function, 276
ShadowWin
AdjustSpin callback function, 248
class definition, 239–240
CreateScene function, 240–248
creating a frame for the floor mesh, 245
creating a frame for the fork mesh, 245–246
creating a point light source, 246–247
creating an ambient light source, 246
creating and applying the floor mesh texture wrap, 244–245
creating the floor mesh texture, 244
creating the fork mesh, 245
creating the mesh to represent the floor, 243–244
creating the shadow object, 247
creating the viewport, 247–248
render functions, 248–249
ShowRoom
CreateScene function, 180–185
SpaceDonutWin
class definition, 218
CreateScene function, 219–225
applying the texture to the mesh, 223
creating and attaching the frame, 223–224
creating and loading the frosting texture, 222
creating the donut mesh, 221–222
creating the light source and its frame, 224–225
creating the viewport, 225
SpaceStationWin, 211
class definition, 211
CreateScene function, 211–217
SpotlightWin
beam functions, 237–238
class definition, 228–229
CreateScene function, 229–234
creating a frame for the light source, 233–234
creating a viewport, 234
creating and positioning a frame for the meshes, 232,–233
creating the light source, 233
intializing the pointers, 232
loading the spherical mesh, 231–232
source code, 229–231
MoveLight callback function, 234–235
render functions, 235–237
TargetWin
class definition, 280
callback functions, 288
CreateScene function, 281–288
creating multiple frames for the missile mesh, 287–288
creating the animation sequence, 284–285
creating the frame for the target mesh, 286
creating the missile mesh, 287
loading the target mesh, 284
MoveTarget callback function, 288
OrientFrame callback function, 288–289
TextureDriftWin
class definition, 173
callback functions, 177, 178
CreateScene function, 173–176
WrapsWin
class definition, 147–148
CreateScene function, 148–149
ZoomWin
AdjustField callback function, 352–353
animation functions, 353–354
class definition, 345–346
CreateScene function, 347–352
ClassWizard
adding event handlers, 12–14
defined, 8–9
illustrated, 8
modifying an MFC application, 12–14
modifying event handlers, 8–9
sample code, 9
Color
adjusting specular light color on faces and meshes, 74
applying color to a mesh, 376–377
assigning color to faces and meshes with normals, 30–31
assigning to the faces in a mesh, 66
color models, 59
emitting light, 75
how they affect light sources, 190
controlling the colors used to render scenes, 59
controlling the number of colors used to represent a texture, 72
conversion functions, 125–126
defining light source colors, 42
enabling and disabling dithering, 59–60
inspecting and changing the color of a face, 70
COM
analyzing interface dependencies, 91–92
defined, 54–55
Iunknown object, 55
member functions, 55
object/interface relationship, 54–55
rules for using, 55
CONV3DS utility, 84
options, 85
Coordinate system (3D)
axes, 23
left-handed, 23–24
origin, 25
planes, 27–28
right-handed, 23–24
vectors, 25–26
Cube demo, 294–307
CreateScene function
applying a texture to the cube mesh, 301–302
creating a cube mesh, 297
creating a frame for the cube mesh, 302
initializing the cube mesh, 298–301
installing a callback function, 302–303
CubeWin class, 295–296
class definition, 295
CreateScene function, 296–303
render functions, 306–307
UpdateCube callback function, 303–306
illustrated, 294
overview, 294–295
techniques demonstrated, 295
Cube2 demo, 308–318
CreateScene function
creating a frame for the mesh, 313
creating a mesh composed of two groups, 312
creating and applying a texture for the mesh, 313
initializing the callback functions, 313–314
illustrated, 308
overview, 308–309
techniques demonstrated, 309
Cube2Win class, 309
CreateScene function, 310–313
creating a frame for the mesh, 313
creating a mesh composed of two groups, 312
creating and applying a texture for the mesh, 313
initializing the callback functions, 313–314
source code, 310–311
class definition, 309
render functions, 317–318
UpdateColors callback function, 316–317
UpdateCube callback function, 314–316
CubeWin class, 295–296
class definition, 295
CreateScene function, 296–303
applying a texture to the cube mesh, 301–302
creating a frame for the cube mesh, 302
creating the cube mesh, 298
initializing the cube mesh, 298–301
installing a callback function, 302–303
source code, 296–297
render functions, 306–307
UpdateCube callback function, 303–306

D

Data types, 80–84
D3DCOLOR, 81–82
D3DRMBOX, 82
D3DRMQUATERNION, 83–84
D3DRMVERTEX, 82–83
D3DVALUE, 80–81
D3DVECTOR, 81
HRESULT, 84
Decal demo, 156–161
CreateScene function
creating textures for decals, 160
creating the frames, 160–161
DecalWin class
class definition, 157–158
CreateScene function, 158–161
dummy frame, 157
illustrated, 157
overview, 156–157
techniques demonstrated, 156
Decals
Decal demo, 156–161
defined, 72, 156
manipulating, 73
functions for, 73
DecalWin class, 157–158
class definition, 157–158
CreateScene function, 158
creating textures for decals, 160
creating the frames, 160–161
Demos
AmbientLight, 191–202
Cube, 294–307
Cube2, 308–18
Decal, 156–161
FacePick, 365–380
Firefly, 202–209
FullScreen, 429–446
Jade, 131–145
MeshPick, 355–365
Molecule, 255–265
MorphPlay, 319–340
MultiView, 380–395
OrbStar, 162–170
Rocket, 267–278
Shadow, 238–249
ShowRoom, 178–186
SpaceDonut, 217–225
SpaceStation, 210–217
Spotlight, 227–238
Target, 279–289
TextureDrift, 171–179
Wraps, 146–156
Zoom, 344–354
Dependency trees
application-specific interfaces, 92
creating, 92
defined, 91
standard interfaces, 92
Developer Studio
AppWizard, 9
ClassWizard, 8–9
creating an MFC application with AppWizard, 10–12
defined, 4
illustrated, 4
modifying an MFC application with ClassWizard, 12–14
writing custom AppWizards, 15
Devices
color models
Ramp, 59
RGB, 59
creating with the Direct3DRMDevice interface, 58– 60
functions, 58–60
creating with the Direct3DWinDevice interface, 60–61
modifying rendering options, 59
controlling the colors used to render scenes, 59
enabling and disabling dithering, 59–60
specifying the rendering mode, 59
Direct3D
3D graphics, 21–50
ambient light, 43
AppWizard, 89
creating a sample application, 90
COM interface dependencies, 90–92
illustrated, 91
creating devices, 58–59
defined, 53
Direct3DRM interface, 56
controlling program pace, 58
creating, 56
creating Direct3D objects, 56–57
device creation member functions, 58–59
modifying Direct3D’s search path, 57–58
object creation member functions, 56–57
rendering member functions, 59
search path member functions, 57
Direct3DRMAnimation interface, 77–79
animation member functions, 78
constructing animation sequences, 78
controlling animation sets, 80
key creation member functions, 78
setting animation options, 79
time set member functions, 78
Direct3DRMAnimationSet interface
creation member function, 80
set loading member functions, 80
time set member function, 80
Direct3DRMDevice interface, 58–60
controlling the colors used to render scenes, 59
creating a device, 58–59
enabling and disabling dithering, 59
specifying the rendering mode, 59
Direct3DRMFace interface, 69–71
color member functions, 70
face access member function, 69
face texture member functions, 70
material member functions, 70
setting face attributes, 69–71
vertex access member functions, 70
Direct3DRMFrame interface, 62– 64
creating a frame, 62–63
frame hierarchies member functions, 62
frame movement member functions, 64
frame positioning member functions, 63–64
move callback member functions, 64
moving a frame, 64
positioning a frame, 63–64
using move callbacks, 64
Direct3DRMLight interface, 75–76
adding light to scenes, 75–76
attaching light member function, 75
creation member functions, 75
setting location and orientation of lights, 75–76
Direct3DRMMaterial interface, 74
creation member function, 74
determining the behavior of light on faces and meshes, 74
emissive light color member functions, 74
specular light color member functions, 74
specular light power member functions, 74
Direct3DRMMesh interface, 68–69
creation member function, 68
manipulating mesh groups, 68–69
manipulating vertex positions, 69
mesh group member functions, 68
scale and translate member functions, 69
vertex access member functions, 69
Direct3DRMMeshBuilder interface, 64–67
creation member function, 65
face access member functions, 67
loading and saving member functions, 65
manipulating meshes, 64–67
rendering member functions, 65–66
translate and scale member functions, 67
vertex access member functions, 67
Direct3DRMShadow interface, 77
adding shadows to scenes, 77
creation member function, 77
Direct3DRMTexture interface, 71–73
applying textures to faces and meshes, 71–73
controlling wrap style, 73
creating textures, 71
decal manipulation member functions, 73
texture color member functions, 72
texture creation member functions, 71
Direct3DRMTextureWrap interface, 73
creation member function, 73
Direct3DRMViewport interface, 61–62
clipping member functions, 62
controlling clipping, 62
CreateDevice member function, 61
creating a viewport, 61
SetField member function, 61
the field-of-view, 61
Direct3DWinDevice interface, 60–61
functions supported, 61
member functions, 60–61
directional light, 43
faces, 29
defined, 29–30
illustrated, 30
initializing, 95–108
functions involved, 96–108
introduction to, 51–85
key-framing
linear-based, 50
spline, 50
parallel light, 43
point light, 43
Retained Mode, 56
spotlight, 43
working with theDirect3D custom AppWizard, 15–19
completed project illustrated, 19
Z-buffering, 45
pros and cons, 45
DirectDraw, 400–402
cooperative levels, 400–401
defined, 400
display modes, 401
interface, 400
page flipping, 401
palettes, 402
surfaces, 401
using existing DirectDraw surfaces as textures, 71
Z-buffering, 402
Directional light, 209–217
adding to a scene, 76
defined, 43
SpaceStation demo, 210–217
DOOM, 37
DOS programming
compared to Windows programming, 5

E

Event handler
adding to a project with ClassWizard, 12–14
defined, 6–7
modifying with ClassWizard, 8–9
sample code, 6
switch statement, 6–7
Event-driven programming
defined, 5
event, 5
event handler, 6–7
message, 5

F

FacePick demo, 365–80
CreateScene function, 368–371
creating a frame for the mesh, 370
creating a mesh, 369–370
creating the light sources, 370–371
illustrated, 366
overview, 365–366
techniques demonstrated, 365–366
FacePickWin class, 366–368
class definition, 366–367
color functions, 376–377
CreateScene function, 368–371
creating a frame for the mesh, 370
creating a mesh, 369–370
creating the light sources, 370–371
source code, 368–369
file functions, 377,–380
mouse functions, 371–373
PickFace function, 373–374
UpdateDrag callback function, 375–376
Faces
adjusting emissive light, 74
adjusting specular light color, 74
adjusting specular light power, 74
applying color to, 376–377
applying materials, 70
applying texture, 70
functions for, 70
calculating color with normals, 30–32
defined, 29–30
illustrated, 30
inspecting and changing color, 70
manipulating vertices, 70
functions for, 70
modifying with meshbuilders, 66–67
picking, 365–380
FacePick demo, 365–380
texture mapping, 37–38
Field-of-view, 343–354
using the AdjustField callback function to control a viewport’s field-of-view, 352–353
Zoom demo, 344–354
Field-of-view (FOV), 61
Firefly demo, 202–209
CreateScene function
creating the point light, 207
creating and loading the chalice mesh, 206–207
creating the frame, 207
creating the frames to animate the spherical mesh and the light source, 208–209
creating the mesh to represent the firefly, 208
FireflyWin class, 203–204
class definition, 204
CreateScene function, 204–209
creating and loading the chalice mesh, 206–207
creating the frame, 207
creating the frames to animate the spherical mesh and the light source, 208–209
creating the mesh to represent the firefly, 208
creating the point light, 207
Flat rendering
illustrated, 47
Flat shading
defined, 46–47
Frame
creating, 62–63
defined, 62
dummy frame, 157
hierarchies, 62–63, 254–265
frame-of-reference characteristic, 62–63
illustrated, 254–255
Molecule demo, 255–265
positioning, 63
functions for, 63
Frame hierarchies, 254–265
creating, 261–265
defined, 62
illustrated, 254–255
Molecule demo, 255–265
Full-screen applications, 397
defined, 399–400
FullScreen demo, 429
FullScreen demo, 429
illustrated, 429
overview, 429–430
techniques demonstrated, 430
FullScreenWin class, 430–433
CreateFPSSurface function, 440–441
CreateMenuSurface function, 437
CreateScene function, 434–437
initializing the display mode and FPS read-out surfaces, 436–437
class definition, 430–431
FullScreenWin function, 433–434
KeyDown function, 445–447
Render function, 442–445
UpdateFPSSurface function, 441–442
UpdateMenuSurface function, 438–440
Functions
callbacks
adjusting an object’s rotation, 248
animating a scene, 234–235
animating a texture, 176–178
calculating rotation attributes during a drap operation, 375–376
controlling a viewport’s field-of-view, 352–353
defined, 64, 121
installing a texture, 185–186
orienting one frame according to the movement of another frame, 288–289
performing color animation, 316–317
performing vertex animation and mesh rotation, 303–306, 314–316
relocating meshes during a drag operation, 364–365
updating a morph sequence, 336–337
updating a scene, 121–123, 169–170, 276
updating an animation sequence, 288
color conversion functions, 125–126
event handler, 6–7

G

Gouraud shading
defined, 47–48
illustrated, 48
Graphics (3D), 21–50
animating, 49
assigning motion attributes, 49
key-framing, 49–50
calculating color with normals, 30–32
coordinate systems, 23–24
axes, 23
origin, 25
planes, 27–28
vectors, 25–26
defined, 23
faces, 29
illustrated, 30
hidden surface removal techniques, 45
Z-buffering, 45
lighting, 42
ambient light, 42
defining light source color, 42
directional light, 43
light sources, 42
parallel light, 43
point light, 43
spot light, 43
meshes, 30
illustrated, 30
moving an object, 33–34
perspective transformation, 43, 44
producing a 2D version of a 3D scene, 44
rendering (shading) methods, 46
flat, 46–47
Gouraud, 47–48
Phong, 48
ray-tracing, 48
unlit, 46
wireframe, 46
texture, 38
defined, 38
texture animation, 41–42
texture mapping, 37–38
defined, 37–38
texture scaling, 39
texture wrapping, 40–41
translations, 32
rotate, 32–37
scale, 32–36
translate, 32
translate (move), 33–34
vertices, 28–29
working with a viewing frustum, 44

H

Helper functions, 124–125
GetMouse, 125
ScaleMesh, 124–125
HRESULT data type, 84
Hungarian notation
in windows programming, 19

I

Initializing Direct3D, 95–108
functions involved, 96–108
Interfaces
application-specific, 92
COM interface dependencies, 90–92
illustrated, 91
Direct3DRM, 56–58
controlling program pace, 58
creating, 56
creating Direct3D objects, 56–57
device creation member functions, 58–59
modifying Direct3D’s search path, 57
object creation member functions, 56–57
rendering member functions, 59
search path member functions, 57
Direct3DRMAnimation, 77–79
animation member functions, 78
constructing animation sequences, 78
controlling animation sets, 80
key creation member functions, 78
setting animation options, 79
time set member functions, 78
Direct3DRMAnimationSet, 79–80
creating, 80
creation member function, 80
set loading member functions, 80
time set member function, 80
Direct3DRMDevice, 58–60
Direct3DRMFace, 69–71
color member functions, 70
face access member function, 69
face texture member functions, 70
material member functions, 70
setting face attributes, 69–71
vertex access member functions, 70
Direct3DRMFrame, 62–64
creating a frame, 62, 63
frame hierarchies member functions, 62
frame movement member functions, 64
frame positioning member functions, 63–64
move callback member functions, 64
moving a frame, 64
positioning a frame, 63–64
using move callbacks, 64
Direct3DRMLight, 75–76
adding light to scenes, 75,–76
attaching light member function, 75
creation member functions, 75
setting location and orientation of lights, 75–76
Direct3DRMMaterial, 74
creation member function, 74
determining the behavior of light on faces and meshes, 74
emissive light color member functions, 74
specular light color member functions, 74
specular light power member functions, 74
Direct3DRMMesh, 68–69
creation member function, 68
manipulating mesh groups, 68–69
manipulating vertex positions, 69
mesh group member functions, 68
scale and translate member functions, 69
vertex access member functions, 69
Direct3DRMMeshBuilder, 64–67
creation member function, 65
face access member functions, 67
loading and saving member functions, 65
rendering member functions, 65–66
translate and scale member functions, 67
vertex access member functions, 67
Direct3DRMShadow, 77
adding shadows to scenes, 77
creating, 77
creation member function, 77
Direct3DRMTexture, 71–73
applying textures to faces and meshes, 71–73
creating textures, 71
decal manipulation member functions, 73
texture color member functions, 72
texture creation member functions, 71
Direct3DRMTextureWrap, 73
controlling wrap style, 73
creation member function, 73
Direct3DRMViewport, 6162
clipping member functions, 62
controlling clipping, 62
CreateDevice member function, 61
creating a viewport, 61
field-of-view, 61
field-of-view member function, 61
Direct3DWinDevice, 60–61
functions supported, 61
member functions, 60–61
DirectDraw, 400
standard, 92
Iunknown object
member functions, 55

J

Jade demo, 131–145
CreateScene function, 136–143
changing the scene’s background, 136–137
creating a frame for the mesh, 142
creating a viewport, 143
creating an ambient light source, 142–143
creating and applying the texture wrap, 140–142
loading the D3D mesh, 137
loading the texture, 138
illustrated, 132
MoveFrame function, 143–144
overview, 131–132
render functions, 144–145
techniques demonstrated, 133
texture settings settings, 141
wrap settings, 141
JadeWin class, 133–134
class definition, 133
CreateScene function, 134–143
changing the scene’s background, 136–137
creating a frame for the mesh, 142
creating a viewport, 143
creating an ambient light source, 142–143
creating and applying the texture wrap, 140–141, 142
loading the D3D mesh, 137
loading the texture, 138
MoveFrame function, 143–144
render functions, 144–145

K

Key-framing
defined, 49, 50
linear-based, 50
Rocket demo, 267–78
spline-based, 50
steps involved, 50

L

Lighting
adding ambient light to a scene, 75
adding directional light to a scene, 76
adding light to scenes, 75–76
adding parallel light to a scene, 76
adding point lights to a scene, 76
adding spotlights to a scene, 76
adjusting emissive light on faces and meshes, 74
adjusting specular light color on faces and meshes, 74
adjusting specular light power on faces and meshes, 74
ambient light, 42, 190–202
demo, 191–202
creating a spotlight, 112–114
defining light source color, 42
directional light, 43, 209–217
SpaceStation demo, 210–217
how rendering methods and color models affect light sources, 190
light sources, 187–250
ambient, 42
directional, 43
parallel, 43
point, 43
spot, 43
parallel light, 43, 217–225
SpaceDonut demo, 217–225
point light, 43, 202–209
Firefly demo, 202–209
setting location and orientation, 75–76
shadows, 238–249
Shadow demo, 238–249
spot light, 43
spotlight, 226–238
adjusting with a callback function, 122–123
penumbra angle, 226–227
Spotlight demo, 227–238
umbra angle, 226–227
using multiple light sources, 238
Listings
AmbientLight::WinCreateScene function, 196
SampleWin::CreateDevice function, 99–101
Cube2Win::CreateScene function, 310–311
CubeWin::CreateScene function, 296, 297
DecalWin::CreateScene function, 158, 159, 160
FacePickWin::CreateScene function, 368, 369
FireflyWin::CreateScene function, 204, 205, 206
FullScreenWin class definition, 430, 431
FullScreen::CreateScene function, 434–436
FullScreenWin function, 433–434
FullScreenWin::CreateFPSSurface function, 440
FullScreenWin::KeyDown function, 446–447
FullScreenWin::Render function, 442–443
FullScreenWin::UpdateFPSSurface function, 441–442
FullScreenWin::UpdateMenuSurface function, 438–439
GetGUID function, 104–105
JadeWin::CreateScene function, 134–136
MeshPick::CreateScene function, 357–359
MoleculeWin::CreateScene function, 258–260
MorphWin::LoadMeshes function, 325–327
MoveTexture function, 177–178
MultiView::CreateDevice function, 387–389
MultiViewWin::CreateScene function, 382–383
OrbStarWin::CreateScene function, 164–166
RMWin class (modified for full-screen apps), 404–405
RMWinActivateDisplayMode function (private version), 424–425
RMWin::CompareModes function, 411
RMWin::InitDisplayMode function, 409
RMWin::InitMainSurfaces function, 412–413
RMWin::InstallPalette function, 416–418
RMWin::OnCreate function, 407–408
RocketWin::CreateScene function, 269–271
SampleWin::CreateScene function, 109–110
ShadowWin::CreateScene function, 240–243
ShowRoomWin::CreateScene function, 180–183
SpaceDonutWin::CreateScene function, 219–221
SpaceStationWin::CreateScene function, 212–213
SpotlightWin::CreateScene function, 229–231
TargetWin::CreateScene function, 281–283
TextureDriftWin::CreateScene function, 173–174
WrapsWin::LoadMeshes function, 150–152
ZoomWin::CreateScene function, 347–349

M

Macros
ASSERT, 98
TRACE, 97–99
main()
defined, 5
Materials
applying to faces, 70
assigning to faces and meshes, 74
testing settings with Xpose, 350
Mesh
applying a texture to
applying color to, 376–377
applying texture wraps, 73
applying vertex animation techniques, 294–307
assiging colors to the faces of, 66
calculating color with normals, 30–32
CreateMeshBuilder function, 57
creating, 111–112
creating with meshbuilders, 69
defined, 30
groups, 68–69
functions, 68
working with multiple mesh groups, 308–318
illustrated, 30
loading from the File menu, 377–380
manipulating with meshbuilders, 64– 67
modifying rendering options with meshbuilders, 65–66
functions for, 65–66
setting the rendering mode of, 66
Mesh groups, 68–69, 308–318
defined, 68
functions, 68
working with multiple mesh groups (Cube2 demo), 308–318
Meshbuilders
accessing vertices used by a mesh, 67
applying scale factors to a mesh, 67
assigning textures to, 66
creating, 65
creating creating meshes, 69
defined, 64
loading, 65
modifying mesh rendering options, 65–66
performance issues, 67
saving, 65
specifying offsets for a mesh’s location, 67
MeshPick demo, 355–365
illustrated, 355
overview, 355
techniques demonstrated, 355
MeshPickWin class, 356, 357
class definition, 356
CreateScene function, 357–361
creating multiple meshes with frames, 359–360
creating the light source, 360–361
installing a callback function, 360
loading the mesh, 359
mouse functions, 361–364
UpdateDrag callback function, 364–365
Message map
defined, 7–8
sample code, 7–8
Message pump
defined, 5–6
sample code, 5
Messages
defined, 5
DispatchMessage function, 6
GetMessage function, 6
intercepting with event handlers, 6–7
message map, 7–8
message pump, 5
TranslateMessage function, 6
MFC
creating an application with AppWizard, 10–12
defined, 5
message map, 7–8
modifying an application with ClassWizard, 12–14
Microsoft
component object model (COM)
defined, 54–55
Web address, 55
Molecule demo, 255–265
CreateScene function
creating the frame hierarchy, 261
creating the meshes, 260–261
creating the viewport, 261
initializing a random number generator, 260
illustrated, 256
overview, 255
techniques demonstrated, 256
MoleculeWin class, 256–265
children functions, 265
class definition, 256–257
CreateChildren function, 262–264
CreateHierarchy function, 262
CreateScene function, 258–261
creating the frame hierarchy, 261
creating the meshes, 260–261
creating the viewport, 261
initializing a random number generator, 260
source code, 258–259
depth functions, 264–265
Morphing, 318–340
defined, 318
MorphPlay demo, 319–340
class design, 320
illustrated, 321
overview, 319–320
techniques demonstrated, 320
MorphPlayWin class, 331–333
CreateScene function, 333–334
source code, 333–334
class definition, 331–333
InitMorphSequence function, 335–336
source code, 335–336
mouse functions, 337–340
OnFileOpen function, 334–335
source code, 335
UpdateMorph callback function, 336–337
source code, 336–337
MorphWin class, 322–324
AddMorphKey function, 330
CreateAnimations function, 328–329
source code, 328
class definition, 322–323
functions, 322
GetMorphMesh function, 331
source code, 331
GetNumMorphTargets function, 329
LoadMeshes function, 325–327
source code, 325–327
LoadMorphSequence function, 324–325
PrepareMorphVertices function, 329
source code, 329
SetMorphTime function, 330–331
source code, 330–331
Motion attributes
defined, 49
MultiView demo, 380–395
ConfigViewport function
source code, 390
CreateDevice function
source code, 387–389
CreateScene function
source code, 382–383
CreateViewport function
source code, 391
illustrated, 380
MultiViewWin class, 381–382
CreateScene function, 382
class definition, 381
overview, 380–381
RMWin class (modified version), 384–386
ConfigViewport function, 390–391
CreateDevice function, 386–389
CreateViewport function, 391
class definition, 384–385
OnSize function, 393–394
Render function, 391–393
viewport functions, 394–395
techniques demonstrated, 381
MultiViewWin class, 381–382
class definition, 381
CreateScene function, 382
source code, 382–383

N

Normal
defined, 30
face, 30
face vs. vertex, 32
vertex, 31

O

Objects
creating Direct3D objects, 56
rules for using COM objects, 55
OrbStar demo, 162–170
CreateScene function
creating and loading the sphere, 167–168
creating the frame, 169
creating the sphere texture, 168
creating the star frame, 167
creating the star mesh, 166–167
creating the texture wrap, 168–169
illustrated, 162
overview, 162
techniques demonstrated, 162
OrbStarWin class, 163
callback functions, 169–170
CreateScene function, 163–169
creating and loading the sphere, 167–168
creating the frame, 169
creating the sphere texture, 168
creating the star frame, 167
creating the star mesh, 166–167
creating the texture wrap, 168–169
source code, 164–166
class definition, 163
Origin
defined, 25

P

Palettes
DirectDraw, 402
Parallel light, 217–225
adding to a scene, 76
defined, 43
SpaceDonut demo, 217–225
Perspective transformation
defined, 43
working with a viewing frustum, 44
Phong shading
defined, 48
Picking, 354–365
defined, 354
MeshPick demo, 355–365
Plane
defined, 27–28
Point light, 202–9
adding to a scene, 76
defined, 43
Firefly demo, 202–209
Pointers
avoiding dangling pointers, 139
Target demo pointer release dilemma, 286
Program execution phases, 94–95
creating a scene, 108–115
functions involved, 108–115
initializing Direct3D, 95–108
maintaining a scene, 115–23
functions involved, 115–23
shutting down, 123–124
using the OnDestroy function, 123–124
Programming
Windows vs. DOS, 5
main() function, 5
WinMain() function, 5

R

Ray-tracing
defined, 48
illustrated, 48–49
Rendering methods, 46
flat, 46–47
Gouraud, 47–48
how they affect light sources, 190
Phong, 48
ray-tracing, 48
unlit, 46
wireframe, 46
Retained Mode
defined, 56
RMWin class
background, 93–94
constructing scenes, 108–115
helper functions 124–125
maintaining scenes, 115–123
object creation functions, 98–108
shutting down, 123–124
RMWin class (modified for full-screen apps)
adding display mode support, 406
class definition, 404, 405
member functions, 407–429
palette support, 407
removing obsolete functions, 405–406
surface support, 407
RMWin class (modified for multiple views), 384–386
class definition, 384–385
ConfigViewport function, 390–391
CreateDevice function, 386–389
CreateViewport function, 391
OnSize function, 393–394
Render function, 391–393
viewport functions, 394–395
Rocket demo, 267–278
illustrated, 267
overview, 267
techniques demonstrated, 268
updating the scene, 276
RocketWin class, 268–278
animation functions, 276–278
CreateScene function, 269–270
creating a frame for the rocket mesh, 275
creating the animation sequence, 272–275
creating the rocket mesh, 27–272
source code, 269–270
class definition, 268
speed functions, 278
UpdateScene callback function, 276
Rotating
objects, 36–37

S

Scaling
objects, 34–36
textures, 39
Scenes
constructing, 108–115
creating a mesh, 111–112
creating a spotlight, 112–114
creating a viewport, 114, 115
functions involved, 108–115
maintaining, 115–23
functions involved, 115–23
shutting down, 123–124
using the OnDestroy function, 123–124
SetVertices function, 83
Shading methods, 46
flat, 46–47
Gouraud, 47–48
Phong, 48
ray-tracing, 48
unlit, 46
wireframe, 46
Shadow demo, 238–249
CreateScene function
creating a frame for the floor mesh, 245
creating a frame for the fork mesh, 245–246
creating a point light source, 246–247
creating an ambient light source, 246
creating and applying the floor mesh texture wrap, 244–245
creating the floor mesh texture, 244
creating the fork mesh, 245
creating the mesh to represent the floor, 243–244
creating the shadow object, 247
creating the viewport, 247–248
illustrated, 239
overview, 238–239
ShadowWin class, 239–240
AdjustSpin callback function, 248
class definition, 239–240
CreateScene function, 240–248
render functions, 248–249
techniques demonstrated, 239
Shadows, 238–249
adding to scenes, 77
limitations, 77
creating, 77
Shadow demo, 238–249
ShadowWin class, 239–240
AdjustSpin callback function, 248
class definition, 239–240
CreateScene function, 240–248
creating a frame for the floor mesh, 245
creating a frame for the fork mesh, 245–246
creating a point light source, 246–247
creating an ambient light source, 246
creating and applying the floor mesh texture wrap, 244–245
creating the floor mesh texture, 244
creating the fork mesh, 245
creating the mesh to represent the floor, 243–244
creating the shadow object, 247
creating the viewport, 247–248
source code, 240–243
render functions, 248–249
ShowRoom demo, 178–186
CreateScene function
creating and applying the texture wrap, 184–185
creating and loading the cube mesh, 184
creating the frame, 185
creating the interface, 185
creating the textures, 184
illustrated, 179
overview, 178–179
techniques demonstrated, 179
using callbacks to install a new texture, 185–186
ShowRoomWin class, 179–180
class definition, 180
CreateScene function, 180–185
creating and applying the texture wrap, 184–185
creating and loading the cube mesh, 184
creating the frame, 185
creating the interface, 185
creating the textures, 184
using callbacks to install a new texture, 185–186
SpaceDonut demo, 217–225
CreateScene function
applying the texture to the mesh, 223
creating and attaching the frame, 223, 224
creating and loading the frosting texture, 222
creating the donut mesh, 221–222
creating the light source and its frame, 224–225
creating the viewport, 225
illustrated, 218
overview, 217
techniques demonstrated, 217
SpaceDonutWin class, 217–219
class definition, 218
CreateScene function, 219–225
applying the texture to the mesh, 223
creating and attaching the frame, 223–224
creating and loading the frosting texture, 222
creating the donut mesh, 221–222
creating the light source and its frame, 224–225
creating the viewport, 225
source code, 219–221
SpaceStation demo, 210–217
CreateScene function
creating a frame for the light source, 215
creating a frame for the space station mesh, 214
creating a viewport, 215–217
creating the light source, 214
creating the space station mesh, 213
illustrated, 210
overview, 210
techniques demonstrated, 210
SpaceStationWin class, 211
class definition, 211
CreateScene function, 211–217
creating a frame for the light source, 215
creating a frame for the space station mesh, 214
creating a viewport, 215–217
creating the light source, 214
creating the space station mesh, 213
source code, 212–213
Spotlight, 226–238
adding to a scene, 76
adjusting with a callback function, 122–123
creating, 112–114
defined, 43
penumbra angle, 43, 226–227
illustrated, 226
setting, 76
Spotlight demo, 227–238
umbra angle, 43, 226–227
illustrated, 226
setting, 76
Spotlight demo, 227–238
CreateScene function
creating a frame for the light source, 233–234
creating a viewport, 234
creating and positioning a frame for the meshes, 232–233
creating the light source, 233
intializing the pointers, 232
loading the spherical mesh, 231–232
overview, 227–228
techniques demonstrated, 227
SpotlightWin class, 228–229
beam functions, 237–238
class definition, 228–229
CreateScene function, 229–234
creating a frame for the light source, 233–234
creating a viewport, 234
creating and positioning a frame for the meshes, 232–233
creating the light source, 233
intializing the pointers, 232
loading the spherical mesh, 231–232
source code, 229–231
MoveLight callback function, 234–235
render functions, 235–237

T

Target demo, 279–289
CreateScene function
creating multiple frames for the missile mesh, 287–288
creating the animation sequence, 284–285
creating the frame for the target mesh, 286
creating the missile mesh, 287
loading the target mesh, 284
illustrated, 279
overview, 279–280
pointer release dilemma, 286
techniques demonstrated, 280
TargetWin class, 280–281
callback functions, 288
CreateScene function, 281–288
creating multiple frames for the missile mesh, 287, 288
creating the animation sequence, 284, 285
creating the frame for the target mesh, 286
creating the missile mesh, 287
loading the target mesh, 284
source code, 281–283
class definition, 280
MoveTarget callback function, 288
OrientFrame back function, 288
OrientFrame callback function, 289
Texture
applying to faces, 70
controlling the number of colors used in, 72
creating, 71
defined, 38
texture wraps, 73
using decals, 72–73
using existing DirectDraw surfaces as textures, 71
Texture animation, 41–42, 171–186
defined, 41
ShowRoom demo, 178–186
single texture vs. multiple texture, 171
TextureDrift demo, 171–178
Texture mapping, 127–186
adding a decal to a scene, 156–61
Decal demo, 156–61
applying a flat texture to a mesh
Jade demo, 131–145
applying a non-flat texture to a mesh
Wraps demo, 146–156
creating a transparent texture, 161
defined, 37–38
OrbStar demo, 162–170
storage tip, 272
Texture scaling, 39
defined, 39
Texture wrapping, 40–41
cylindrical, 40
defined, 40
experimenting with Xpose, 129–131
flat, 40
spherical, 41
TextureDrift demo, 171–178
CreateScene function
creating the frame, 176
creating the interface, 176
creating the mesh, 175
creating the texture, 175–176
illustrated, 172
overview, 171–172
techniques demonstrated, 171
TextureDriftWin class, 172–173
CreateScene function, 173–176
creating the frame, 176
creating the interface, 176
creating the mesh, 175
creating the texture, 175–176
source code, 173–174
class definition, 173
using callbacks to animate the texture, 176–178
TRACE macro
defined, 97
Translations
defined, 32
rotate, 32–37
scale, 32–36
defined, 34
translate, 32
translate (move), 33–34
defined, 33

U

Unlit rendering
defined, 46
illustrated, 46–47
Utilities
CONV3DS, 84–85

V

Values
specifying absolute values, 140
Vector
defined, 25–26
vs. point, 25–27
Vertex
defined, 28–29
manipulating the vertices of a face, 70
functions for, 70
manipulating vertices used by a mesh, 67–69
Vertex animation, 294–307
Cube demo, 294–307
Viewing frustum
defined, 44
enlarging the angle, 61
field-of-view (FOV) setting, 44
reducing the angle, 61
Viewport, 341–395
controlling clipping, 62
creating, 61, 114–115
defined, 61
field-of-view, 61, 343–54
Zoom demo, 344–354
MultiView demo, 380–95
picking, 354–365
MeshPick demo, 355–365
picking faces, 365–80
FacePick, 365–380
using multiple viewports, 380–95
Visual C++
compile warning signs, 193
defined, 4
Developer Studio
AppWizard, 9
ClassWizard, 8–9
creating an MFC application with AppWizard, 10–12
defined, 4
illustrated, 4
modifying an MFC application with ClassWizard, 12–14
writing custom AppWizards, 15
introduction to, 1–20
MFC
creating an application with AppWizard, 10–12
defined, 5
message map, 7, 8
modifying an application with ClassWizard, 12–14
Windows SDK
defined, 4

W

Windowed applications
defined, 399
Windows programming
compared to DOS programming, 5
event handler
defined, 6–7
Hungarian notation, 19
message pump, 5
using C++ strong type checking, 19–20
Windows SDK
defined, 4
message functions, 6
WinMain()
defined, 5
message pump, 5
Wireframe rendering
defined, 46
illustrated, 46
Wraps demo, 146–156
CreateScene function
creating and configuring meshes, textures, and texture wraps, 150–156
illustrated, 146–147
overview, 146–147
techniques demonstrated, 147
WrapsWin class, 147–148
class definition, 147–148
CreateScene function, 148–149
creating and configuring meshes, textures, and texture wraps, 150–156
source code, 149

X

X files
creating, 84
defined, 84
Xpose
experimenting with, 129–131
testing materials settings, 350

Z

Z-buffering
defined, 45
in DirectDraw, 402
pros and cons, 45
Zoom demo, 344–354
CreateScene function
applying a material to the mesh, 349–350
creating a frame for the mesh, 350
creating a viewport, 352
creating an animation sequence, 351, 352
creating and loading the mesh, 349
illustrated, 344
overview, 344–345
tecniques demonstrated, 345
ZoomWin class, 345–346
AdjustField callback function, 352–353
animation functions, 353–354
class definition, 345–346
CreateScene function, 347–352
applying a material to the mesh, 349–350
creating a frame for the mesh, 350
creating a viewport, 352
creating an animation sequence, 351–352
creating and loading the mesh, 349
source code, 347–349


Table of Contents


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.