[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash libbase/postscript.cpp libbase/triangulat...
From: |
Markus Gothe |
Subject: |
[Gnash-commit] gnash libbase/postscript.cpp libbase/triangulat... |
Date: |
Thu, 12 Oct 2006 14:05:42 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Markus Gothe <nihilus> 06/10/12 14:05:42
Modified files:
libbase : postscript.cpp triangulate_impl.h tu_math.h
utility.h
libgeometry : collision.cpp cull.cpp geometry.cpp
kd_tree_dynamic.cpp kd_tree_packed.cpp
Log message:
Reverted the prevous approach since GCC have a tendency to inline those
functions. Better to #ifdef __GNUC__.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/postscript.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/triangulate_impl.h?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tu_math.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/utility.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/collision.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/cull.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/geometry.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/kd_tree_dynamic.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/kd_tree_packed.cpp?cvsroot=gnash&r1=1.8&r2=1.9
Patches:
Index: libbase/postscript.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/postscript.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libbase/postscript.cpp 12 Oct 2006 13:45:26 -0000 1.8
+++ libbase/postscript.cpp 12 Oct 2006 14:05:42 -0000 1.9
@@ -271,10 +271,10 @@
void postscript::update(float x, float y)
// enlarge the bounding box if necessary.
{
- if (x < m_x0) m_x0 = std::floorf(x);
- if (x > m_x1) m_x1 = std::ceilf(x);
- if (y < m_y0) m_y0 = std::floorf(y);
- if (y > m_y1) m_y1 = std::ceilf(y);
+ if (x < m_x0) m_x0 = floorf(x);
+ if (x > m_x1) m_x1 = ceilf(x);
+ if (y < m_y0) m_y0 = floorf(y);
+ if (y > m_y1) m_y1 = ceilf(y);
m_empty = false;
}
Index: libbase/triangulate_impl.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/triangulate_impl.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- libbase/triangulate_impl.h 12 Oct 2006 13:45:26 -0000 1.20
+++ libbase/triangulate_impl.h 12 Oct 2006 14:05:42 -0000 1.21
@@ -24,7 +24,7 @@
// code, see the FIST web page at:
// http://www.cosy.sbg.ac.at/~held/projects/triang/triang.html
-/* $Id: triangulate_impl.h,v 1.20 2006/10/12 13:45:26 nihilus Exp $ */
+/* $Id: triangulate_impl.h,v 1.21 2006/10/12 14:05:42 nihilus Exp $ */
#include "utility.h"
#include "triangulate.h"
@@ -1226,13 +1226,13 @@
int y_cells = 1;
if (sorted_verts.size() > 0)
{
- const float GRID_SCALE = std::sqrtf(0.5f);
+ const float GRID_SCALE = sqrtf(0.5f);
coord_t width = bound_of_all_verts.get_width();
coord_t height = bound_of_all_verts.get_height();
float area = float(width) * float(height);
if (area > 0)
{
- float sqrt_n = std::sqrt((float) sorted_verts.size());
+ float sqrt_n = sqrt((float) sorted_verts.size());
float w = width * width / area * GRID_SCALE;
float h = height * height / area * GRID_SCALE;
x_cells = int(w * sqrt_n);
@@ -1334,13 +1334,13 @@
int y_cells = 1;
if (reflex_vert_count > 0)
{
- const float GRID_SCALE = std::sqrtf(0.5f);
+ const float GRID_SCALE = sqrtf(0.5f);
coord_t width = reflex_bound.get_width();
coord_t height = reflex_bound.get_height();
float area = float(width) * float(height);
if (area > 0)
{
- float sqrt_n = std::sqrt((float) reflex_vert_count);
+ float sqrt_n = sqrt((float) reflex_vert_count);
float w = width * width / area * GRID_SCALE;
float h = height * height / area * GRID_SCALE;
x_cells = int(w * sqrt_n);
Index: libbase/tu_math.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/tu_math.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- libbase/tu_math.h 12 Oct 2006 13:45:26 -0000 1.13
+++ libbase/tu_math.h 12 Oct 2006 14:05:42 -0000 1.14
@@ -26,6 +26,19 @@
#define expf exp
#define fabsf fabs
#define powf pow
+#elif !defined(__GNUC__) //Non gnuism...
+ #define sinf std::sinf
+ #define cosf std::cosf
+ #define tanf std::tanf
+ #define asinf std::asinf
+ #define acosf std::acosf
+ #define atanf std::atanf
+ #define atan2f std::atan2f
+ #define sqrtf std::sqrtf
+ #define logf std::logf
+ #define expf std::expf
+ #define fabsf std::fabsf
+ #define powf std::powf
#endif
// isfinite() comes with C99; fake version here in case compiler lacks it.
Index: libbase/utility.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/utility.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- libbase/utility.h 12 Oct 2006 13:45:26 -0000 1.17
+++ libbase/utility.h 12 Oct 2006 14:05:42 -0000 1.18
@@ -92,7 +92,7 @@
inline float flerp(float a, float b, float f) { return (b - a) * f + a; }
const float LN_2 = 0.693147180559945f;
-inline float log2(float f) { return std::logf(f) / LN_2; }
+inline float log2(float f) { return logf(f) / LN_2; }
inline int fchop( float f ) { return (int) f; } // replace w/ inline
asm if desired
inline int frnd(float f) { return fchop(f + 0.5f); } // replace with
inline asm if desired
Index: libgeometry/collision.cpp
===================================================================
RCS file: /sources/gnash/gnash/libgeometry/collision.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libgeometry/collision.cpp 12 Oct 2006 13:45:26 -0000 1.9
+++ libgeometry/collision.cpp 12 Oct 2006 14:05:42 -0000 1.10
@@ -55,7 +55,7 @@
{
// m_inv_dir
float comp = m_dir[i];
- if (std::fabsf(comp) <= DANGER_LIMIT_MIN)
+ if (fabsf(comp) <= DANGER_LIMIT_MIN)
{
m_inv_dir[i] = -FLT_MAX; // arbitrary crap
m_dir[i] = 0; // don't tolerate tiny tiny component.
Client code will know not to use this axis.
@@ -67,7 +67,7 @@
// m_inv_displacement
comp = disp[i];
- if (std::fabsf(comp) <= DANGER_LIMIT_MIN)
+ if (fabsf(comp) <= DANGER_LIMIT_MIN)
{
m_inv_displacement[i] = -FLT_MAX; // arbitrary
crap
m_dir[i] = 0; // don't tolerate tiny tiny component.
Client code will know not to use this axis.
Index: libgeometry/cull.cpp
===================================================================
RCS file: /sources/gnash/gnash/libgeometry/cull.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libgeometry/cull.cpp 12 Oct 2006 13:45:26 -0000 1.6
+++ libgeometry/cull.cpp 12 Oct 2006 14:05:42 -0000 1.7
@@ -29,9 +29,9 @@
const plane_info& p = frustum[i];
// Check box against this plane.
float d = p.normal * center - p.d;
- float extent_toward_plane = std::fabsf(extent.get_x() *
p.normal.get_x())
- + std::fabsf(extent.get_y() * p.normal.get_y())
- + std::fabsf(extent.get_z() * p.normal.get_z());
+ float extent_toward_plane = fabsf(extent.get_x() *
p.normal.get_x())
+ + fabsf(extent.get_y() * p.normal.get_y())
+ + fabsf(extent.get_z() * p.normal.get_z());
if (d < 0) {
if (-d > extent_toward_plane) {
// Box is culled by plane; it's not visible.
Index: libgeometry/geometry.cpp
===================================================================
RCS file: /sources/gnash/gnash/libgeometry/geometry.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libgeometry/geometry.cpp 12 Oct 2006 13:45:26 -0000 1.6
+++ libgeometry/geometry.cpp 12 Oct 2006 14:05:42 -0000 1.7
@@ -149,7 +149,7 @@
float vec3::magnitude() const
// Returns the length of *this.
{
- return std::sqrtf(sqrmag());
+ return sqrtf(sqrmag());
}
@@ -402,7 +402,7 @@
float tr = m[0].get(0) + m[1].get(1) + m[2].get(2); // trace
if (tr >= 0) {
- s = std::sqrtf(tr + 1);
+ s = sqrtf(tr + 1);
q.SetS(0.5f * s);
s = 0.5f / s;
q.SetV(vec3(m[1].get(2) - m[2].get(1), m[2].get(0) -
m[0].get(2), m[0].get(1) - m[1].get(0)) * s);
@@ -420,7 +420,7 @@
switch (i) {
default:
case 0:
- s = std::sqrtf((m[0].get(0) - (m[1].get(1) +
m[2].get(2))) + 1);
+ s = sqrtf((m[0].get(0) - (m[1].get(1) + m[2].get(2))) +
1);
qi = 0.5f * s;
s = 0.5f / s;
qj = (m[1].get(0) + m[0].get(1)) * s;
@@ -429,7 +429,7 @@
break;
case 1:
- s = std::sqrtf((m[1].get(1) - (m[2].get(2) +
m[0].get(0))) + 1);
+ s = sqrtf((m[1].get(1) - (m[2].get(2) + m[0].get(0))) +
1);
qj = 0.5f * s;
s = 0.5f / s;
qk = (m[2].get(1) + m[1].get(2)) * s;
@@ -438,7 +438,7 @@
break;
case 2:
- s = std::sqrtf((m[2].get(2) - (m[0].get(0) +
m[1].get(1))) + 1);
+ s = sqrtf((m[2].get(2) - (m[0].get(0) + m[1].get(1))) +
1);
qk = 0.5f * s;
s = 0.5f / s;
qi = (m[0].get(2) + m[2].get(0)) * s;
@@ -462,9 +462,9 @@
quaternion::quaternion(const vec3& Axis, float Angle)
// Constructs the quaternion defined by the rotation about the given axis of
the given angle (in radians).
{
- S = std::cosf(Angle / 2);
+ S = cosf(Angle / 2);
V = Axis;
- V *= std::sinf(Angle / 2);
+ V *= sinf(Angle / 2);
}
@@ -479,7 +479,7 @@
quaternion& quaternion::normalize()
// Ensures that the quaternion has magnitude 1.
{
- float mag = std::sqrtf(S * S + V * V);
+ float mag = sqrtf(S * S + V * V);
if (mag > 0.0000001) {
float inv = 1.0f / mag;
S *= inv;
@@ -533,10 +533,10 @@
if (cos_omega < 0.99) {
// Do the spherical interp.
- float omega = std::acosf(cos_omega);
- float sin_omega = std::sinf(omega);
- f0 = std::sinf((1 - f) * omega) / sin_omega;
- f1 = std::sinf(f * omega) / sin_omega;
+ float omega = acosf(cos_omega);
+ float sin_omega = sinf(omega);
+ f0 = sinf((1 - f) * omega) / sin_omega;
+ f1 = sinf(f * omega) / sin_omega;
} else {
// Quaternions are close; just do straight lerp and avoid
division by near-zero.
f0 = 1 - f;
@@ -632,7 +632,7 @@
// Rotates the given point through the given angle (in radians) about the given
// axis.
{
- quaternion q(std::cosf(Angle/2), Axis * std::sinf(Angle/2));
+ quaternion q(cosf(Angle/2), Axis * sinf(Angle/2));
vec3 result;
q.ApplyRotation(&result, Point);
Index: libgeometry/kd_tree_dynamic.cpp
===================================================================
RCS file: /sources/gnash/gnash/libgeometry/kd_tree_dynamic.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- libgeometry/kd_tree_dynamic.cpp 12 Oct 2006 13:45:26 -0000 1.11
+++ libgeometry/kd_tree_dynamic.cpp 12 Oct 2006 14:05:42 -0000 1.12
@@ -360,7 +360,7 @@
{
float neg_offset = faces[i].get_max_coord(axis,
m_verts);
- if (std::fabsf(neg_offset - last_offset_tried) <
EPSILON)
+ if (fabsf(neg_offset - last_offset_tried) < EPSILON)
{
// Already tried this.
continue;
@@ -703,11 +703,11 @@
#ifdef ADHOC_METRIC
// compute a figure for how close to the center this splitting
// plane is. Normalize in [0,1].
- float volume_balance = 1.0f - std::fabsf(center - (neg_offset +
*pos_offset) / 2) / extent;
+ float volume_balance = 1.0f - fabsf(center - (neg_offset +
*pos_offset) / 2) / extent;
// Compute a figure for how well we balance the faces. 0 == bad,
// 1 == good.
- float face_balance = 1.0f - (std::fabsf(float(front_count -
back_count))) / face_count;
+ float face_balance = 1.0f - (fabsf(float(front_count - back_count)))
/ face_count;
float split_quality = bounds.get_surface_area() * volume_balance *
face_balance;
Index: libgeometry/kd_tree_packed.cpp
===================================================================
RCS file: /sources/gnash/gnash/libgeometry/kd_tree_packed.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libgeometry/kd_tree_packed.cpp 12 Oct 2006 13:45:26 -0000 1.8
+++ libgeometry/kd_tree_packed.cpp 12 Oct 2006 14:05:42 -0000 1.9
@@ -407,7 +407,7 @@
pvec.set_cross(dir, edge2);
/* if determinant is near zero, ray lies in plane of triangle */
- const float det = std::fabsf( edge1 * pvec ); // =
vec3U::TripleProduct(dir,edge1,edge2);
+ const float det = fabsf( edge1 * pvec ); // =
vec3U::TripleProduct(dir,edge1,edge2);
/* calculate distance from vert0 to ray origin */
const vec3 tvec = orig - vert0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash libbase/postscript.cpp libbase/triangulat...,
Markus Gothe <=