public Aquila(Texture2 <Vector4> colorBuffer, Texture2 <Vector1> depthBuffer) { this.colorBuffer = colorBuffer; this.depthBuffer = depthBuffer; SetViewport(0, 0, colorBuffer.Width, colorBuffer.Height); }
public Sample() { InitializeComponent(); int width = 640; int height = 480; bitmap = new Bitmap(width, height); colorBuffer = new Texture2 <Vector4>(width, height); depthBuffer = new Texture2 <Vector1>(width, height); aquila = new Aquila(colorBuffer, depthBuffer); //Bitmap textureBitmap = new Bitmap("../../../../circle.png"); Bitmap textureBitmap = new Bitmap("../../../../arrow.png"); texture = new Texture2 <Vector4>(textureBitmap.Width, textureBitmap.Height); TextureUtility.LoadFromRGB(texture, textureBitmap); pictureBox1.Image = bitmap; // colorized so colors could be used as texture coordinates /* * vertices[0] = new PositionColorVertex(new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); * vertices[1] = new PositionColorVertex(new Vector4(+1.0f, -1.0f, -1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f)); * vertices[2] = new PositionColorVertex(new Vector4(+1.0f, -1.0f, +1.0f, 1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f)); * vertices[3] = new PositionColorVertex(new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); * vertices[4] = new PositionColorVertex(new Vector4(+1.0f, -1.0f, +1.0f, 1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f)); * vertices[5] = new PositionColorVertex(new Vector4(-1.0f, -1.0f, +1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f)); */ // gradient (perspective correction is better visible) /* * vertices[0] = new PositionColorVertex(new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f)); * vertices[1] = new PositionColorVertex(new Vector4(+1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f)); * vertices[2] = new PositionColorVertex(new Vector4(+1.0f, -1.0f, +1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f)); * vertices[3] = new PositionColorVertex(new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f)); * vertices[4] = new PositionColorVertex(new Vector4(+1.0f, -1.0f, +1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f)); * vertices[5] = new PositionColorVertex(new Vector4(-1.0f, -1.0f, +1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f)); */ // load external file vertices = WavefrontObject.Load("cube.obj"); // 36 vertices //vertices = WavefrontObject.Load("sphere.obj"); // 15000 vertices //vertices = WavefrontObject.Load("monkey.obj"); // 188000 vertices label1.Text = vertices.Length + " vertices"; }
public MatrixTextureUniform(Matrix4 matrix, Texture2 <Vector4> texture) { this.matrix = matrix; this.texture = texture; }