Game Development Reference
In-Depth Information
by one in the x-axis direction. We will fix the scale of the cone to 10% of its initial value,
this is purely cosmetic and could be exposed as a configurable value.
coneTransform = math::matrix::CreateRotationZ(math::Pi/2);
coneTransform.Scale(0.1f);
coneTransform.Translate( math::vector3::UnitX );
Now that the cone is rotated and translated into position, still within local space, we will
draw the cone, but we also must make sure we transform the cone into world space, this
is done by multiplying the coneTransform matrix we just created by the world transform
passed into the Draw function.
m_cone.Draw( coneTransform * world , view, projection, nullptr, render::color::RED);
We then do the same operation for each of the cones, except for the z-axis cone that needs
to be rotated to point down the negative z-axis, for this we rotate it by -π/2 in x, and -π/2 in
z.
coneTransform = math::matrix::Identity;
coneTransform.Scale(0.1f);
coneTransform.Translate(math::vector3::UnitY );
m_cone.Draw( coneTransform * world, view, projection, nullptr, render::color::GREEN);
coneTransform = math::matrix::CreateRotationX(-math::Pi/2) * math::matrix::CreateRotationZ(-math::Pi/2);
coneTransform.Scale(0.1f);
coneTransform.Translate(math::vector3::UnitZ);
m_cone.Draw( coneTransform * world, view, projection, nullptr, render::color::BLUE);
To a programmer developing transformation hierarchies as we will do in a later chapter,
this can be a very useful development and debugging tool, allowing us to see where our
transformations are and how they are oriented.
3.12.6 World Space Text
One feature that is very useful as a development aid during a game's production but that
is often a game feature is the ability to render text in world space. Some features require
text to be rendered screen aligned which is useful to display information that is visible to
the players regardless of their view direction, for example items that can be picked up are
often labeled with screen aligned text that shows the name, type and quantity of an item,
it is also useful for game developers during production to label areas of interest or states,
modern augmented reality displays are done using view aligned text.
Search WWH ::




Custom Search