|
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;
namespace DXCore_1
{
public class cObject
{
public CustomVertex.PositionColored[] itsVerts;
public Texture itsTexture;
public Matrix itsTransform;
public bool isActive;
}
public class cTriangle : cObject
{
public cTriangle(bool ac, Vector3 Translation, Vector3 Scale, Vector3 Rotation,Color pColor)
{
itsVerts = new CustomVertex.PositionColored[3];
Matrix T = Matrix.Translation(Translation);
Matrix S = Matrix.Scaling(Scale);
Matrix Rx = Matrix.RotationX(Rotation.X);
Matrix Ry = Matrix.RotationY(Rotation.Y);
Matrix Rz = Matrix.RotationZ(Rotation.Z);
itsTransform = Rx * Ry * Rz * T * S;
isActive = ac;
itsVerts[0] = new CustomVertex.PositionColored(new Vector3(0, 0, 0), pColor.ToArgb());
itsVerts[1] = new CustomVertex.PositionColored(new Vector3(2, 0, 0), pColor.ToArgb());
itsVerts[2] = new CustomVertex.PositionColored(new Vector3(1, 2, 0), pColor.ToArgb());
}
public void Render(Device device)
{
device.Transform.World = itsTransform;
device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, itsVerts);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Founder & CEO of
Synap, an online education platform that uses machine learning to help people learn more in less time.
Software developer, main languages currently are Objective-C, MySQL and Javascript, though I got started on C++, C# and PHP.