Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2009-05-20 09:33:39 +0400
committerDalai Felinto <dfelinto@gmail.com>2009-05-20 09:33:39 +0400
commitdc6ae673b1d95d28c4fab4dbfbd9947d4a6c3bb2 (patch)
tree66e3d7b21af2a3bace141e9bbec24d9ccbb2607d /source/gameengine/PyDoc
parentfc9f893306c359c8a9102745840d749f056fcbed (diff)
Moving ScreenSpace methods from Rasterizer to KX_Camera (getScreenPos, getScreenVect, getScreenRay)
The modules were moved in order to access the camera internal matrixes. It will make then compatible with multiple viewports in a near future. So far the problem I found was: 1) KX_Camera doesn't store the canvas viewport 2) RAS_ICanvas methods: GetDisplayArea and GetWindowArea are affected by multiple viewports (and they shouldn't). Test file is here: http://www.pasteall.org/blend/68
Diffstat (limited to 'source/gameengine/PyDoc')
-rw-r--r--source/gameengine/PyDoc/GameTypes.py43
-rw-r--r--source/gameengine/PyDoc/Rasterizer.py44
2 files changed, 43 insertions, 44 deletions
diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py
index 5ec6f31e30c..b5dc89e4002 100644
--- a/source/gameengine/PyDoc/GameTypes.py
+++ b/source/gameengine/PyDoc/GameTypes.py
@@ -5555,6 +5555,49 @@ class KX_Camera(KX_GameObject):
@type right: int
@type top: int
"""
+ def getScreenPosition(arg):
+ """
+ Gets the position of an object projected on screen space.
+
+ Example:
+ # For an object in the middle of the screen, coord = [0.5,0.5]
+ coord = camera.getScreenPosition(object)
+
+ @param arg: L{KX_GameObject}, object name or list [x, y, z]
+ @rtype: list [x, y]
+ @return: the object's position in screen coordinates.
+ """
+ def getScreenVect(x, y):
+ """
+ Gets the vector from the camera position in the screen coordinate direction.
+
+ Example:
+ # Gets the vector of the camera front direction:
+ m_vect = camera.getScreenVect(0.5,0.5)
+
+ @type x: float
+ @type y: float
+ @rtype: 3d vector
+ @return: the vector from a screen coordinate.
+ """
+ def getScreenRay(x, y, dist, property):
+ """
+ Look towards a screen coordinate (x,y) and find first object hit within dist that matches prop.
+ The ray is similar to KX_GameObject->rayCastTo.
+
+ Example:
+ # Gets an object with a property "wall" in front of the camera within a distance of 100:
+ target = camera.getScreenRay(0.5,0.5,100,"wall")
+
+ @type x: float
+ @type y: float
+ @param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
+ @type dist: float
+ @param property: property name that object must have; can be omitted => detect any object
+ @type property: string
+ @rtype: L{KX_GameObject}
+ @return: the first object hit or None if no object or object does not match prop
+ """
# Util func to extract all attrs
"""
diff --git a/source/gameengine/PyDoc/Rasterizer.py b/source/gameengine/PyDoc/Rasterizer.py
index 25877364836..bafcfece473 100644
--- a/source/gameengine/PyDoc/Rasterizer.py
+++ b/source/gameengine/PyDoc/Rasterizer.py
@@ -43,50 +43,6 @@ Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement M
@var KX_BLENDER_GLSL_MATERIAL: Materials approximating blender materials with GLSL.
"""
-
-def getScreenPosition(arg):
- """
- Gets the position of an object projected on screen space.
-
- Example:
- # For an object in the middle of the screen, coord = [0.5,0.5]
- coord = Rasterizer.getScreenPosition(object)
-
- @param arg: L{KX_GameObject}, object name or list [x, y, z]
- @rtype: list [x, y]
- @return: the object's position in screen coordinates.
- """
-def getScreenVect(x, y):
- """
- Gets the vector from the camera position in the screen coordinate direction.
-
- Example:
- # Gets the vector of the camera front direction:
- m_vect = Rasterizer.getScreenVect(0.5,0.5)
-
- @type x: float
- @type y: float
- @rtype: 3d vector
- @return: the vector from a screen coordinate.
- """
-def getScreenRay(x, y, dist, property):
- """
- Look towards a screen coordinate (x,y) and find first object hit within dist that matches prop.
- The ray is similar to KX_GameObject->rayCastTo.
-
- Example:
- # Gets an object with a property "wall" in front of the camera within a distance of 100:
- target = Rasterizer.getScreenRay(0.5,0.5,100,"wall")
-
- @type x: float
- @type y: float
- @param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
- @type dist: float
- @param property: property name that object must have; can be omitted => detect any object
- @type property: string
- @rtype: L{KX_GameObject}
- @return: the first object hit or None if no object or object does not match prop
- """
def getWindowWidth():
"""
Gets the width of the window (in pixels)