By JerryDean Smith Chad Adams Karl Mullner.  The rectangle needs to be a ogre.ManualObject -this is done to create the rectangle and gives it special.

Slides:



Advertisements
Similar presentations
Games in Python – the easy way
Advertisements

Click on the rectangle on the lower right-hand side of the screen. This will quickly clear your desktop.
FUNCTIONS. • Function เป็นชื่อของชุดคำสั่ง • Syntax ของฟังก์ชั่น Def NAME (PARAMETERS ): STATEMENTS • NAME เป็นชื่อของฟังก์ชัน สามารถใช้ชื่อใดๆ ตามกฎการตั้งชื่อ.
Teaching Sight Words To Your Child…. Remember, before you begin…. Make 2 copies of the words on index cards.
BGI graphics library And Visual Studio.
Python Programming, 2/e1 CS177: Programming in Multimedia Objects Recitation Topic: Graphics Library.
Operating Abel (2)1 Trainer Training Operating Abel (2)
This P shaped package is designed this way because P for Penguin. My mouse is a penguin so it kind of explains it.
Variables Conditionals Loops The concept of Iteration Two types of loops: While For When do we use them? Iteration in the context of computer graphics.
POWERPOINT May 2004 To move the text box - move the mouse over the border of the text box, and once the 4-way arrow appears - click and drag the box to.
PowerPoint Scavenger Hunt Lauren Davis EDTD 3011 A Summer 2007.
Drinks Bottle Using CREO DEVELOPMENT
PARTS – ARM PISTON CONNECTOR 13 – ARM BARREL CONNECTOR 14 – HAND BARREL CONNECTOR 15 – BASE BARREL CONNECTOR.
Auxiliary Views.
Creating a Mouse Maze This tutorial will cover step-by-step how to create a mouse maze like the one above. The goal of these mazes is to reach the end.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
IAT 800 Lab 1: Loops, Animation, and Simple User Interaction.
Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
Week 9 Generalization, inheritance, class hierarchy and graphics.
Lattice Multiplication is an alternative way of doing higher level multiplication.
At the end of Tutorial 2 I gave you a problem to work on independently. Watch as I use LATTICE MULTIPLICATION to solve that problem.
P-value Method One Mean, sigma known. The average length of a certain insect has been determined to be.52 cm with a standard deviation of.03 cm. A researcher.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
1 Windows Printing. 2 Objectives You will be able to Output text and graphics to a printer. Print multipage documents. Use the standard Windows print.
2 What is pyGame? A set of Python modules to make it easier to write games. –home page: –documentation:
1 Exercise Two The Digital Camera Helpful Notes 2004.
Traditional method 2 means, σ’s unknown. Scientists studying the effect of diet on cognitive ability are comparing two groups of mice. The first group.
BG Spider Tutorial. Notes 1. Save A Lot (possibly after each step in case you make any mistakes – THERE IS NO UNDO, and it gets complicated to correct.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
COMPSCI 101 Principles of Programming Lecture 27 - Using the Canvas widget to draw rows and columns of shapes.
In.  This presentation will only make sense if you view it in presentation mode (hit F5). If you don’t do that there will be multiple slides that are.
Hello! Keep watching … I’ll show you how to use a mouse.
Functions Part I (Syntax). What is a function? A function is a set of statements which is split off into a separate entity that can be used like a “new.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 23 Game Graphics II.
CS 450: COMPUTER GRAPHICS PORTRAIT OF AN OPENGL PROGRAM SPRING 2015 DR. MICHAEL J. REALE.
> 1 Diagrams in Word Faculty of Health Alan Grace.
Does this point lie on this line? The Point-Slope format (y – y 1 ) = m(x – x 1 )
Using Pro-Engineer to Create 3 Dimensional Shapes Kevin Manner Kevin Manner Tim Reynolds Tim Reynolds Thuy Tran Thuy Tran Vuong Nguyen Vuong Nguyen.
Graphic Basics in C ATS 315. The Graphics Window Will look something like this.
Variables Art &Technology, 3rd Semester Aalborg University Programming David Meredith
Recursion Pepper. Another way to loop Call yourself repeatedly until you say to stop. Example: add up 10 numbers using addUp. -- Input – number to count.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Recursion COMP 103 #
Guide For Venture Staff. Why add an attachment? The reason why you would add an attachment is because you can send important documents, videos etc.
ITIP © Ron Poet Lecture 14 1 Responsibilities. ITIP © Ron Poet Lecture 14 2 Two Sections of Code  If we ask two people to work together to do a job,
1 OGRE Programming Intermediate Tutorial: Volume Selection.
1 A Simple Applet. 2 Applets and applications An applet is a Java program that runs on a web page Applets can be run within any modern browser To run.
Microsoft Word Tutorials Created by L. George 2005.
1.Begin by opening VB 2.Click New Project or the icon Hello World Tutorial NOTE: depending on your version of VB – the images might be slightly different.
Functions Part I (Syntax). What is a function? A function is a set of statements which is split off into a separate entity that can be used like a “new.
Stacks and Queues CMSC 201. Stacks and Queues Sometimes, when we use a data-structure in a very specific way, we have a special name for it. This is to.
screen shots Emma Jarman. Adding attachments What is an attachment? An attachment is an that has a file attached to it. The file could be.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 22 Game Graphics.
Software testing techniques Software testing techniques REGRESSION TESTING Presentation on the seminar Kaunas University of Technology.
Design Visualization Software Introduction / Review.
CS 115 Lecture 7 Graphics – coordinate systems, Text, Entry, aliases Taken from notes by Dr. Neil Moore.
SURFACE AREA & VOLUME RECTANGULAR PRISM – AREA RECTANGULAR PRISM – VOLUME.
Recording Your Script and Creating Your Podcast !!You are not finished until you have completed all steps on all of the slides up to and including Slide.
Drawing!. Why Drawing? Drawing is crucial to any graphical application Understanding.
REGRESSION TESTING Audrius Čėsna IFM-0/2. Regression testing is any type of software testing that seeks to uncover new errors, or regressions, in existing.
House Design Using Google Sketchup You will create a four room house containing a living room, bedroom, bathroom, and kitchen.
PyGTK 2.0 Quick Start Guide By Jeremy Bongio. Table of Contents “Overview” of Python Concepts of GTK Implementing pyGTK.
ENGINEERING 1D04 Tutorial 4. What are we doing today? Focus Functions Scope of Variables Returning Values Objects Graphics library Aliasing Events Mouse.
Graphical Output Basic Images.
File Handling Programming Guides.
Fusion 360 Concrete Tea light Holder Tutorial
Lecture 13 Clipping & Scan Conversion
Positioning.
IPC144 Introduction to Programming Using C Week 4 – Lesson 2
Developing a Program.
Presentation transcript:

By JerryDean Smith Chad Adams Karl Mullner

 The rectangle needs to be a ogre.ManualObject -this is done to create the rectangle and gives it special functions that will be used later for the selection of the entities  NOTE: The selection rectangle is always on top of all other objects in the render window

 Methods inside of Selection Rectangle Class  def __init__(self,name):  def drawBox(self, left, top, right, bottom):

 The selection rectangle initialization method has to setup the Render Queue Group and how the rectangle will be viewed  ogre.ManualObject.__init__(self,name)  self.setRenderQueueGroup(ogre.RenderQueue GroupID.RENDER_QUEUE_OVERLAY)  self.setUseIdentityProjection(True)  self.setUseIdentityView(True)  self.setQueryFlags(0)

 The drawBox does a little more than what it says it has to convert the mouse position to be able to hand the center of screen being 0,0 where normally it would be.5,.5  left = left *  right = right *  top = 1 - top * 2  bottom = 1 - bottom * 2

 Then it clears the old rectangle and shows the box. To do this simply type self.clear()  Begin sets up the material and type of shape drawn self.begin("", ogre.RenderOperation.OT_LINE_STRIP) It is important to remember that you need five points when drawing a box you must connect the box back to the beginning  self.position(left, top, -1)  self.position(right, top, -1)  self.position(right, bottom, -1)  self.position(left, bottom, -1)  self.position(left, top, -1)  self.end()

 In the intermediate tutorial we were told to put this into the the end of our drawBox  ## set the bounding box of the object to be infinite, so that the camera will  ## always be inside of it  box = ogre.AxisAlignedBox()  box.setInfinite()  self.setBoundingBox(box)  pass

This is a listener for after the drawBox has completed. This is what puts the selected entities into a list and shows the bounding box of the boats

 def __init__ ( self):  ogre.SceneQueryListener.__init__ ( self )  self.selectObjects = []  def queryResult ( self, firstMovable):  firstMovable.getParentSceneNode().showBoundingBox(True)  self.selectObjects.append(firstMovable)  return True  def deselectObjects(self):  for movableObject in self.selectObjects:  movableObject.getParentSceneNode().showBoundingBox(False)  self.selectObjects = []

This class has the most code crammed into it so be careful when implementing the class basically you will be adding a method called boxSelect and modifying the tick method and some variables in the initialization of the class

 We added these variables to make our lives a lot easier  self.box = SelectionRectangle("Box") #creates the box  self.engine.gfx.sceneManager.getRootSceneNode(). createChildSceneNode().attachObject(self.box) #this to get the positions of all the points inside of the rectangle  self.mVolQuery = self.engine.gfx.sceneManager.createPlaneBounded VolumeQuery(ogre.PlaneBoundedVolumeList())

#don’t have to do this but we wanted to attach the mouse to self so that we could access the mouse coordinates anywhere  self.left = 0.0  self.right = 0.0  self.top = 0.0  self.bottom = 0.0 #toggle for the mouse selection  self.mouseDown = None #gives access to the listener  self.querylistener = PlaneQueryListener()

topLeft = self.engine.gfx.camera.getCameraToViewportRay(self.left, self.top) do this for all the topRight, bottomLeft and bottomRight # this is to get the volume of the planes vol = ogre.PlaneBoundedVolume()

 Do this function for all five points it will be projected into the water plane to the boat selection  p = ogre.Plane( topLeft.getPoint(3),  topRight.getPoint(3),  bottomRight.getPoint(3))

 vol.planes.append(p) ## front plane  vol.planes.append(p2) ## left plane  vol.planes.append(p3) ## bottom plane  vol.planes.append(p4) ## top plane  vol.planes.append(p5) ## right plane  volList = ogre.PlaneBoundedVolumeList()  volList.append(vol)  self.mVolQuery.setVolumes(volList)  self.mVolQuery.execute(self.querylistener)  resultObjects = self.querylistener.selectObjects

 if resultObjects:  for name, ent in self.state.entities.iteritems():  for queryResult in resultObjects:  if queryResult.name == ent.gfxNode.name:  self.state.selectedEntities.append(ent)  print "Appended"

 if currMouse.buttonDown(OIS.MB_Left) and not self.mouseDown:  self.bb(isOn = False)  self.state.selectedEntities = []   self.left = float(currMouse.X.abs)/currMouse.width  self.top = float(currMouse.Y.abs)/currMouse.height  self.right = float(currMouse.X.abs)/currMouse.width  self.bottom = float(currMouse.Y.abs)/currMouse.height

 if currMouse.buttonDown(OIS.MB_Left) and self.mouseDown:  self.right = float(currMouse.X.abs)/currMouse.width  self.bottom = float(currMouse.Y.abs)/currMouse.height  self.box.drawBox(self.left,self.top,self.right,self.bott om)  self.box.setVisible(True)  print self.left,self.right,self.top,self.bottom  print "box drawn"

 if self.mouseDown and not currMouse.buttonDown(OIS.MB_Left):  if (self.left > self.right):  self.left, self.right = self.right, self.left  if (self.top > self.bottom):  self.top, self.bottom = self.bottom, self.top  self.box.setVisible(False)  if ((self.right - self.left) * (self.bottom - self.top) < ):  self.castRay(currMouse)  else:  self.boxSelect()

 if ((currMouse.buttonDown(OIS.MB_Right)) and  (self.toggleSpawn) and not (self.mouseRdown)):  self.spawnRay(currMouse)   self.mouseDown = currMouse.buttonDown(OIS.MB_Left)  self.mouseRdown = currMouse.buttonDown(OIS.MB_Right)