Graphics Graphics Korea University cgvr.korea.ac.kr 1 Applying Actions 강 신 진 2001. 08. 22.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Chapter 4: Trees Part II - AVL Tree
Binary Trees. DCS – SWC 2 Binary Trees Sets and Maps in Java are also available in tree-based implementations A Tree is – in this context – a data structure.
Adobe Photoshop CS Design Professional PATHS, & SHAPES USING CLIPPING MASKS,
User Interaction Chapters 10, 12, 13, 15. Events Events are actions applied to the graph Each node implements its own behavior When node is found to handle.
Texture mapping. Adds realism to computer graphics Texture mapping applies a pattern of color Bump mapping alters the surface Mapping is cheaper than.
Homework Tips. We will learn What actions are Apply actions to a node or a path Compute 3D bounding box Compute cumulative transformation matrix Insert.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
Handling of data from multiple databases. Visual Basic Database Visual Basic application acts as a front-end to the database Visual Basic application.
Tree.
Shapes Properties Binding Chung Ji Hye.
Programming Concepts. Derive a new class from Activity of the framework Prepare the data beforehand, e.g., vertices, colours, normal vectors, texture.
Tutorial 6 Working with Bitmaps and Gradients, and Publishing Flash Files.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Chapter 6 Special Effects 강 신 진강 신 진
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
Korea University Korea University Computer Graphics Laboratory Computer Graphics Laboratory Jung Lee, Chapter 13.
Binary Trees Chapter Definition And Application Of Binary Trees Binary tree: a nonlinear linked list in which each node may point to 0, 1, or two.
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
1 CSE 1342 Programming Concepts Trees. 2 Basic Terminology Trees are made up of nodes and edges. A tree has a single node known as a root. –The root is.
Spring 2010CS 2251 Trees Chapter 6. Spring 2010CS 2252 Chapter Objectives Learn to use a tree to represent a hierarchical organization of information.
Graphics Graphics Korea University cgvr.korea.ac.kr 3D Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Open Inventor A short introduction. Capabilities of Open Inventor Easy construction of 3D scenes User interaction Animation.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Pointers OVERVIEW.
1 VR assignment#2 WTK SDK Introduction By Jin-Bey Yu 2001/11/12.
Computing & Information Sciences Kansas State University Lecture 19 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 19 of 42 William H. Hsu.
© M. Gross, ETH Zürich, 2014 Informatik I für D-MAVT (FS 2014) Exercise 12 – Data Structures – Trees Sorting Algorithms.
Trees and beyond Tutorial #3 CPSC 261. Trees are just an example The next two weeks in labs we are playing with trees – Trees are interesting – Trees.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
CS212: Object Oriented Analysis and Design Lecture 24: Introduction to STL.
Object Oriented Analysis & Design Game Patterns. Contents  What patterns are  Delegation  Game Loop  Scene Graph  Double Buffering  Component 
Cameras and Light Chapter 4, The Inventor Mentor.
고려대학교 그래픽스 연구실 An Inventor Sampler - The Inventor mentor 고려대학교 그래픽스 연구실 민 성환.
1 OGRE Programming Intermediate Tutorial: Volume Selection.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Graphics Graphics Korea University cgvr.korea.ac.kr Lighting, Fogging, Alpha Blending & Progressive Meshes Byeong-Seon Jeong
1 Binary Trees and Binary Search Trees Based on Dale & Co: Object-Oriented Data Structures using C++ (graphics)
Prof. Amr Goneid, AUC1 CSCE 210 Data Structures and Algorithms Prof. Amr Goneid AUC Part 6. Dictionaries(3): Binary Search Trees.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
Copyright © 2012 Pearson Education, Inc. Chapter 20: Binary Trees.
Lecture 7 Midterm Review. OpenGL Libraries gl: Basic OpenGL library, e.g. primitives. glu: OpenGL Utility library, a set of functions to create texture.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 20: Binary Trees.
고려대학교 그래픽스 연구실 Cameras and Lights - The Inventor mentor 고려대학교 그래픽스 연구실 민 성환.
Circular linked list A circular linked list is a linear linked list accept that last element points to the first element.
White Box Testing by : Andika Bayu H.
Linked list: a list of items (nodes), in which the order of the nodes is determined by the address, called the link, stored in each node C++ Programming:
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 20: Binary Trees.
1 Binary Search Trees. 2 Binary Search Trees Binary Search Trees The Binary Search Tree (BST) Search, Insertion and Traversal of BST Removal of nodes.
CS223: Software Engineering Lecture 26: Software Testing.
Institute for Computer Graphics and Vision Computer Graphics and Interactive Systems 1 Grabner HS i4, 2006/03/08 Web3D, VRVU, SGP Web3D ( ) VRVU.
Data Structures and Design in Java © Rick Mercer
Real-Time Soft Shadows with Adaptive Light Source Sampling
Binary Trees and Binary Search Trees
Ogre Overview Lecture 3.
Ogre Overview.
Programming Abstractions
IMAGES.
Lecture 22 Binary Search Trees Chapter 10 of textbook
Tonga Institute of Higher Education
This pointer, Dynamic memory allocation, Constructors and Destructor
Chapter 20: Binary Trees.
Binary Trees.
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Chapter 21: Binary Trees.
Nodes and Groups Lee Young Gun Open Inventor.
Trees.
Presentation transcript:

Graphics Graphics Korea University cgvr.korea.ac.kr 1 Applying Actions 강 신 진

CGVR Graphics Korea University cgvr.korea.ac.kr 2 Inventor Actions General Model Applying an Action Rendering Calculating a Bounding Box Accumulating a Transformation Matrix Writing to a File Searching for a Node Picking Contents

CGVR Graphics Korea University cgvr.korea.ac.kr 3 Inventor Actions Available Action List Using This ActionYou Can Perform This Task SoGetBoundingBoxActionCompute a 3D bounding box SoGetMatrixAcionCompute a transformation matrix SoWriteActionWrite Scene graph to a file SoSearchActionSearch for paths to specific nodes SoHandleEventActionAllow object to handle an event SoRayPickActionPick object in the scene graph along a ray SoCallBackActionTraverse the scene graph and perform your own action using callback function SoGLRenderAction Draw, or render, the scene graph

CGVR Graphics Korea University cgvr.korea.ac.kr 4 General Model Initialize the action SbViewportRegion region(300, 200); SoGLRenderAction renderAction(region); Set up special parameters for the action SoGLRenderAction renderAction(region, TRUE); Apply the action to a node renderAction->apply(root) Obtain the result of the action, if possible

CGVR Graphics Korea University cgvr.korea.ac.kr 5 Applying an Action Action Application Node Path Path list Traversal state Internal class to store transient state elements Inventor database management

CGVR Graphics Korea University cgvr.korea.ac.kr 6 Rendering - Execution Execution of SoGLRenderAction If the node is a group >>Visit each children If the node is a property group >>Replace a value of traversal state If the node is derived from SoTransformation >>Modify the current transformation If the node is shape node >>Draw shape using the current element

CGVR Graphics Korea University cgvr.korea.ac.kr 7 Rendering - Transparency Setting the Transparency Quality setTransparencyType() Transparency Levels  SCREEN_DOOR  ADD  DELAYED_ADD  SORTED_OBJECT_ADD  BLEND  DELAYED_BLEND  SORTED_OBJECT_BLEND

CGVR Graphics Korea University cgvr.korea.ac.kr 8 Rendering - Antialiasing 2 Types of Antialiasing Smoothing Using the Accumulation Buffer Smoothing SoGLRenderAction :: setSmoothing(SbBool smooth) Accumulation Buffer SoGLRenderAction :: setNumPasses(int num)

CGVR Graphics Korea University cgvr.korea.ac.kr 9 Rendering - Off-screen Rendering SoOffScreenRenderer Class Render an image into off-screen memory buffer  To generate image for a PostScript printer  To generate image for a Texture map SoOffScreenRenderer :: SetComponent(Components components)  LUMIANCE  LUMIANCE_TRANSPARENCY  RGB  RGB_TRANSPARENCY

CGVR Graphics Korea University cgvr.korea.ac.kr 10 Rendering - Source TEXTURE MAPPING SbBool generateTextureMap (SoNode *root, SoTexture2 *texture, short textureWidth, short textureHeight) { SbViewportRegion myViewport(textureWidth, textureHeight); // Render the scene SoOffscreenRenderer *myRenderer = new SoOffscreenRenderer(myViewport); myRenderer->setBackgroundColor(SbColor(0.3, 0.3, 0.3)); if (!myRenderer->render(root)) { delete myRenderer; return FALSE; } // Generate the texture texture->image.setValue(SbVec2s(textureWidth, textureHeight), SoOffscreenRenderer::RGB, myRenderer->getBuffer()); delete myRenderer; return TRUE; }

CGVR Graphics Korea University cgvr.korea.ac.kr 11 Rendering - Caching Saving of an operation Don’t need to traverse the scene graph every time SoSeparator node has 2 field for caching render caching:  renderCaching(SoSFEnum) bounding-box caching  boundingBoxCaching(SoSFEnum)  SoSFEnum => AUTO, ON, OFF How Caching Working Check a valid cache existence Ignore below scene graph and use cache(if C exists)

CGVR Graphics Korea University cgvr.korea.ac.kr 12 Calculating a Bounding Box Create an instance of the action sbViewportRegion vpReg; vpReg.setWindowSize(300, 200); SoGetBoundingBoxAction bboxAction(vpReg); Apply the Action bboxAction.apply(root); Obtain Result SoTransform *myTransform; myTransform->center = bboxAction.getCenter();

CGVR Graphics Korea University cgvr.korea.ac.kr 13 Accumulating a Transformation Matrix Create an instance of the action soGetMatrixAction mtxAction Apply the Action getMatrix() getInverse()

CGVR Graphics Korea University cgvr.korea.ac.kr 14 Writing to a File SoWriteAction class is used SoWriteAction myAction; Writing in binary with file pointer FILE *fp; myAction.getOutput()->setBinary(TRUE); myAction.getOutput()->setFilePointer(fp); myAction.apply(root); Writing in ASCII myAction.getOutput()->openFile(“file.iv”); myAciton.getOutput()->setBinary(FALSE); myAction.apply(root); myAction.getOutput()->closeFile();

CGVR Graphics Korea University cgvr.korea.ac.kr 15 Searching for a Node Example SoSearchAction mySearchAction mySearchAction.setType(SoLight::getClassTrypeId()); mySearchAction.setInterest (SoSearchAction::FIRST); mySearchAction.apply(root); If(mySearchAction.getPath() == NULL){ SoDirectionLight *myLight = new SoDirectionalLight; root->insertChild(myLight, 0); }

CGVR Graphics Korea University cgvr.korea.ac.kr 16 Picking –1 SoRayPickAction is used Find objects along a ray from the camera

CGVR Graphics Korea University cgvr.korea.ac.kr 17 Picking – 2 Specifying the Picking Ray SbViewportRegion viewport(400, 300); SbVec2s cursorPosition(250, 150); SoRayPickAction myPickAction(viewport); myPickAction.setRay(SbVec3f(0.0, 0.0, 0.0), //starting point SbVec3f(0.0, 0.0, -1.0)); //direction vector pickAction->apply(rootNode); Obtain result SoPath *pathToPickObject; Const SoPickPoint *myPickedPoint = pickAction.getPickedPoint(); If(myPickedPoint != NULL) pathToPickedobject = myPickedPoint->getPath();

CGVR Graphics Korea University cgvr.korea.ac.kr 18 Picking – 2 SoDetail Have an additional information about the pick Classes that store an SoDetail Class nameType of detail added SoCubeSoCubeDetail SoCylinderSoCylinderDetail SoPointSetSoPointDetail SoConeSoConeDetail

CGVR Graphics Korea University cgvr.korea.ac.kr 19 Using the Pick Action Writing the path to the Picked Object SbBool writePickedPath (SoNode *root, const SbViewportRegion &viewport, const SbVec2s &cursorPosition) { SoRayPickAction PickAction(viewport); PickAction.setPoint(cursorPosition); PickAction.setRadius(8.0); PickAction.apply(root); const SoPickedPoint *myPickedPoint = pickAction.getPickedPoint(); If(myPickedPoint == NULL) return FALSE; SoWriteAction myWriteAction; myWrtieAction.apply(myPickedPoint->getpath()); return TRUE; }

CGVR Graphics Korea University cgvr.korea.ac.kr 20 Calling Back to the Application SoCallbackAction Method which is called whenever a specified node encountered during the traversal Void printSpheres(SoNode *root) { SoCallbackAction myAction; myAction.addPreCallback(SoSphere::getClassTypeId(), printHeaderCallback, NULL); myAction.addTriangleCallback(SoSphere::getClassTypeId(), printTriangleCallback, NULL); myAction.apply(root); }