> When the .forward scene vector is set to (0,1,0) or
> (0,-1,0), OpenGL initialization either fails (I've had two
> machines do this) or the scene window will just be blank. Is
> this a bug that anyone else can replicate?
More specifically, this happens when scene.forward == scene.up. The
orientation of the scene cannot be fully constrained by only one vector.
The basis calculation in Display::refreshCache() promptly degenerates:
Vector Z = forward.norm();
Vector X = Z.cross( up ).norm();
The ambiguity chould be resolved arbitrarily using code similar to that
in Primitive::refreshCache:
Vector W = axis->cross(*up);
if (!W) {
// Resolve degenerate cases:
W = axis->cross(Vector(1,0,0));
if (!W) W = axis->cross(Vector(0,1,0));
}
W = W.norm();
Vector H = W.cross( *axis ).norm();
Vector L = axis->norm();
Alternatively, we could make it an error to set scene.forward==scene.up,
and enforce that in Display::setattr.
} else if (attr == "forward") {
if (Vector(value)==up)
throw ValueError("display.forward may not be the same as
display.up");
forward = Vector(value);
...
} else if (attr=="up") {
if (Vector(value)==forward)
throw ValueError("display.up may not be the same as
display.forward");
up = Vector(value);
Dave
|