Download presentation
Presentation is loading. Please wait.
Published byDwain Wilkins Modified over 8 years ago
1
2008/9/24 Kim, HyungSeok
2
HyungSeok Kim, Konkuk University Part I: Framework – 1. Windows creation – 2. Renderer – 3. Lights and Objects/Model loading – 4. GUI design/Input system/Sound Part II: Simulation – 5. Math libs – 6. Collision detection – 7. Basic scripting – 8. Model animation Part III: Advanced rendering – 9. Special effects – 10. Textures Part IV: Final – 11. Game final
3
HyungSeok Kim, Konkuk University Rendering – Video – Audio – Haptic, … Simulation – AI – Math calculation User interface – Input Scene graph
4
HyungSeok Kim, Konkuk University Create a frame for an engine – Game Engine Main loop Class Renderer Class Simulator …
5
HyungSeok Kim, Konkuk University Create a basic scene graph structures – Which object to create? – Which structure to hold? Create a basic renderer – How to put renderer into the framework? – Which functionality the renderer will have?
6
HyungSeok Kim, Konkuk University Task 1: Following the last Homework – Create a scene database – How? Requirement analysis Specification Implementation
7
HyungSeok Kim, Konkuk University Common properties of objects – Position – Orientation Transform matrix – Shape Mesh – … and more
8
HyungSeok Kim, Konkuk University Scene structure – Why? – How? Array? Tree? Any others? – Your proposition Pros and cons
9
HyungSeok Kim, Konkuk University Scene Graph – Tree-like approach
10
HyungSeok Kim, Konkuk University 1. Class hierarchy definition 2. Data definition – Position/Orientation? – Shape?
11
HyungSeok Kim, Konkuk University Transform Matrix – Matrix for specifying position and orientation – Translation – Rotation – Matrix concatenation and storage
12
HyungSeok Kim, Konkuk University Hierarchical transform – World matrix stack – Why stack?
13
HyungSeok Kim, Konkuk University ID3DXMatrixStack* pMatrixStack; D3DXCreateMatrixStack(0,&pMatrixStack); pMatrixStack->LoadMatrix( ); For childrens – pMatrixStack->Push(); – pMatrixStack->MultMatrix( ); – For childrens if any – … – pMatrixStack->Pop();
14
HyungSeok Kim, Konkuk University glLoadMatrix( ); For childrens – glPushMatrix(); – glMultMatrix( ); – For childrens if any – … – glPopMatrix();
15
HyungSeok Kim, Konkuk University Matrix Translation (x,y,z) Rotation – How? – Quaternion
16
HyungSeok Kim, Konkuk University Mesh – Container for a shape Shape-wise representation: an object – Use a container instead of separated elements – Easy representation and control of multiple shapes Store/load of a shape – OpenGL: vertex array, index array, … – D3D: class ID3DXMesh;
17
HyungSeok Kim, Konkuk University D3D – HRESULT ID3DXBaseMesh::DrawSubset(DWORD AttribId ); – Subset A group of triangles which has the same material and states OpenGL – glDrawPrimitives, glDrawElements, …
18
HyungSeok Kim, Konkuk University class Scene { … }; – Singleton – Access scene definition Array case: able to get array Tree case: able to get tree root …
19
HyungSeok Kim, Konkuk University Create Box or Sphere and add it to your scene – OpenGL GLUquadricObj* gluNewQuadric( void ); void gluSphere( GLUquadricObj *qobj, GLdouble radiu s, GLint slices, GLint stacks ); – D3D HRESULT D3DXCreateBox(LPDIRECT3DDEVICE9 pDevice, FLOAT width, FLOAT height, FLOAT depth, LPD3DXMESH *ppMesh, LPD3DXBUFFER *ppAdjacency); Draw
20
HyungSeok Kim, Konkuk University Render scene periodically – Should be called in main loop – Event-based update vs. Continuous update
21
HyungSeok Kim, Konkuk University Functions – Traverse scene database Scene graph Scene array? … – Render each object Optimization
22
HyungSeok Kim, Konkuk University Add another box or sphere to the scene graph – Render all
23
HyungSeok Kim, Konkuk University
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.