From 054de5f370ee3483a90f37624a1b57a89fe1e495 Mon Sep 17 00:00:00 2001 From: Ansgar Philippsen <ansgar.philippsen@gmail.com> Date: Tue, 30 Nov 2010 11:43:48 -0500 Subject: [PATCH] fix to fast sphere; added aligned cuboid ostream; tweaks to scene BB calc --- modules/geom/src/aligned_cuboid.hh | 6 ++++++ modules/gfx/src/entity.cc | 12 ++++++------ modules/gfx/src/impl/cpk_renderer.cc | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/geom/src/aligned_cuboid.hh b/modules/geom/src/aligned_cuboid.hh index 18438cc78..2cc123e62 100644 --- a/modules/geom/src/aligned_cuboid.hh +++ b/modules/geom/src/aligned_cuboid.hh @@ -48,6 +48,12 @@ private: Vec3 max_; }; +inline std::ostream& operator<<(std::ostream& os, const AlignedCuboid& c) +{ + os << "(" << c.GetMin() << "," << c.GetMax() << ")"; + return os; +} + AlignedCuboid DLLEXPORT_OST_GEOM Union(const AlignedCuboid& lhs, const AlignedCuboid& rhs); } diff --git a/modules/gfx/src/entity.cc b/modules/gfx/src/entity.cc index 0c5f06837..b4868fc18 100644 --- a/modules/gfx/src/entity.cc +++ b/modules/gfx/src/entity.cc @@ -274,12 +274,12 @@ void Entity::ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc, geom::Vec3 mmax=coord_limits.GetMax(); geom::Vec3 t1=tf.Apply(geom::Vec3(mmin[0], mmin[1], mmin[2])); geom::Vec3 t2=tf.Apply(geom::Vec3(mmin[0], mmax[1], mmin[2])); - geom::Vec3 t3=tf.Apply(geom::Vec3(mmax[0], mmax[1], mmin[2])); - geom::Vec3 t4=tf.Apply(geom::Vec3(mmax[0], mmin[1], mmin[2])); + geom::Vec3 t3=tf.Apply(geom::Vec3(mmax[0], mmin[1], mmin[2])); + geom::Vec3 t4=tf.Apply(geom::Vec3(mmax[0], mmax[1], mmin[2])); geom::Vec3 t5=tf.Apply(geom::Vec3(mmin[0], mmin[1], mmax[2])); geom::Vec3 t6=tf.Apply(geom::Vec3(mmin[0], mmax[1], mmax[2])); - geom::Vec3 t7=tf.Apply(geom::Vec3(mmax[0], mmax[1], mmax[2])); - geom::Vec3 t8=tf.Apply(geom::Vec3(mmax[0], mmin[1], mmax[2])); + geom::Vec3 t7=tf.Apply(geom::Vec3(mmax[0], mmin[1], mmax[2])); + geom::Vec3 t8=tf.Apply(geom::Vec3(mmax[0], mmax[1], mmax[2])); minc = geom::Min(minc, geom::Min(t1, geom::Min(t2, geom::Min(t3, geom::Min(t4, geom::Min(t5, geom::Min(t6, geom::Min(t7, t8)))))))); @@ -313,11 +313,11 @@ void Entity::CacheBoundingBox() const const impl::EntityRenderer* r=i->second; if (r->IsEnabled() && r->HasDataToRender()) { if (!has_data) { - coord_limits=r->GetBoundingBox(); + coord_limits=r->GetBoundingBox(); has_data=true; } else { coord_limits=geom::Union(coord_limits, r->GetBoundingBox()); - } + } } } bbox_=coord_limits; diff --git a/modules/gfx/src/impl/cpk_renderer.cc b/modules/gfx/src/impl/cpk_renderer.cc index 47bec0384..f2735234f 100644 --- a/modules/gfx/src/impl/cpk_renderer.cc +++ b/modules/gfx/src/impl/cpk_renderer.cc @@ -127,6 +127,7 @@ void Render3DSpritesInnerLoop(const AtomEntry* ae, const geom::Vec3& cx, gl_mmat,gl_pmat,gl_vp, &r2[0],&r2[1],&r2[2]); float scale = r1[2]-r2[2]; + glVertex3fv(pos.Data()); glColor3fv(ae->color); glTexCoord4f(0.0,0.0,-rad,scale); glVertex3v((pos-rad*cx-rad*cy).Data()); -- GitLab