Skip to content
Snippets Groups Projects
Commit 054de5f3 authored by Ansgar Philippsen's avatar Ansgar Philippsen
Browse files

fix to fast sphere; added aligned cuboid ostream; tweaks to scene BB calc

parent bd3bf855
Branches
Tags
No related merge requests found
...@@ -48,6 +48,12 @@ private: ...@@ -48,6 +48,12 @@ private:
Vec3 max_; 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); AlignedCuboid DLLEXPORT_OST_GEOM Union(const AlignedCuboid& lhs, const AlignedCuboid& rhs);
} }
......
...@@ -274,12 +274,12 @@ void Entity::ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc, ...@@ -274,12 +274,12 @@ void Entity::ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc,
geom::Vec3 mmax=coord_limits.GetMax(); geom::Vec3 mmax=coord_limits.GetMax();
geom::Vec3 t1=tf.Apply(geom::Vec3(mmin[0], mmin[1], mmin[2])); 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 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 t3=tf.Apply(geom::Vec3(mmax[0], mmin[1], mmin[2]));
geom::Vec3 t4=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 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 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 t7=tf.Apply(geom::Vec3(mmax[0], mmin[1], mmax[2]));
geom::Vec3 t8=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, minc = geom::Min(minc, geom::Min(t1, geom::Min(t2, geom::Min(t3,
geom::Min(t4, geom::Min(t5, geom::Min(t6, geom::Min(t4, geom::Min(t5, geom::Min(t6,
geom::Min(t7, t8)))))))); geom::Min(t7, t8))))))));
...@@ -313,11 +313,11 @@ void Entity::CacheBoundingBox() const ...@@ -313,11 +313,11 @@ void Entity::CacheBoundingBox() const
const impl::EntityRenderer* r=i->second; const impl::EntityRenderer* r=i->second;
if (r->IsEnabled() && r->HasDataToRender()) { if (r->IsEnabled() && r->HasDataToRender()) {
if (!has_data) { if (!has_data) {
coord_limits=r->GetBoundingBox(); coord_limits=r->GetBoundingBox();
has_data=true; has_data=true;
} else { } else {
coord_limits=geom::Union(coord_limits, r->GetBoundingBox()); coord_limits=geom::Union(coord_limits, r->GetBoundingBox());
} }
} }
} }
bbox_=coord_limits; bbox_=coord_limits;
......
...@@ -127,6 +127,7 @@ void Render3DSpritesInnerLoop(const AtomEntry* ae, const geom::Vec3& cx, ...@@ -127,6 +127,7 @@ void Render3DSpritesInnerLoop(const AtomEntry* ae, const geom::Vec3& cx,
gl_mmat,gl_pmat,gl_vp, gl_mmat,gl_pmat,gl_vp,
&r2[0],&r2[1],&r2[2]); &r2[0],&r2[1],&r2[2]);
float scale = r1[2]-r2[2]; float scale = r1[2]-r2[2];
glVertex3fv(pos.Data());
glColor3fv(ae->color); glColor3fv(ae->color);
glTexCoord4f(0.0,0.0,-rad,scale); glTexCoord4f(0.0,0.0,-rad,scale);
glVertex3v((pos-rad*cx-rad*cy).Data()); glVertex3v((pos-rad*cx-rad*cy).Data());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment