};
struct BlobPriv {
+ AABox vol;
metasurface *msurf;
Metaball mballs[NUM_MBALLS];
Texture *tex;
for(int i=0; i<NUM_MBALLS; i++) {
priv->mballs[i] = def_mball_data[i];
}
+ priv->vol = AABox(Vec3(-3.5, -3.5, -3.5), Vec3(3.5, 3.5, 3.5));
}
BlobExhibit::~BlobExhibit()
}
msurf_set_threshold(priv->msurf, 8);
msurf_set_inside(priv->msurf, MSURF_GREATER);
- msurf_set_bounds(priv->msurf, -3.5, -3.5, -3.5, 3.5, 3.5, 3.5);
+ msurf_set_bounds(priv->msurf, priv->vol.min.x, priv->vol.min.y, priv->vol.min.z,
+ priv->vol.max.x, priv->vol.max.y, priv->vol.max.z);
msurf_enable(priv->msurf, MSURF_NORMALIZE);
priv->tex = texman.get_texture("data/sphmap.jpg");
float xmin, xmax, ymin, ymax, zmin, zmax;
int xres, yres, zres;
+ if(!msurf_voxels(priv->msurf)) {
+ return;
+ }
+
msurf_get_bounds(priv->msurf, &xmin, &ymin, &zmin, &xmax, &ymax, &zmax);
msurf_get_resolution(priv->msurf, &xres, &yres, &zres);
priv->mballs[i].pos.z = -cos(t) * priv->mballs[i].path_scale.z + priv->mballs[i].path_offset.z;
}
- if(!msurf_voxels(priv->msurf)) {
- return;
- }
-
float max_energy = 0.0f;
#pragma omp parallel for
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
+ if(node) {
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glMultMatrixf(node->get_matrix()[0]);
+ }
+
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(1, -1, 1);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
+ if(node) {
+ glPopMatrix();
+ }
glPopAttrib();
}
+
+const AABox &BlobExhibit::get_aabox() const
+{
+ Box box = Box(priv->vol, node ? node->get_matrix() : Mat4::identity);
+ calc_bounding_aabox(&aabb, &box);
+ return aabb;
+}