slide1 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Chapter 7: Graphical Primitives PowerPoint Presentation
Download Presentation
Chapter 7: Graphical Primitives

Loading in 2 Seconds...

play fullscreen
1 / 41

Chapter 7: Graphical Primitives - PowerPoint PPT Presentation


  • 292 Views
  • Uploaded on

Chapter 7: Graphical Primitives. This Chapter: we will learn. Types of primitives: Points, Lines, and Triangles Attributes of primitives: Per-primitive and Per-Vertex attributes E.g., colors, size, style, etc. Programming with primitives Abstraction + integration into UWBGL.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Chapter 7: Graphical Primitives' - elina


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1
Chapter 7:

Graphical Primitives

Chapter 7

this chapter we will learn
This Chapter: we will learn
  • Types of primitives:
    • Points, Lines, and Triangles
  • Attributes of primitives:
    • Per-primitive and Per-Vertex attributes
    • E.g., colors, size, style, etc.
  • Programming with primitives
    • Abstraction + integration into UWBGL

Chapter 7

point primitives
Point Primitives
  • Important because of:
    • Particles! – approximation fire, water, explosions
  • Attributes:
    • Color, size, andtexture coordinates
  • Drawing commands:
    • DrawPoint
    • DrawPointList
        • Efficiency! Particles are lots of points

Chapter 7

line primitives
Line Primitives
  • Important for:
    • Hairs, rains, etc.
  • Types:
    • One Line Segment
    • Line Segments or Line Lists
        • Collection of lines (not connected)
    • Line Strips or Polylines
        • Collection of connected lines
    • Line lists/strips
        • Efficient to specify large number

Chapter 7

line attributes
Line: Attributes
  • Per-Vertex Attributes
    • Color
      • Gouraud Shading: linearly change colors from one vertex to the next
    • Texture Coordinate
    • Normal Vector
      • Important for shading hair/rain
  • Per-Primitive Attributes
    • Material properties
    • Line Style/Width

Chapter 7

triangle primitive
Triangle Primitive
  • Only drawing primitivewith area.
  • Geometries/objects in most graphics applications are approximated with triangles.

Chapter 7

types of triangles
Types of Triangles
  • Triangle (Lists)
    • Individual vertices
  • Triangle Fan
    • n+2 vertices specify n connected triangles
  • Triangle Strip
    • n+2 vertices specify nconnected triangles

Chapter 7

triangle attributes
Triangle: Attributes
  • Per-Vertex attribute
    • similar as per-vertex attribute of lines:
      • Color, normal, texture coordinates
  • Per-Edge attributes
    • Similar to per-line attributes:
      • Width, style, etc.
  • Per Triangle attribute
    • Material properties
    • Fill style: e.g., wire frame

Chapter 7

color
Color:
  • Usually expressed as:
    • (Red, Green, Blue) or (r, g, b)
  • Usually:
    • Normalized float: 0.0 ≤ r,g,b ≥1.0
    • Integer: 0.0 ≤ r,g,b ≥255
      • 255: 8-bit per channel ( )

Chapter 7

uwbgl lib4 geometries
UWBGL_Lib4: Geometries
  • Common Files/
    • DrawHelper/
      • API independent drawing support
    • Geoms/
      • Geometries (attributes + drawing)
      • E.g., color, shadeMode, FillMode, etc.
    • D3D Files/
      • D3D_DrawHelper
        • D3D specific drawing support
      • D3D_GraphicsSystem/
        • D3D API support (GHC, RC, and swap chain)
      • D3D_WindowHandler
        • D3D View/Controller pair support

Chapter 7

drawhelper
DrawHelper:
  • Interface for drawing

Chapter 7

tutorial 7 2
Tutorial 7.2:

Chapter 7

primitive collisions
Primitive: Collisions
  • Attributes of primitive:
    • Appearance (color) vs. Physical (velocity)
  • Graphics: mainly concern with appearance
  • Learn some physical attributes
  • Collision: mathematic intersection

Chapter 7

collision with intersection
Collision with intersection
  • With n different primitive types
    • Need O(n2) different intersection routines!
      • E.g., line, circle, point: needs
        • Line-Line, Line-Circle, Line-Point, Circle-Circle, Circle-Point, Point-Point
        • In general: n+(n-1)+(n-2)
  • Intersection Math is tedious
  • Complex Invocation
    • logic to determine which of the routines to invoke

Chapter 7

collision with bounding volumes
Collision with: Bounding volumes
  • Bounds primitive withsimple volumes
    • E.g. x/y/z bounds
    • E.g., circle/spheres
  • Collide with the bounding volumesinstead!

Chapter 7

bounding volume considerations
Bounding Volume considerations
  • Simplicity in math
    • circle/sphere and axes aligned bounding boxes
  • Tightness in bound
      • Void space
  • Approximation
      • False collision and
      • Failed detection
  • Colliding position
      • On bounding circle is different from on object

Chapter 7

uwbgl lib6 bounding volume
UWBGL_Lib6: Bounding Volume
  • Intersects() collide two volumes
    • Returns True/False (no colliding position)
  • Add()
    • Inserts and expends the volume

Chapter 7

primitive collisionresponse
Primitive: CollisionResponse
  • Primitive class:
    • has a bounding volume
    • CollisionResponse(): collision detected
      • other_location – location of other primitive
      • Change primitive behavior accordingly
    • Knows how to draw bounding volume

Chapter 7

using boundingvolume
Using BoundingVolume
  • Three steps:
    • 1. Get the volume from each primitives
    • 2. Collide the volumes
    • 3. If volumes collide
      • Each primitive must response: CollisionResponse()

Chapter 7

default collision response
Default collision response …
  • Change velocity to repulse away
  • Looks like bouncing away
    • Very rough approximation of elastic collision

Chapter 7

lib7 collection of primitives
Lib7: Collection of Primitives
  • PrimitiveList class Subclass of Primitive
  • Behave just like a primitive

Chapter 7