diff --git a/panda/src/display/graphicsOutput.cxx b/panda/src/display/graphicsOutput.cxx index 17f627e30f..870f17e06a 100644 --- a/panda/src/display/graphicsOutput.cxx +++ b/panda/src/display/graphicsOutput.cxx @@ -1144,7 +1144,7 @@ get_supports_render_texture() const { //////////////////////////////////////////////////////////////////// // Function: GraphicsOutput::flip_ready -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns true if a frame has been rendered and needs // to be flipped, false otherwise. //////////////////////////////////////////////////////////////////// @@ -1155,7 +1155,7 @@ flip_ready() const { //////////////////////////////////////////////////////////////////// // Function: GraphicsOutput::get_host -// Access: Public, Virtual +// Access: Published, Virtual // Description: This is normally called only from within // make_texture_buffer(). When called on a // ParasiteBuffer, it returns the host of that buffer; diff --git a/panda/src/display/graphicsOutput.h b/panda/src/display/graphicsOutput.h index a0222e8368..28348ac536 100644 --- a/panda/src/display/graphicsOutput.h +++ b/panda/src/display/graphicsOutput.h @@ -215,14 +215,16 @@ PUBLISHED: virtual bool get_supports_render_texture() const; -public: - // These are not intended to be called directly by the user. +PUBLISHED: + // These are not intended to be called directly by the user, but + // they're published anyway since they might occasionally be useful + // for low-level debugging. virtual bool flip_ready() const; - - INLINE bool operator < (const GraphicsOutput &other) const; - virtual GraphicsOutput *get_host(); +public: + INLINE bool operator < (const GraphicsOutput &other) const; + virtual void request_open(); virtual void request_close(); diff --git a/panda/src/distort/cylindricalLens.cxx b/panda/src/distort/cylindricalLens.cxx index 23baab9fd6..53f2fb432c 100644 --- a/panda/src/distort/cylindricalLens.cxx +++ b/panda/src/distort/cylindricalLens.cxx @@ -121,8 +121,8 @@ do_extrude_vec(const Lens::CData *lens_cdata, const LPoint3 &point2d, LVector3 & // (-1,-1) is the lower-left corner. // // Some lens types also set the z coordinate of the 2-d -// point to a value in the range (-1, 1), where 1 -// represents a point on the near plane, and -1 +// point to a value in the range (-1, 1), where -1 +// represents a point on the near plane, and 1 // represents a point on the far plane. // // Returns true if the 3-d point is in front of the lens @@ -159,8 +159,8 @@ do_project(const Lens::CData *lens_cdata, const LPoint3 &point3d, LPoint3 &point // The y position is the Z height divided by the perspective // distance. p[2] * focal_length / pdist, - // Z is the distance scaled into the range 1 .. -1. - 1.0 - 2.0 * z + // Z is the distance scaled into the range -1 .. 1. + 2.0 * z - 1.0 ); // Now we have to transform the point according to the film diff --git a/panda/src/distort/fisheyeLens.cxx b/panda/src/distort/fisheyeLens.cxx index 3818299f0a..5e5131977f 100644 --- a/panda/src/distort/fisheyeLens.cxx +++ b/panda/src/distort/fisheyeLens.cxx @@ -149,8 +149,8 @@ do_extrude_vec(const Lens::CData *lens_cdata, const LPoint3 &point2d, LVector3 & // (-1,-1) is the lower-left corner. // // Some lens types also set the z coordinate of the 2-d -// point to a value in the range (-1, 1), where 1 -// represents a point on the near plane, and -1 +// point to a value in the range (-1, 1), where -1 +// represents a point on the near plane, and 1 // represents a point on the far plane. // // Returns true if the 3-d point is in front of the lens @@ -204,8 +204,8 @@ do_project(const Lens::CData *lens_cdata, const LPoint3 &point3d, LPoint3 &point point2d.set (y[0] * factor, y[1] * factor, - // Z is the distance scaled into the range 1 .. -1. - 1.0 - 2.0 * z + // Z is the distance scaled into the range -1 .. 1. + 2.0 * z - 1.0 ); // Now we have to transform the point according to the film diff --git a/panda/src/distort/oSphereLens.cxx b/panda/src/distort/oSphereLens.cxx index c106073356..5fe3d7ace5 100755 --- a/panda/src/distort/oSphereLens.cxx +++ b/panda/src/distort/oSphereLens.cxx @@ -90,8 +90,8 @@ do_extrude(const Lens::CData *lens_cdata, // (-1,-1) is the lower-left corner. // // Some lens types also set the z coordinate of the 2-d -// point to a value in the range (-1, 1), where 1 -// represents a point on the near plane, and -1 +// point to a value in the range (-1, 1), where -1 +// represents a point on the near plane, and 1 // represents a point on the far plane. // // Returns true if the 3-d point is in front of the lens @@ -126,8 +126,8 @@ do_project(const Lens::CData *lens_cdata, const LPoint3 &point3d, LPoint3 &point rad_2_deg(catan2(xy[0], xy[1])) * focal_length / ospherical_k, // The y position is the Z height. p[2], - // Z is the distance scaled into the range 1 .. -1. - 1.0 - 2.0 * z + // Z is the distance scaled into the range -1 .. 1. + 2.0 * z - 1.0 ); // Now we have to transform the point according to the film diff --git a/panda/src/distort/pSphereLens.cxx b/panda/src/distort/pSphereLens.cxx index abf1eb38f9..757d677bb5 100644 --- a/panda/src/distort/pSphereLens.cxx +++ b/panda/src/distort/pSphereLens.cxx @@ -83,8 +83,8 @@ do_extrude(const Lens::CData *lens_cdata, // (-1,-1) is the lower-left corner. // // Some lens types also set the z coordinate of the 2-d -// point to a value in the range (-1, 1), where 1 -// represents a point on the near plane, and -1 +// point to a value in the range (-1, 1), where -1 +// represents a point on the near plane, and 1 // represents a point on the far plane. // // Returns true if the 3-d point is in front of the lens @@ -124,8 +124,8 @@ do_project(const Lens::CData *lens_cdata, const LPoint3 &point3d, LPoint3 &point rad_2_deg(catan2(xy[0], xy[1])) * focal_length / pspherical_k, // The y position is the angle about the X axis. rad_2_deg(catan2(yz[1], yz[0])) * focal_length / pspherical_k, - // Z is the distance scaled into the range 1 .. -1. - 1.0 - 2.0 * z + // Z is the distance scaled into the range -1 .. 1. + 2.0 * z - 1.0 ); // Now we have to transform the point according to the film diff --git a/panda/src/gobj/lens.cxx b/panda/src/gobj/lens.cxx index 04839e9545..3f903a68c0 100644 --- a/panda/src/gobj/lens.cxx +++ b/panda/src/gobj/lens.cxx @@ -1254,7 +1254,11 @@ do_extrude_depth(const CData *cdata, const LPoint3 &point2d, LPoint3 &point3d) const { LPoint3 near_point, far_point; bool result = extrude(point2d, near_point, far_point); - point3d = near_point + (far_point - near_point) * point2d[2]; + + // The depth point is, by convention, in the range -1 to 1. Scale + // this to 0 .. 1 for the linear interpolation. + PN_stdfloat t = point2d[2] * 0.5 + 0.5; + point3d = near_point + (far_point - near_point) * t; return result; } @@ -1317,8 +1321,8 @@ do_extrude_vec(const CData *cdata, const LPoint3 &point2d, LVector3 &vec) const // (-1,-1) is the lower-left corner. // // The z coordinate will also be set to a value in the -// range (-1, 1), where 1 represents a point on the near -// plane, and -1 represents a point on the far plane. +// range (-1, 1), where -1 represents a point on the near +// plane, and 1 represents a point on the far plane. // // Returns true if the 3-d point is in front of the lens // and within the viewing frustum (in which case point2d diff --git a/panda/src/grutil/pfmVizzer.cxx b/panda/src/grutil/pfmVizzer.cxx index f808c5cf17..44ab51cede 100644 --- a/panda/src/grutil/pfmVizzer.cxx +++ b/panda/src/grutil/pfmVizzer.cxx @@ -92,8 +92,8 @@ extrude(const Lens *lens) { static LMatrix4 from_uv(2.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - -1.0, -1.0, 0.0, 1.0); + 0.0, 0.0, 2.0, 0.0, + -1.0, -1.0, -1.0, 1.0); PfmFile result; result.clear(_pfm.get_x_size(), _pfm.get_y_size(), 3);