Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7CSC 480 / 580Computer GraphicsK. KirbyScene Graphsand Slerping QuaternionsNKU CSC 480 KIRBYclass Widget{public: void dump() const ; virtual void spin(); virtual void toss() =0 ; void flip() { toss() ; } // ... } ;Remembering OOWidgetFastWidgetSlowWidgetSlowWidget sw ;FastWidget fw ;play( sw ) ;play( fw ) ;void play( Widget* p ){ p->toss() ; // ...} void play( Widget* p ){ p->toss() ; // ...} class SlowWidget : public Widget{public: void toss() { /*...*/ } ; void spin() { /*...*/ } ; // ...} ;class FastWidget : public Widget{public: void toss() { /*...*/ } ;// ...} ;NKU CSC 480 KIRBYsphere: GlutSpherecenter: TransformNode west: TransformNode east: TransformNode east: TransformNoderedMat: MaterialNodegreenMat: MaterialNode blueMat: MaterialNodelight: LightNodelight2: LightNodescene: NodeA simple scene graph instanceThis is a DAG(directed acyclic graph)NKU CSC 480 KIRBYNodeNodeTransformNodeTransformNodeEnvironmentNodeEnvironmentNodeAppearanceNodeAppearanceNodeLightNodeLightNodeMaterialNodeMaterialNodeArtifactNodeArtifactNodeMeshMeshGlutSphereGlutSphereGlutTeapotGlutTeapotA Simple Scene Graph Class HierarchyNKU CSC 480 KIRBYImplementation Issues for DiscussionHow do we implement a DAG ?What does a TransformNode do?How to we handle rendering of sub-scenes?How do clients assemble a scene graph in an OpenGL program?NKU CSC 480 KIRBYSee SceneGraph.h, SceneGraph.cpp, DemoSceneGraph.cppR(0)R(1)Frame 442 Frame 482Frame 462 R(0.5) = 0.5 R(0) + 0.5 R(1) ????Bad. Why?Rotation matrices and TweeningNKU CSC 480 KIRBYPoints – as pure quaternionsp = xi + yj + zk Rotations (u^,  ) – as unit quaternionsr = cos ½ + (sin ½) u1i + u2j + u3k Implementing rotations: p´ = r p r* SLERPing quaternions (“spherical linear interpolation”)r(t) = [ sin(1-t) r(0) + sin t  r(1) ] / sin  where cos  = r(0) r(1).NKU CSC 480


View Full Document

NKU CSC 480 - Scene Graphs

Download Scene Graphs
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Scene Graphs and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Scene Graphs 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?