use composite bld

This commit is contained in:
cxgeorge 2002-02-01 02:18:21 +00:00
parent a5a770b622
commit 704e907451
5 changed files with 43 additions and 30 deletions

View File

@ -6,13 +6,18 @@
#define LOCAL_LIBS \ #define LOCAL_LIBS \
sgraphutil sgraph sgattrib gobj linmath sgraphutil sgraph sgattrib gobj linmath
#define SOURCES \ #define COMBINED_SOURCES $[TARGET]_composite1.cxx
config_distort.cxx config_distort.h \
cylindricalLens.cxx cylindricalLens.h cylindricalLens.I \ #define SOURCES config_distort.h \
fisheyeLens.cxx fisheyeLens.h fisheyeLens.I \ projectionScreen.h projectionScreen.I \
nonlinearImager.cxx nonlinearImager.h nonlinearImager.I \ cylindricalLens.h cylindricalLens.I \
pSphereLens.cxx pSphereLens.h pSphereLens.I \ fisheyeLens.h fisheyeLens.I \
projectionScreen.cxx projectionScreen.h projectionScreen.I nonlinearImager.h nonlinearImager.I \
pSphereLens.h pSphereLens.I
#define INCLUDED_SOURCES \
config_distort.cxx cylindricalLens.cxx fisheyeLens.cxx nonlinearImager.cxx \
projectionScreen.cxx pSphereLens.cxx
#define INSTALL_HEADERS #define INSTALL_HEADERS

View File

@ -23,8 +23,8 @@ TypeHandle CylindricalLens::_type_handle;
// This is the focal-length constant for fisheye lenses. See // This is the focal-length constant for fisheye lenses. See
// fisheyeLens.cxx. // fisheyeLens.cxx.
static const float k = 60.0f; static const float cylindrical_k = 60.0f;
// focal_length = film_size * k / fov; // focal_length = film_size * cylindrical_k / fov;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -61,7 +61,7 @@ extrude_impl(const LPoint3f &point2d, LPoint3f &near_point, LPoint3f &far_point)
LPoint3f f = point2d * get_film_mat_inv(); LPoint3f f = point2d * get_film_mat_inv();
float focal_length = get_focal_length(); float focal_length = get_focal_length();
float angle = f[0] * k / focal_length; float angle = f[0] * cylindrical_k / focal_length;
float sinAngle, cosAngle; float sinAngle, cosAngle;
csincos(deg_2_rad(angle), &sinAngle, &cosAngle); csincos(deg_2_rad(angle), &sinAngle, &cosAngle);
@ -118,7 +118,7 @@ project_impl(const LPoint3f &point3d, LPoint3f &point2d) const {
point2d.set point2d.set
( (
// The x position is the angle about the Z axis. // The x position is the angle about the Z axis.
rad_2_deg(catan2(xy[0], xy[1])) * focal_length / k, rad_2_deg(catan2(xy[0], xy[1])) * focal_length / cylindrical_k,
// The y position is the Z height divided by the perspective // The y position is the Z height divided by the perspective
// distance. // distance.
p[2] * focal_length / pdist, p[2] * focal_length / pdist,
@ -147,7 +147,7 @@ project_impl(const LPoint3f &point3d, LPoint3f &point2d) const {
float CylindricalLens:: float CylindricalLens::
fov_to_film(float fov, float focal_length, bool horiz) const { fov_to_film(float fov, float focal_length, bool horiz) const {
if (horiz) { if (horiz) {
return focal_length * fov / k; return focal_length * fov / cylindrical_k;
} else { } else {
return (ctan(deg_2_rad(fov * 0.5f)) * focal_length) * 2.0f; return (ctan(deg_2_rad(fov * 0.5f)) * focal_length) * 2.0f;
} }
@ -165,7 +165,7 @@ fov_to_film(float fov, float focal_length, bool horiz) const {
float CylindricalLens:: float CylindricalLens::
fov_to_focal_length(float fov, float film_size, bool horiz) const { fov_to_focal_length(float fov, float film_size, bool horiz) const {
if (horiz) { if (horiz) {
return film_size * k / fov; return film_size * cylindrical_k / fov;
} else { } else {
return film_size * 0.5f / ctan(deg_2_rad(fov * 0.5f)); return film_size * 0.5f / ctan(deg_2_rad(fov * 0.5f));
} }
@ -183,7 +183,7 @@ fov_to_focal_length(float fov, float film_size, bool horiz) const {
float CylindricalLens:: float CylindricalLens::
film_to_fov(float film_size, float focal_length, bool horiz) const { film_to_fov(float film_size, float focal_length, bool horiz) const {
if (horiz) { if (horiz) {
return film_size * k / focal_length; return film_size * cylindrical_k / focal_length;
} else { } else {
return rad_2_deg(catan(film_size * 0.5f / focal_length)) * 2.0f; return rad_2_deg(catan(film_size * 0.5f / focal_length)) * 2.0f;
} }

View File

@ -0,0 +1,8 @@
#include "config_distort.cxx"
#include "cylindricalLens.cxx"
#include "fisheyeLens.cxx"
#include "pSphereLens.cxx"
#include "nonlinearImager.cxx"
#include "projectionScreen.cxx"

View File

@ -36,8 +36,8 @@ TypeHandle FisheyeLens::_type_handle;
// know how well this extends to other lenses and other negative // know how well this extends to other lenses and other negative
// sizes. // sizes.
static const float k = 60.0f; static const float fisheye_k = 60.0f;
// focal_length = film_size * k / fov; // focal_length = film_size * fisheye_k / fov;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -89,7 +89,7 @@ extrude_impl(const LPoint3f &point2d, LPoint3f &near_point, LPoint3f &far_point)
// Now get the point r units around the circle in the YZ plane. // Now get the point r units around the circle in the YZ plane.
float focal_length = get_focal_length(); float focal_length = get_focal_length();
float angle = r * k / focal_length; float angle = r * fisheye_k / focal_length;
float sinAngle, cosAngle; float sinAngle, cosAngle;
csincos(deg_2_rad(angle), &sinAngle, &cosAngle); csincos(deg_2_rad(angle), &sinAngle, &cosAngle);
@ -166,7 +166,7 @@ project_impl(const LPoint3f &point3d, LPoint3f &point2d) const {
float r = 90.0f - rad_2_deg(catan2(x[0], x[1])); float r = 90.0f - rad_2_deg(catan2(x[0], x[1]));
float focal_length = get_focal_length(); float focal_length = get_focal_length();
float factor = r * focal_length / k; float factor = r * focal_length / fisheye_k;
point2d.set point2d.set
(y[0] * factor, (y[0] * factor,
@ -195,7 +195,7 @@ project_impl(const LPoint3f &point3d, LPoint3f &point2d) const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
float FisheyeLens:: float FisheyeLens::
fov_to_film(float fov, float focal_length, bool) const { fov_to_film(float fov, float focal_length, bool) const {
return focal_length * fov / k; return focal_length * fov / fisheye_k;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -209,7 +209,7 @@ fov_to_film(float fov, float focal_length, bool) const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
float FisheyeLens:: float FisheyeLens::
fov_to_focal_length(float fov, float film_size, bool) const { fov_to_focal_length(float fov, float film_size, bool) const {
return film_size * k / fov; return film_size * fisheye_k / fov;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -223,6 +223,6 @@ fov_to_focal_length(float fov, float film_size, bool) const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
float FisheyeLens:: float FisheyeLens::
film_to_fov(float film_size, float focal_length, bool) const { film_to_fov(float film_size, float focal_length, bool) const {
return film_size * k / focal_length; return film_size * fisheye_k / focal_length;
} }

View File

@ -23,8 +23,8 @@ TypeHandle PSphereLens::_type_handle;
// This is the focal-length constant for fisheye lenses. See // This is the focal-length constant for fisheye lenses. See
// fisheyeLens.cxx. // fisheyeLens.cxx.
static const float k = 60.0f; static const float spherical_k = 60.0f;
// focal_length = film_size * k / fov; // focal_length = film_size * spherical_k / fov;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -65,8 +65,8 @@ extrude_impl(const LPoint3f &point2d, LPoint3f &near_point, LPoint3f &far_point)
// Rotate the forward vector through the rotation angles // Rotate the forward vector through the rotation angles
// corresponding to this point. // corresponding to this point.
LPoint3f v = LPoint3f(0.0f, 1.0f, 0.0f) * LPoint3f v = LPoint3f(0.0f, 1.0f, 0.0f) *
LMatrix3f::rotate_mat(f[1] * k / focal_length, LVector3f(1.0f, 0.0f, 0.0f)) * LMatrix3f::rotate_mat(f[1] * spherical_k / focal_length, LVector3f(1.0f, 0.0f, 0.0f)) *
LMatrix3f::rotate_mat(f[0] * k / focal_length, LVector3f(0.0f, 0.0f, -1.0f)); LMatrix3f::rotate_mat(f[0] * spherical_k / focal_length, LVector3f(0.0f, 0.0f, -1.0f));
// And we'll need to account for the lens's rotations, etc. at the // And we'll need to account for the lens's rotations, etc. at the
// end of the day. // end of the day.
@ -121,9 +121,9 @@ project_impl(const LPoint3f &point3d, LPoint3f &point2d) const {
point2d.set point2d.set
( (
// The x position is the angle about the Z axis. // The x position is the angle about the Z axis.
rad_2_deg(catan2(xy[0], xy[1])) * focal_length / k, rad_2_deg(catan2(xy[0], xy[1])) * focal_length / spherical_k,
// The y position is the angle about the X axis. // The y position is the angle about the X axis.
rad_2_deg(catan2(yz[1], yz[0])) * focal_length / k, rad_2_deg(catan2(yz[1], yz[0])) * focal_length / spherical_k,
// Z is the distance scaled into the range (1, -1). // Z is the distance scaled into the range (1, -1).
(get_near() - dist) / (get_far() - get_near()) (get_near() - dist) / (get_far() - get_near())
); );
@ -148,7 +148,7 @@ project_impl(const LPoint3f &point3d, LPoint3f &point2d) const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
float PSphereLens:: float PSphereLens::
fov_to_film(float fov, float focal_length, bool) const { fov_to_film(float fov, float focal_length, bool) const {
return focal_length * fov / k; return focal_length * fov / spherical_k;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -162,7 +162,7 @@ fov_to_film(float fov, float focal_length, bool) const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
float PSphereLens:: float PSphereLens::
fov_to_focal_length(float fov, float film_size, bool) const { fov_to_focal_length(float fov, float film_size, bool) const {
return film_size * k / fov; return film_size * spherical_k / fov;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -176,5 +176,5 @@ fov_to_focal_length(float fov, float film_size, bool) const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
float PSphereLens:: float PSphereLens::
film_to_fov(float film_size, float focal_length, bool) const { film_to_fov(float film_size, float focal_length, bool) const {
return film_size * k / focal_length; return film_size * spherical_k / focal_length;
} }