예제 #1
0
static void
createRGBCube()
{
  // Create the model
  TriangleMeshShape* t = MeshSweeper::makeCube();
  Color* c = new Color[8];

  c[0] = Color::blue;
  c[1] = Color::magenta;
  c[2] = Color::white;
  c[3] = Color::cyan;
  c[4] = Color::black;
  c[5] = Color::red;
  c[6] = Color::yellow;
  c[7] = Color::green;
  t->setColors(c, 8);
  // Create an actor from model and add it into the scene
  scene->addActor(new Actor(*t));
  mesh = t;

  // Set model transformation matrix
  REAL a = Math::toRadians<REAL>(5);

  MTM.rotationY(a);

  Transf3 temp;

  temp.rotationX(a);
  MTM.compose(temp);
  temp.rotationZ(a);
  MTM.compose(temp);
}
예제 #2
0
void
Camera::rotateYX(REAL ay, REAL ax)
//[]---------------------------------------------------[]
//|  Rotate YX.                                         |
//|                                                     |
//|  Composition of an azimuth of ay with an elavation  |
//|  of ax (in degrees).                                |
//[]---------------------------------------------------[]
{
	if (Math::isZero(ay))
	{
		elevation(ax);
		return;
	}

	Transf3 r;
	
	r.rotation(focalPoint, viewUp, Math::toRadians<REAL>(ay));
	if (!Math::isZero(ax))
	{
		Vec3 axis = directionOfProjection.cross(viewUp);
		Transf3 q;
		
		q.rotation(focalPoint, axis, Math::toRadians<REAL>(ax));
		q.transformVectorRef(viewUp);
		r.compose(q);
	}
	r.transformRef(position);
	updateDOP();
}