本文整理汇总了C++中Matrix4x4::GetYAxis方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4x4::GetYAxis方法的具体用法?C++ Matrix4x4::GetYAxis怎么用?C++ Matrix4x4::GetYAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4
的用法示例。
在下文中一共展示了Matrix4x4::GetYAxis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawDebugCube
/**
* Render a debug cube on the screen
*
* @param inLocation World space location of the cube
* @param inRotation Rotation of the cube
* @param inSize The length, width and height of the cube
* @param withColor The color of the cube
*/
void RenderManager::DrawDebugCube(const Vec4f& inLocation, const Quaternion& inRotation, const Vec3f& inSize, const ColorVector& withColor)
{
const Matrix4x4 rotMatrix = inRotation.GetRotationMatrix();
const Vec4f xAxis = rotMatrix.GetXAxis();
const Vec4f yAxis = rotMatrix.GetYAxis();
const Vec4f zAxis = rotMatrix.GetZAxis();
const Vec3f halfSize = inSize/2.f;
// Generate the cube vertices
Vec4f cubeVerts[8];
cubeVerts[0] = inLocation - halfSize.x*xAxis - halfSize.y*yAxis - halfSize.z*zAxis;
cubeVerts[1] = inLocation - halfSize.x*xAxis - halfSize.y*yAxis + halfSize.z*zAxis;
cubeVerts[2] = inLocation + halfSize.x*xAxis - halfSize.y*yAxis + halfSize.z*zAxis;
cubeVerts[3] = inLocation + halfSize.x*xAxis - halfSize.y*yAxis - halfSize.z*zAxis;
cubeVerts[4] = inLocation - halfSize.x*xAxis + halfSize.y*yAxis - halfSize.z*zAxis;
cubeVerts[5] = inLocation - halfSize.x*xAxis + halfSize.y*yAxis + halfSize.z*zAxis;
cubeVerts[6] = inLocation + halfSize.x*xAxis + halfSize.y*yAxis + halfSize.z*zAxis;
cubeVerts[7] = inLocation + halfSize.x*xAxis + halfSize.y*yAxis - halfSize.z*zAxis;
// Render the cube edges
DrawDebugLine(cubeVerts[0], cubeVerts[1], withColor);
DrawDebugLine(cubeVerts[1], cubeVerts[2], withColor);
DrawDebugLine(cubeVerts[2], cubeVerts[3], withColor);
DrawDebugLine(cubeVerts[3], cubeVerts[0], withColor);
DrawDebugLine(cubeVerts[4], cubeVerts[5], withColor);
DrawDebugLine(cubeVerts[5], cubeVerts[6], withColor);
DrawDebugLine(cubeVerts[6], cubeVerts[7], withColor);
DrawDebugLine(cubeVerts[7], cubeVerts[4], withColor);
DrawDebugLine(cubeVerts[0], cubeVerts[4], withColor);
DrawDebugLine(cubeVerts[1], cubeVerts[5], withColor);
DrawDebugLine(cubeVerts[2], cubeVerts[6], withColor);
DrawDebugLine(cubeVerts[3], cubeVerts[7], withColor);
}
示例2: DrawDebugAxes
/**
* Render debug coordinated axes on the screen (Color code: x - red, y - green, z - blue)
*
* @param inLocation World space location of the axes
* @param inRotation Rotation of the axes
* @param inSize The length, width and height of the axes
*/
void RenderManager::DrawDebugAxes(const Vec4f& inLocation, const Quaternion& inRotation, const Vec3f& inSize)
{
const Matrix4x4 rotMatrix = inRotation.GetRotationMatrix();
const Vec4f xAxis = rotMatrix.GetXAxis();
const Vec4f yAxis = rotMatrix.GetYAxis();
const Vec4f zAxis = rotMatrix.GetZAxis();
// Render the axes
DrawDebugLine(inLocation, inLocation + inSize.x*xAxis, ColorVector::Red);
DrawDebugLine(inLocation, inLocation + inSize.y*yAxis, ColorVector::Green);
DrawDebugLine(inLocation, inLocation + inSize.z*zAxis, ColorVector::Blue);
}
示例3: DrawDebugCylinder
/**
* Render a debug cylinder on the screen (The axis of the cylinder is along the Y axis)
*
* @param inLocation World space location of the cylinder
* @param inRotation Rotation of the cylinder (The axis of the cylinder is along the Y axis)
* @param inRadius The radius of the cylinder
* @param inHeight The height of the cylinder
* @param withColor The color of the cylinder
* @param inSegments Number of segments to divide the cylinder into
*/
void RenderManager::DrawDebugCylinder(const Vec4f& inLocation, const Quaternion& inRotation, const float inRadius, const float inHeight, const ColorVector& withColor, const int inSegments)
{
const Matrix4x4 rotMatrix = inRotation.GetRotationMatrix();
const Vec4f xAxis = rotMatrix.GetXAxis();
const Vec4f yAxis = rotMatrix.GetYAxis();
const Vec4f zAxis = rotMatrix.GetZAxis();
const float theta = 2*PI/inSegments;
const Vec4f topCircleCenter = inLocation + (inHeight/2.f)*yAxis;
const Vec4f bottomCircleCenter = inLocation - (inHeight/2.f)*yAxis;
// Generate the top circle vertices
Vec4f* topCircleVerts = new Vec4f[inSegments];
float currTheta = 0.f;
for(int i=0; i<inSegments; i++, currTheta+=theta)
{
topCircleVerts[i] = topCircleCenter + inRadius*cos(currTheta)*xAxis + inRadius*sin(currTheta)*zAxis;
}
// Generate the bottom circle vertices
Vec4f* bottomCircleVerts = new Vec4f[inSegments];
currTheta = 0.f;
for(int i=0; i<inSegments; i++, currTheta+=theta)
{
bottomCircleVerts[i] = bottomCircleCenter + inRadius*cos(currTheta)*xAxis + inRadius*sin(currTheta)*zAxis;
}
for(int i=0; i<inSegments; i++)
{
DrawDebugLine(topCircleVerts[i], topCircleVerts[(i+1)%inSegments], withColor);
DrawDebugLine(bottomCircleVerts[i], bottomCircleVerts[(i+1)%inSegments], withColor);
DrawDebugLine(topCircleVerts[i], bottomCircleVerts[i], withColor);
}
delete[] topCircleVerts;
delete[] bottomCircleVerts;
}