示例#1
0
CMatrix4::CMatrix4(const Vector4& v1, const Vector4& v2, const Vector4& v3, const Vector4& v4)
#if 0
    : m{ v1.GetX(), v1.GetY(), v1.GetZ(), v1.GetW(),
         v2.GetX(), v2.GetY(), v2.GetZ(), v2.GetW(),
         v3.GetX(), v3.GetY(), v3.GetZ(), v3.GetW(),
         v4.GetX(), v4.GetY(), v4.GetZ(), v4.GetW() }
{
#else
{
    constexpr std::size_t bytes = sizeof(float) * 4;
    std::memcpy(static_cast<void*>(&m[0]), static_cast<const float*>(v1), bytes);
    std::memcpy(static_cast<void*>(&m[4]), static_cast<const float*>(v2), bytes);
    std::memcpy(static_cast<void*>(&m[8]), static_cast<const float*>(v3), bytes);
    std::memcpy(static_cast<void*>(&m[12]), static_cast<const float*>(v4), bytes);
#endif
}

CMatrix4::CMatrix4(const Array& m)
    : m(m)
{
}

void CMatrix4::SetRow(std::int32_t row, const Vector4& v)
{
    HASENPFOTE_ASSERT_MSG((row >= 0) && (row < order), "Row index out of bounds.");
    m[offset<order>(row, 0)] = v.GetX();
    m[offset<order>(row, 1)] = v.GetY();
    m[offset<order>(row, 2)] = v.GetZ();
    m[offset<order>(row, 3)] = v.GetW();
}
void ShapeRectangle::Render() const
{
	Vector4 bottomLeft = m_transformComponent->Transformation(m_bottomLeft);
	Vector4 bottomRight = m_transformComponent->Transformation(m_bottomRight);
	Vector4 topLeft = m_transformComponent->Transformation(m_topLeft);
	Vector4 topRight = m_transformComponent->Transformation(m_topRight);

	glBegin(GL_TRIANGLE_STRIP);
	glColor3ub(m_red, m_green, m_blue);

	glVertex2f(bottomLeft.GetX(), bottomLeft.GetY());
	glVertex2f(bottomRight.GetX(), bottomRight.GetY());
	glVertex2f(topLeft.GetX(), topLeft.GetY());
	glVertex2f(topRight.GetX(), topRight.GetY());

	glEnd();
}
示例#3
0
void CMatrix4::SetColumn(std::int32_t column, const Vector4& v)
{
    HASENPFOTE_ASSERT_MSG((column >= 0) && (column < order), "Column index out of bounds.");
    m[offset<order>(0, column)] = v.GetX();
    m[offset<order>(1, column)] = v.GetY();
    m[offset<order>(2, column)] = v.GetZ();
    m[offset<order>(3, column)] = v.GetW();
}
示例#4
0
void CgEffect::SetVector(const char* name, Vector4& v)
{
    cgSetParameter4f(this->retrieveParameter(name), v.GetX(), v.GetY(), v.GetZ(), v.GetW());
}