onload(s)
// the matrix to transform the heart into its shadow
var reflectionMatrix = new Matrix();
function initOnLoad() {
fixNetscape();
// >> begin to work with the model etc.
heartModel.assignLayers();
heartShadowModel.assignLayers();
//OFFSET_Y_3DHTML = 180;
// inits reflectionMatrix
// reflectionMatrix.translate(0, -300, 0);
reflectionMatrix.translate(0, -200, 0);
reflectionMatrix.scale(0.7, 0.7, -1);
reflectionMatrix.rotateX(Math.PI);
// creates and inits matrix to initialize the model
var initMatrix = new Matrix();
initMatrix.scale(20, 20, 20);
initMatrix.rotateX(Math.PI);
// transforms heart (and shadow) model
heartModel.transform(initMatrix);
// copies the current positions of the points from the heart model
heartShadowModel.copyPointsFrom(heartModel);
// transforms the heart as it is its own shadow
heartShadowModel.transform(reflectionMatrix);
// >> first draw call to the model
heartModel.draw();
heartShadowModel.draw();
// starts animation
animate();
}
// try: used to store all heartBeat scale transformations
// to undo them. (OpenGL technique)
var heartBeatStackMatrix = new Matrix();