Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added worldToEye, worldToEyeDepth and worldToNdc

  • Loading branch information...
commit 5fa63a092e7253be180085a7154941e66bb59519 1 parent 4a7a05c
@chaoticbob chaoticbob authored
Showing with 19 additions and 10 deletions.
  1. +10 −1 include/cinder/Camera.h
  2. +9 −9 xcode/cinder.xcodeproj/project.pbxproj
View
11 include/cinder/Camera.h
@@ -79,7 +79,16 @@ class Camera
Ray generateRay( float u, float v, float imagePlaneAspectRatio ) const;
void getBillboardVectors( Vec3f *right, Vec3f *up ) const;
- Vec2f worldToScreen( const Vec3f &worldCoord, float screenWidth, float screenHeight ) const;
+
+ //! Converts a world-space coordinate \a worldCoord to screen coordinates as viewed by the camera, based ona s screen which is \a screenWidth x \a screenHeight pixels.
+ Vec2f worldToScreen( const Vec3f &worldCoord, float screenWidth, float screenHeight ) const;
+ //! Converts a world-space coordinate \a worldCoord to eye-space, also known as camera-space. -Z is along the view direction.
+ Vec3f worldToEye( const Vec3f &worldCoord ) { return getModelViewMatrix().transformPointAffine( worldCoord ); }
+ //! Converts a world-space coordinate \a worldCoord to the z axis of eye-space, also known as camera-space. -Z is along the view direction. Suitable for depth sorting.
+ float worldToEyeDepth( const Vec3f &worldCoord ) { return mModelViewMatrix.m[2] * worldCoord.x + mModelViewMatrix.m[6] * worldCoord.y + mModelViewMatrix.m[10] * worldCoord.z + mModelViewMatrix.m[14]; }
+ //! Converts a world-space coordinate \a worldCoord to normalized device coordinates
+ Vec3f worldToNdc( const Vec3f &worldCoord ) { Vec3f eye = getModelViewMatrix().transformPointAffine( worldCoord ); return mProjectionMatrix.transformPoint( eye ); }
+
float getScreenRadius( const class Sphere &sphere, float screenWidth, float screenHeight ) const;
View
18 xcode/cinder.xcodeproj/project.pbxproj
@@ -688,7 +688,7 @@
0062484E122F607500039A7A /* Function.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Function.h; sourceTree = "<group>"; };
006A1EC611D7F39B00941A5E /* MovieWriter.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = MovieWriter.cpp; path = qtime/MovieWriter.cpp; sourceTree = "<group>"; };
006A1EC811D7F3AC00941A5E /* MovieWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MovieWriter.h; path = qtime/MovieWriter.h; sourceTree = "<group>"; };
- 007050BE1114F93F003FCAE4 /* libcinder-iphone_d.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcinder-iphone_d.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 007050BE1114F93F003FCAE4 /* libcinder-iphone.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcinder-iphone.a"; sourceTree = BUILT_PRODUCTS_DIR; };
0071BD040FB9F4AD0092E7D6 /* Display.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Display.h; sourceTree = "<group>"; };
0071BD080FB9FA2C0092E7D6 /* Display.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = Display.cpp; sourceTree = "<group>"; };
007438400EA7924F005DD3E6 /* Capture.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = Capture.cpp; sourceTree = "<group>"; };
@@ -772,7 +772,7 @@
00CE73920E92DBE40059E09B /* gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gl.h; path = gl/gl.h; sourceTree = "<group>"; };
00CE73930E92DBE40059E09B /* GLee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GLee.h; path = gl/GLee.h; sourceTree = "<group>"; };
00CE73970E92DBF80059E09B /* gl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = gl.cpp; path = gl/gl.cpp; sourceTree = "<group>"; };
- 00CFD9E11135C3520091E310 /* libcinder-iphone-sim_d.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcinder-iphone-sim_d.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 00CFD9E11135C3520091E310 /* libcinder-iphone-sim.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcinder-iphone-sim.a"; sourceTree = BUILT_PRODUCTS_DIR; };
00CFE37B113B85F60091E310 /* Path2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Path2d.h; sourceTree = "<group>"; };
00CFE37C113B85F60091E310 /* Thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Thread.h; sourceTree = "<group>"; };
00D23A530EAEB4C00002BF91 /* Color.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = "<group>"; };
@@ -843,7 +843,7 @@
C7FB1BB0124BE31E0045AFD2 /* InputImplAudioUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputImplAudioUnit.h; sourceTree = "<group>"; };
C7FB1BB1124BE31E0045AFD2 /* OutputImplAudioUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputImplAudioUnit.h; sourceTree = "<group>"; };
C7FB1BB2124BE31E0045AFD2 /* PcmBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcmBuffer.h; sourceTree = "<group>"; };
- D2AAC07E0554694100DB518D /* libcinder_d.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcinder_d.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ D2AAC07E0554694100DB518D /* libcinder.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcinder.a; sourceTree = BUILT_PRODUCTS_DIR; };
D2F7E8BE07B2D77200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
EAC3D1A81011F2E700FFBC9E /* Serial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Serial.h; sourceTree = "<group>"; };
EAC3D1AB1011F3AC00FFBC9E /* Serial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Serial.cpp; sourceTree = "<group>"; };
@@ -1284,9 +1284,9 @@
034768DFFF38A50411DB9C8B /* Products */ = {
isa = PBXGroup;
children = (
- D2AAC07E0554694100DB518D /* libcinder_d.a */,
- 007050BE1114F93F003FCAE4 /* libcinder-iphone_d.a */,
- 00CFD9E11135C3520091E310 /* libcinder-iphone-sim_d.a */,
+ D2AAC07E0554694100DB518D /* libcinder.a */,
+ 007050BE1114F93F003FCAE4 /* libcinder-iphone.a */,
+ 00CFD9E11135C3520091E310 /* libcinder-iphone-sim.a */,
);
name = Products;
sourceTree = "<group>";
@@ -1760,7 +1760,7 @@
);
name = cinder_iphone;
productName = cinder;
- productReference = 007050BE1114F93F003FCAE4 /* libcinder-iphone_d.a */;
+ productReference = 007050BE1114F93F003FCAE4 /* libcinder-iphone.a */;
productType = "com.apple.product-type.library.static";
};
00CFD92C1135C3520091E310 /* cinder_iphone_sim */ = {
@@ -1777,7 +1777,7 @@
);
name = cinder_iphone_sim;
productName = cinder;
- productReference = 00CFD9E11135C3520091E310 /* libcinder-iphone-sim_d.a */;
+ productReference = 00CFD9E11135C3520091E310 /* libcinder-iphone-sim.a */;
productType = "com.apple.product-type.library.static";
};
D2AAC07D0554694100DB518D /* cinder */ = {
@@ -1794,7 +1794,7 @@
);
name = cinder;
productName = cinder;
- productReference = D2AAC07E0554694100DB518D /* libcinder_d.a */;
+ productReference = D2AAC07E0554694100DB518D /* libcinder.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
Please sign in to comment.
Something went wrong with that request. Please try again.