public SpriteBatch(Device d, ContentManager c) { Device = d; cubeVert = new VertexBuffer(Device, 4 * 28, Usage.WriteOnly, VertexFormat.None, Pool.Managed); cubeVert.Lock(0, 0, LockFlags.None).WriteRange(new[] { new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(0, 0, 0.0f, 1.0f), TexCoord = new Vector2f(0.0f, 1.0f) }, new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(0, 1, 0.0f, 1.0f), TexCoord = new Vector2f(0.0f, 0.0f) }, new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(1, 0, 0.0f, 1.0f), TexCoord = new Vector2f(1.0f, 1.0f) }, new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(1, 1, 0.0f, 1.0f), TexCoord = new Vector2f(1.0f, 0.0f) } }); cubeVert.Unlock(); var cubeElems = new[] { new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0), new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0), new VertexElement(0, 24, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0), VertexElement.VertexDeclarationEnd }; cubeDecl = new VertexDeclaration(Device, cubeElems); renderEffect = c.LoadString<Content.Effect>("float4 c;Texture b;sampler s=sampler_state{texture=<b>;magfilter=LINEAR;minfilter=LINEAR;mipfilter=LINEAR;AddressU=wrap;AddressV=wrap;};float4 f(float2 t:TEXCOORD0):COLOR{return tex2D(s, t) * c;}technique t{pass p{PixelShader = compile ps_2_0 f();}}"); }
public static Model FromScene(Scene scene, Device device) { VertexDeclaration vertexDeclaration = new VertexDeclaration(device, VertexPositionNormalTexture.VertexElements); Model result = new Model(scene, device, vertexDeclaration); foreach (Mesh mesh in scene.Meshes.Where(x => x.Positions.Any())) { VertexBuffer vertexBuffer = new VertexBuffer(device, mesh.Positions.Count * VertexPositionNormalTexture.SizeInBytes, Usage.WriteOnly, VertexFormat.None, Pool.Default); DataStream vertexDataStream = vertexBuffer.Lock(0, mesh.Positions.Count * VertexPositionNormalTexture.SizeInBytes, LockFlags.None); VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[mesh.Positions.Count]; for (int i = 0; i < vertices.Length; ++i) vertices[i] = new VertexPositionNormalTexture(mesh.Positions[i], (mesh.Normals.Count > i) ? mesh.Normals[i] : Vector3D.Zero, (mesh.TextureCoordinates.Count > i) ? mesh.TextureCoordinates[i].Xy : Point2D.Zero); vertexDataStream.WriteRange(vertices); vertexBuffer.Unlock(); IndexBuffer indexBuffer = new IndexBuffer(device, mesh.Indices.Count * sizeof(int), Usage.WriteOnly, Pool.Default, false); DataStream indexDataStream = indexBuffer.Lock(0, mesh.Indices.Count * sizeof(int), LockFlags.None); indexDataStream.WriteRange(mesh.Indices.ToArray()); indexBuffer.Unlock(); ModelMesh modelMesh = new ModelMesh(mesh, device, vertexBuffer, mesh.Positions.Count, indexBuffer, mesh.PrimitiveCount, Matrix3D.Identity, mesh.Material); result.Meshes.Add(modelMesh); } return result; }
internal ModelMesh(Mesh sourceMesh, Device device, VertexBuffer vertexBuffer, int numVertices, IndexBuffer indexBuffer, int primitiveCount, Matrix3D world, Material material) { SourceMesh = sourceMesh; _device = device; _vertexBuffer = vertexBuffer; _numVertices = numVertices; _indexBuffer = indexBuffer; _primitiveCount = primitiveCount; _effect = new SimpleEffect(device) { World = world, AmbientLightColor = new ColorRgbF(0.1f, 0.1f, 0.1f), DiffuseColor = material.DiffuseColor, SpecularColor = material.SpecularColor, SpecularPower = material.Shininess, Alpha = material.Transparency }; if (!string.IsNullOrEmpty(material.DiffuseTextureName)) _effect.DiffuseTexture = Texture.FromFile(device, material.DiffuseTextureName, Usage.None, Pool.Default); _effect.CurrentTechnique = "RenderScene"; Opaque = (material.Transparency == 1.0f); }
public void Create(Vector3 vMin, Vector3 vMax, Vector3 origin) { VMin = vMin; VMax = vMax; Color color = Color.LimeGreen; // create vertices BBVertex[] vertices = new BBVertex[] { new BBVertex() { Position = new Vector3(vMin.X, vMin.Y, vMin.Z), Color = color }, new BBVertex() { Position = new Vector3(vMax.X, vMin.Y, vMin.Z), Color = color }, new BBVertex() { Position = new Vector3(vMax.X, vMax.Y, vMin.Z), Color = color }, new BBVertex() { Position = new Vector3(vMin.X, vMax.Y, vMin.Z), Color = color }, new BBVertex() { Position = new Vector3(vMin.X, vMin.Y, vMax.Z), Color = color }, new BBVertex() { Position = new Vector3(vMax.X, vMin.Y, vMax.Z), Color = color }, new BBVertex() { Position = new Vector3(vMax.X, vMax.Y, vMax.Z), Color = color }, new BBVertex() { Position = new Vector3(vMin.X, vMax.Y, vMax.Z), Color = color } }; lock (DX.GlobalLock) { VertexBuffer = new D3D9.VertexBuffer(DX.Device, vertices.Length * 16, D3D9.Usage.WriteOnly, D3D9.VertexFormat.None, D3D9.Pool.Managed); VertexBuffer.Lock(0, 0, D3D9.LockFlags.None).WriteRange(vertices); VertexBuffer.Unlock(); } VertexCount = vertices.Length; //create indices CreateIndexBuffer(null); CreateVertexDeclaration(); Ready = true; }
public PointSpriteRenderer(Device device, int size) { if (device == null) throw new ArgumentNullException("device"); _device = device; _size = size; _vertexBuffer = new VertexBuffer(_device, _size * Particle.SizeInBytes, Usage.Dynamic | Usage.Points | Usage.WriteOnly, VertexFormat.None, Pool.Default); var vertexElements = new[] { new VertexElement(0, 0, DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.Color, 0), // Age new VertexElement(1, 0, DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.Position, 0), // X new VertexElement(2, 0, DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.Position, 1), // Y new VertexElement(3, 0, DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.Color, 1), // R new VertexElement(4, 0, DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.Color, 2), // G new VertexElement(5, 0, DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.Color, 3), // B new VertexElement(6, 0, DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.PointSize, 0), // Size new VertexElement(7, 0, DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0), // Rotation VertexElement.VertexDeclarationEnd }; _effect = Effect.FromString(device, Resources.PointSpriteShader, ShaderFlags.PartialPrecision); _vertexDeclaration = new VertexDeclaration(device, vertexElements); }
/// <summary> /// Creates the VertexBuffer for the quad /// </summary> /// <param name="graphicsDevice">The GraphicsDevice to use</param> public void CreateFullScreenQuad(Device graphicsDevice) { // Create a vertex buffer for the quad, and fill it in m_vertexBuffer = new VertexBuffer(graphicsDevice, MyVertexFormatFullScreenQuad.Stride * 4, Usage.WriteOnly, VertexFormat.None, Pool.Default); m_vertexBuffer.DebugName = "FullScreenQuad"; MyVertexFormatFullScreenQuad[] vbData = new MyVertexFormatFullScreenQuad[4]; // Upper right vbData[0].Position = new Vector3(1, 1, 1); vbData[0].TexCoordAndCornerIndex = new Vector3(1, 0, 1); // Lower right vbData[1].Position = new Vector3(1, -1, 1); vbData[1].TexCoordAndCornerIndex = new Vector3(1, 1, 2); // Upper left vbData[2].Position = new Vector3(-1, 1, 1); vbData[2].TexCoordAndCornerIndex = new Vector3(0, 0, 0); // Lower left vbData[3].Position = new Vector3(-1, -1, 1); vbData[3].TexCoordAndCornerIndex = new Vector3(0, 1, 3); m_vertexBuffer.SetData(vbData); }
private void Form1_Load(object sender, EventArgs e) { direct3dInterface = new Direct3D(); PresentParameters[] paramters = new PresentParameters[1]; paramters[0].Windowed = true; paramters[0].SwapEffect = SwapEffect.Discard; paramters[0].DeviceWindowHandle = this.Handle; direct3dDevice = new Device(direct3dInterface, 0, DeviceType.Hardware, this.Handle, CreateFlags.SoftwareVertexProcessing, paramters); if (direct3dDevice == null) { MessageBox.Show("Error: Can not initialize Direct3D Device", Name, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Vertex[] vertices = new Vertex[] { new Vertex(0.0f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f), new Vertex(0.5f, -.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f), new Vertex(-.5f, -.5f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f), }; int bufferSize = 3 * Marshal.SizeOf<CustomVertex>(); vertexBuffer = new VertexBuffer(direct3dDevice, bufferSize, Usage.None, vertexFormat, Pool.Managed); tmrUpdate.Start(); }
/// <summary> /// Allocates an empty vertex buffer. /// </summary> /// <param name="numVertices">The number of vertices to allocate.</param> public void Create(int numVertices) { if (_vertexBuffer != null) Clear(); _vertexBuffer = new VertexBuffer(GraphicsDevice.Device, PositionColoredTextured.StrideSize * numVertices, Usage.WriteOnly, PositionColoredTextured.Format, Pool.Default); ++_allocationCount; }
public void UnloadContent() { if (m_vertexBuffer != null) { m_vertexBuffer.Dispose(); m_vertexBuffer = null; } }
protected override void DisposeResource() { if (_VertexBuffer != null) { _VertexBuffer.Dispose(); _VertexBuffer = null; } }
public structModel(VertexBuffer VertexBuffer, structVertex[] Sommets, int nbfaces, string map_Kd, string map_Ns, Matrix Transformation) { this.VertexBuffer = VertexBuffer; this.Sommets = Sommets; this.nbfaces = nbfaces; this.map_Kd = map_Kd; this.map_Ns = map_Ns; this.Transformation = Transformation; }
public override void UnloadContent() { if (m_indexBuffer != null) { m_indexBuffer.Dispose(); m_indexBuffer = null; } if (m_vertexBuffer != null) { m_vertexBuffer.Dispose(); m_vertexBuffer = null; } }
public void Dispose() { if (VertexBuffer != null) { VertexBuffer.Dispose(); VertexBuffer = null; VertexCount = 0; } if (IndexBuffer != null) { IndexBuffer.Dispose(); IndexBuffer = null; IndexCount = 0; } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (direct3dInterface != null) { direct3dInterface.Dispose(); direct3dInterface = null; } if (direct3dDevice != null) { direct3dDevice.Dispose(); direct3dDevice = null; } if (vertexBuffer != null) { vertexBuffer.Dispose(); vertexBuffer = null; } }
private NormalBuffers GetNormalBuffers(ModelMesh mesh) { if (!_normals.ContainsKey(mesh)) { NormalBuffers normalBuffers = new NormalBuffers(); Line3D[] normalLines = NormalLinesGenerator.Generate(mesh.SourceMesh); normalBuffers.PrimitiveCount = normalLines.Length; normalBuffers.VertexCount = normalLines.Length * 2; VertexBuffer vertexBuffer = new VertexBuffer(_device, normalBuffers.VertexCount * VertexPositionColor.SizeInBytes, Usage.WriteOnly, VertexFormat.None, Pool.Default); DataStream vertexDataStream = vertexBuffer.Lock(0, normalBuffers.VertexCount * VertexPositionColor.SizeInBytes, LockFlags.None); VertexPositionColor[] vertices = new VertexPositionColor[normalBuffers.VertexCount]; int counter = 0; for (int i = 0; i < normalLines.Length; ++i) { Vector3D normalColor = Vector3D.Normalize(normalLines[i].Direction); normalColor += Vector3D.One; normalColor *= 0.5f; vertices[counter++] = new VertexPositionColor(normalLines[i].Start, normalColor); vertices[counter++] = new VertexPositionColor(normalLines[i].End, normalColor); } vertexDataStream.WriteRange(vertices); vertexBuffer.Unlock(); normalBuffers.Vertices = vertexBuffer; IndexBuffer indexBuffer = new IndexBuffer(_device, normalBuffers.VertexCount * sizeof(int), Usage.WriteOnly, Pool.Default, false); DataStream indexDataStream = indexBuffer.Lock(0, normalBuffers.VertexCount * sizeof(int), LockFlags.None); indexDataStream.WriteRange(Enumerable.Range(0, normalBuffers.VertexCount).ToArray()); indexBuffer.Unlock(); normalBuffers.Indices = indexBuffer; _normals.Add(mesh, normalBuffers); } return _normals[mesh]; }
public virtual void CreateVertexBuffer(List <Vector3> vertices, List <Vector3> normals, List <Color> colors, List <Vector2> uvs) { MeshVertex[] data = new MeshVertex[vertices.Count]; for (int i = 0; i < vertices.Count; i++) { MeshVertex vertex = new MeshVertex() { Position = vertices[i], Normal = normals[i], Color = colors[i], UV = uvs[i] }; data[i] = vertex; } lock (DX.GlobalLock) { VertexBuffer = new D3D9.VertexBuffer(DX.Device, vertices.Count * 36, D3D9.Usage.WriteOnly, D3D9.VertexFormat.None, D3D9.Pool.Managed); VertexBuffer.Lock(0, 0, D3D9.LockFlags.None).WriteRange(data); VertexBuffer.Unlock(); } VertexCount = vertices.Count; }
unsafe static IntPtr RegisterVerticesResource(VertexBuffer vertices) { var res = IntPtr.Zero; CUDAInterop.cuSafeCall(CUDAInterop.cuGraphicsD3D9RegisterResource(&res, vertices.NativePointer, 0)); return res; }
public VertexBuffer(PPDDevice device, SharpDX.Direct3D9.VertexBuffer vertexBuffer, int sizeInBytes) : base(device, sizeInBytes) { _VertexBuffer = vertexBuffer; }
public static void Main() { var form = new RenderForm("SimpleD3D9 by C#") { ClientSize = new Size(1024, 768) }; var device = new D3D9Device( new Direct3D(), CUDADevice.Default.ID, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters(form.ClientSize.Width, form.ClientSize.Height)); var vertices = new VertexBuffer(device, Utilities.SizeOf<Vector4>()*Total, Usage.WriteOnly, VertexFormat.None, Pool.Default); var vertexElems = new [] { new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0), new VertexElement(0, 12, DeclarationType.Ubyte4, DeclarationMethod.Default, DeclarationUsage.Color, 0), VertexElement.VertexDeclarationEnd }; var vertexDecl = new VertexDeclaration(device, vertexElems); var worker = Worker.CreateByFunc(() => Generate(device)); var updater = new SimpleD3D9(GPUModuleTarget.Worker(worker)); var view = Matrix.LookAtLH( new Vector3(0.0f, 3.0f, -2.0f), // the camera position new Vector3(0.0f, 0.0f, 0.0f), // the look-at position new Vector3(0.0f, 1.0f, 0.0f)); // the up direction var proj = Matrix.PerspectiveFovLH( (float) (Math.PI/4.0), // the horizontal field of view 1.0f, 1.0f, 100.0f); device.SetTransform(TransformState.View, view); device.SetTransform(TransformState.Projection, proj); device.SetRenderState(RenderState.Lighting, false); var vbres = RegisterVerticesResource(vertices); var clock = System.Diagnostics.Stopwatch.StartNew(); RenderLoop.Run(form, () => { var time = (float) (clock.Elapsed.TotalMilliseconds)/300.0f; updater.Update(vbres, time); // Now normal D3D9 rendering procedure. device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, new ColorBGRA(0, 40, 100, 0), 1.0f, 0); device.BeginScene(); device.VertexDeclaration = vertexDecl; device.SetStreamSource(0, vertices, 0, Utilities.SizeOf<Vector4>()); // we use PointList as the graphics primitives device.DrawPrimitives(SharpDX.Direct3D9.PrimitiveType.PointList, 0, Total); device.EndScene(); device.Present(); }); UnregisterVerticesResource(vbres); updater.Dispose(); worker.Dispose(); vertexDecl.Dispose(); vertices.Dispose(); device.Dispose(); form.Dispose(); }
/// <summary> /// Unloads the content. /// </summary> public override void UnloadContent() { MyRender.Log.WriteLine("TransparentGeometry.UnloadContent - START"); MyRender.Log.IncreaseIndent(); if (m_indexBuffer != null) { m_indexBuffer.Dispose(); m_indexBuffer = null; } if (m_vertexBuffer != null) { m_vertexBuffer.Dispose(); m_vertexBuffer = null; } MyRender.Log.DecreaseIndent(); MyRender.Log.WriteLine("TransparentGeometry.UnloadContent - END"); }
public static void DrawCircle(Vector3 position, float radius, Color color, int width = 1, bool zDeep = false) { if (_vertices == null) { const float x = 6000f; _vertices = new VertexBuffer( Drawing.Direct3DDevice, Utilities.SizeOf<Vector4>() * 2 * 6, Usage.WriteOnly, VertexFormat.None, Pool.Managed); _vertices.Lock(0, 0, LockFlags.None).WriteRange( new[] { //T1 new Vector4(-x, 0f, -x, 1.0f), new Vector4(), new Vector4(-x, 0f, x, 1.0f), new Vector4(), new Vector4(x, 0f, -x, 1.0f), new Vector4(), //T2 new Vector4(x, 0f, x, 1.0f), new Vector4(), new Vector4(-x, 0f, x, 1.0f), new Vector4(), new Vector4(x, 0f, -x, 1.0f), new Vector4() }); _vertices.Unlock(); _vertexElements = new[] { new VertexElement( 0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0), new VertexElement( 0, 16, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Color, 0), VertexElement.VertexDeclarationEnd }; _vertexDeclaration = new VertexDeclaration(Drawing.Direct3DDevice, _vertexElements); #region Effect try { /* _effect = Effect.FromString(Drawing.Direct3DDevice, @" struct VS_S { float4 Position : POSITION; float4 Color : COLOR0; float4 Position3D : TEXCOORD0; }; float4x4 ProjectionMatrix; float4 CircleColor; float Radius; float Border; bool zEnabled; VS_S VS( VS_S input ) { VS_S output = (VS_S)0; output.Position = mul(input.Position, ProjectionMatrix); output.Color = input.Color; output.Position3D = input.Position; return output; } float4 PS( VS_S input ) : COLOR { VS_S output = (VS_S)0; output = input; float4 v = output.Position3D; float distance = Radius - sqrt(v.x * v.x + v.z*v.z); // Distance to the circle arc. output.Color.x = CircleColor.x; output.Color.y = CircleColor.y; output.Color.z = CircleColor.z; if(distance < Border && distance > -Border) { output.Color.w = (CircleColor.w - CircleColor.w * abs(distance * 1.75 / Border)); } else { output.Color.w = 0; } if(Border < 1 && distance >= 0) { output.Color.w = CircleColor.w; } return output.Color; } technique Main { pass P0 { ZEnable = zEnabled; AlphaBlendEnable = TRUE; DestBlend = INVSRCALPHA; SrcBlend = SRCALPHA; VertexShader = compile vs_2_0 VS(); PixelShader = compile ps_2_0 PS(); } }", ShaderFlags.None); */ var compiledEffect = new byte[] { 0x01, 0x09, 0xFF, 0xFE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x50, 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x61, 0x74, 0x72, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x43, 0x69, 0x72, 0x63, 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x7A, 0x45, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x50, 0x30, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x01, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xEC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x3C, 0x01, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x5C, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x7C, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x01, 0x00, 0x00, 0x9C, 0x01, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x01, 0x00, 0x00, 0xD4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x04, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xFF, 0xFE, 0xFF, 0x38, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xA3, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x00, 0xAB, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x69, 0x72, 0x63, 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x00, 0x70, 0x73, 0x5F, 0x32, 0x5F, 0x30, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0xAB, 0xFE, 0xFF, 0x7C, 0x00, 0x50, 0x52, 0x45, 0x53, 0x01, 0x02, 0x58, 0x46, 0xFE, 0xFF, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x01, 0x02, 0x58, 0x46, 0x02, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x88, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x00, 0xAB, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x69, 0x72, 0x63, 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x78, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0xFE, 0xFF, 0x0C, 0x00, 0x50, 0x52, 0x53, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x1A, 0x00, 0x43, 0x4C, 0x49, 0x54, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x1F, 0x00, 0x46, 0x58, 0x4C, 0x43, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x30, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x40, 0xA0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x06, 0x00, 0x0F, 0xA0, 0x00, 0x00, 0xE0, 0x3F, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xB0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xAA, 0xB0, 0x00, 0x00, 0xAA, 0xB0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0xB0, 0x00, 0x00, 0x00, 0xB0, 0x00, 0x00, 0xFF, 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x81, 0x04, 0x00, 0x00, 0xA0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x81, 0x05, 0x00, 0x00, 0xA1, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x55, 0xA0, 0x06, 0x00, 0xAA, 0xA0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0xA1, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xAA, 0x80, 0x06, 0x00, 0x55, 0xA0, 0x00, 0x00, 0x55, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xA0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0xAA, 0xA0, 0x06, 0x00, 0x55, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x06, 0x00, 0x55, 0xA0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0xA0, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xAA, 0x80, 0x00, 0x00, 0x00, 0xA0, 0x23, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xAA, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x03, 0x00, 0xFF, 0xA0, 0x00, 0x00, 0xAA, 0x81, 0x03, 0x00, 0xFF, 0xA0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0xFF, 0xA0, 0x00, 0x00, 0xAA, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x03, 0x00, 0xFF, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xE4, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0F, 0x80, 0x00, 0x00, 0xE4, 0x80, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x01, 0x00, 0x00, 0x00, 0x02, 0xFE, 0xFF, 0xFE, 0xFF, 0x34, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x94, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x50, 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x61, 0x74, 0x72, 0x69, 0x78, 0x00, 0xAB, 0xAB, 0xAB, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5F, 0x32, 0x5F, 0x30, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0F, 0x90, 0x1F, 0x00, 0x00, 0x02, 0x0A, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0F, 0x90, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x00, 0x00, 0xE4, 0xA0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x01, 0x00, 0xE4, 0xA0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x02, 0x00, 0xE4, 0xA0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x03, 0x00, 0xE4, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0F, 0xD0, 0x01, 0x00, 0xE4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x00, 0xE4, 0x90, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0x46, 0xFE, 0xFF, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0x46, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x5C, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x7A, 0x45, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x64, 0x00, 0xAB, 0xAB, 0xAB, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x78, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0xFE, 0xFF, 0x02, 0x00, 0x43, 0x4C, 0x49, 0x54, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x0C, 0x00, 0x46, 0x58, 0x4C, 0x43, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0x00, 0x00 }; _effect = Effect.FromMemory(Drawing.Direct3DDevice, compiledEffect, ShaderFlags.None); } catch (Exception e) { Console.WriteLine(e); return; } #endregion _technique = _effect.GetTechnique(0); Drawing.OnPreReset += delegate { _effect.OnLostDevice(); }; Drawing.OnPostReset += delegate { _effect.OnResetDevice(); }; AppDomain.CurrentDomain.DomainUnload += delegate { _effect.Dispose(); _vertices.Dispose(); _vertexDeclaration.Dispose(); }; } if (_vertices.IsDisposed || _vertexDeclaration.IsDisposed || _effect.IsDisposed) { return; } var olddec = Drawing.Direct3DDevice.VertexDeclaration; _effect.Technique = _technique; _effect.Begin(); _effect.BeginPass(0); _effect.SetValue( "ProjectionMatrix", Matrix.Translation(position.SwitchYZ()) * Drawing.View * Drawing.Projection); _effect.SetValue( "CircleColor", new Vector4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f)); _effect.SetValue("Radius", radius); _effect.SetValue("Border", 2f + width); _effect.SetValue("zEnabled", zDeep); Drawing.Direct3DDevice.SetStreamSource(0, _vertices, 0, Utilities.SizeOf<Vector4>() * 2); Drawing.Direct3DDevice.VertexDeclaration = _vertexDeclaration; Drawing.Direct3DDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 2); _effect.EndPass(); _effect.End(); Drawing.Direct3DDevice.VertexDeclaration = olddec; }
protected override void DisposeDisposables() { base.DisposeDisposables(); if (vertexBuffer != null) vertexBuffer.Dispose(); if (indexBuffer != null) indexBuffer.Dispose(); vertexBuffer = null; indexBuffer = null; }
/// <summary> /// Loads the content. /// </summary> public override void LoadContent() { MyRender.Log.WriteLine("TransparentGeometry.LoadContent() - START"); MyRender.Log.IncreaseIndent(); MyRender.GetRenderProfiler().StartProfilingBlock("TransparentGeometry.LoadContent"); MyRender.Log.WriteLine(string.Format("MyTransparentGeometry.LoadData - START")); m_sortedTransparentGeometry.Clear(); m_preparedTransparentGeometry.Clear(); m_lowresTransparentGeometry.Clear(); // Max count of all particles should be less or equal than max count of billboards MyDebug.AssertRelease(MyTransparentGeometryConstants.MAX_PARTICLES_COUNT <= MyTransparentGeometryConstants.MAX_TRANSPARENT_GEOMETRY_COUNT); MyDebug.AssertRelease(MyTransparentGeometryConstants.MAX_COCKPIT_PARTICLES_COUNT <= MyTransparentGeometryConstants.MAX_TRANSPARENT_GEOMETRY_COUNT); PrepareAtlasMaterials(); m_vertexBuffer = new VertexBuffer(MyRender.GraphicsDevice, MyVertexFormatTransparentGeometry.Stride * MyTransparentGeometryConstants.MAX_TRANSPARENT_GEOMETRY_COUNT * MyTransparentGeometryConstants.VERTICES_PER_TRANSPARENT_GEOMETRY, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default); m_startOffsetInVertexBuffer = 0; m_endOffsetInVertexBuffer = 0; m_vertexBuffer.DebugName = "TransparentGeometry"; m_indexBuffer = new IndexBuffer(MyRender.GraphicsDevice, MyTransparentGeometryConstants.MAX_TRANSPARENT_GEOMETRY_INDICES * sizeof(int), Usage.WriteOnly, Pool.Default, false); m_indexBuffer.SetData(m_indices); MyRender.GetRenderProfiler().EndProfilingBlock(); MyRender.Log.DecreaseIndent(); MyRender.Log.WriteLine("TransparentGeometry.LoadContent() - END"); }
/// <summary> /// Draws the circle. /// </summary> /// <param name="position">The position.</param> /// <param name="radius">The radius.</param> /// <param name="color">The color.</param> /// <param name="width">The width.</param> /// <param name="zDeep">if set to <c>true</c> the circle will be drawn with depth buffering.</param> public static void DrawCircle(Vector3 position, float radius, Color color, int width = 5, bool zDeep = false) { try { if (Device == null || Device.IsDisposed) { return; } if (_vertices == null) { CreateVertexes(); } if (_vertices == null || _vertices.IsDisposed || _vertexDeclaration.IsDisposed || _effect.IsDisposed || _technique.IsDisposed) { return; } var olddec = Device.VertexDeclaration; _effect.Technique = _technique; _effect.Begin(); _effect.BeginPass(0); _effect.SetValue( "ProjectionMatrix", Matrix.Translation(position.SwitchYZ()) * Drawing.View * Drawing.Projection); _effect.SetValue( "CircleColor", new Vector4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f)); _effect.SetValue("Radius", radius); _effect.SetValue("Border", 2f + width); _effect.SetValue("zEnabled", zDeep); Device.SetStreamSource(0, _vertices, 0, Utilities.SizeOf<Vector4>() * 2); Device.VertexDeclaration = _vertexDeclaration; Device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2); _effect.EndPass(); _effect.End(); Device.VertexDeclaration = olddec; } catch (Exception e) { _vertices = null; Console.WriteLine(@"DrawCircle: " + e); } }
protected void RecreateBuffers() { if (viewportImage == null) return; lock (updateLocker) { Pool pool; if (viewportImage.GraphicsDeviceService.UseDeviceEx == true) pool = Pool.Default; else pool = Pool.Managed; if ((vertexBufferLength != vertices.Length) || (vertexBuffer == null)) { if (vertexBuffer != null) vertexBuffer.Dispose(); vertexBuffer = new VertexBuffer(graphicsDevice, vertices.Length * VertexPositionNormalColor.SizeInBytes, Usage.WriteOnly, VertexFormat.Position | VertexFormat.Normal | VertexFormat.Diffuse, pool); vertexBufferLength = vertices.Length; } using (DataStream stream = vertexBuffer.Lock(0, 0, LockFlags.None)) { stream.WriteRange(vertices); vertexBuffer.Unlock(); } graphicsDevice.VertexFormat = VertexFormat.Position | VertexFormat.Normal | VertexFormat.Diffuse; if ((indexBufferLength != indices.Length) || (indexBuffer == null)) { if (indexBuffer != null) indexBuffer.Dispose(); indexBuffer = new IndexBuffer(graphicsDevice, indices.Length * Marshal.SizeOf(typeof(int)), Usage.WriteOnly, pool, false); indexBufferLength = indices.Length; } using (DataStream streamIndex = indexBuffer.Lock(0, 0, LockFlags.None)) { streamIndex.WriteRange(indices); indexBuffer.Unlock(); } } }
public RenderResources(Device device) { Vertex[] rectangle = new Vertex[]{ new Vertex(0,0,0), new Vertex(1,0,0), new Vertex(0,1,0), new Vertex(1,1,0), }; int[] rectanglei = new int[] { 0, 1, 1, 3, 3, 2, 2, 0 }; RectangleVBuffer = new VertexBuffer(device, rectangle.Length * Vertex.SizeInBytes, Usage.WriteOnly, VertexFormat.None, Pool.Default); var dsv = RectangleVBuffer.Lock(0, 0, LockFlags.Discard); dsv.WriteRange(rectangle); RectangleVBuffer.Unlock(); RecangleIBuffer = new IndexBuffer(device, sizeof(int) * rectanglei.Length, Usage.WriteOnly, Pool.Default, false); var dsi = RecangleIBuffer.Lock(0, 0, LockFlags.Discard); dsi.WriteRange(rectanglei); RecangleIBuffer.Unlock(); int[] fillrecti = new int[] { 0, 1, 2, 3, 2, 1 }; FillRectangleIBuffer = new IndexBuffer(device, sizeof(int) * fillrecti.Length, Usage.WriteOnly, Pool.Default, false); dsi = FillRectangleIBuffer.Lock(0, 0, LockFlags.Discard); dsi.WriteRange(fillrecti); FillRectangleIBuffer.Unlock(); Vertex[] circle = new Vertex[CircleQuality + 1]; for (int la = 0; la < circle.Length;la++) { var angle = O3DHelper.Scale(la,0,circle.Length,0,MathUtil.TwoPi); float x = (float)Math.Sin(angle) * 0.5f + 0.5f; float y = (float)Math.Cos(angle) * 0.5f + 0.5f; circle[la] = new Vertex(x, y, 0); } circle[CircleQuality] = new Vertex(0.5f, 0.5f, 0); CircleVBuffer = new VertexBuffer(device, circle.Length * Vertex.SizeInBytes, Usage.WriteOnly, VertexFormat.None, Pool.Default); dsv = CircleVBuffer.Lock(0, 0, LockFlags.Discard); dsv.WriteRange(circle); CircleVBuffer.Unlock(); int[] circlei = new int[CircleQuality * 2]; for (int la = 0; la < CircleQuality;la++) { circlei[la * 2 + 0] = la; circlei[la * 2 + 1] = (la + 1) % CircleQuality; } CircleIBuffer = new IndexBuffer(device, sizeof(int) * circlei.Length, Usage.WriteOnly, Pool.Default, false); dsi = CircleIBuffer.Lock(0, 0, LockFlags.Discard); dsi.WriteRange(circlei); CircleIBuffer.Unlock(); int[] fcircle = new int[CircleQuality * 3]; for (int la = 0; la < CircleQuality; la++) { fcircle[la * 3 + 0] = (la + 1) % CircleQuality; fcircle[la * 3 + 1] = la; fcircle[la * 3 + 2] = CircleQuality; } FillCircleIBuffer = new IndexBuffer(device, sizeof(int) * fcircle.Length, Usage.WriteOnly, Pool.Default, false); dsi = FillCircleIBuffer.Lock(0, 0, LockFlags.Discard); dsi.WriteRange(fcircle); FillCircleIBuffer.Unlock(); Shader = Effect.FromString(device, Resources.Shader, ShaderFlags.None); }
/// <summary> /// Creates the vertexes. /// </summary> public static void CreateVertexes() { const float x = 6000f; _vertices = new VertexBuffer( Device, Utilities.SizeOf<Vector4>() * 2 * 6, Usage.WriteOnly, VertexFormat.None, Pool.Managed); _vertices.Lock(0, 0, LockFlags.None).WriteRange( new[] { //T1 new Vector4(-x, 0f, -x, 1.0f), new Vector4(), new Vector4(-x, 0f, x, 1.0f), new Vector4(), new Vector4(x, 0f, -x, 1.0f), new Vector4(), //T2 new Vector4(-x, 0f, x, 1.0f), new Vector4(), new Vector4(x, 0f, x, 1.0f), new Vector4(), new Vector4(x, 0f, -x, 1.0f), new Vector4() }); _vertices.Unlock(); _vertexElements = new[] { new VertexElement( 0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0), new VertexElement( 0, 16, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Color, 0), VertexElement.VertexDeclarationEnd }; _vertexDeclaration = new VertexDeclaration(Device, _vertexElements); #region Effect try { /* _effect = Effect.FromString(Device, @" struct VS_S { float4 Position : POSITION; float4 Color : COLOR0; float4 Position3D : TEXCOORD0; }; float4x4 ProjectionMatrix; float4 CircleColor; float Radius; float Border; bool zEnabled; VS_S VS( VS_S input ) { VS_S output = (VS_S)0; output.Position = mul(input.Position, ProjectionMatrix); output.Color = input.Color; output.Position3D = input.Position; return output; } float4 PS( VS_S input ) : COLOR { VS_S output = (VS_S)0; output = input; float4 v = output.Position3D; float distance = Radius - sqrt(v.x * v.x + v.z*v.z); // Distance to the circle arc. output.Color.x = CircleColor.x; output.Color.y = CircleColor.y; output.Color.z = CircleColor.z; if(distance < Border && distance > -Border) { output.Color.w = (CircleColor.w - CircleColor.w * abs(distance * 1.75 / Border)); } else { output.Color.w = 0; } if(Border < 1 && distance >= 0) { output.Color.w = CircleColor.w; } return output.Color; } technique Main { pass P0 { ZEnable = zEnabled; AlphaBlendEnable = TRUE; DestBlend = INVSRCALPHA; SrcBlend = SRCALPHA; VertexShader = compile vs_2_0 VS(); PixelShader = compile ps_2_0 PS(); } }", ShaderFlags.None); */ var compiledEffect = new byte[] { 0x01, 0x09, 0xFF, 0xFE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x50, 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x61, 0x74, 0x72, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x43, 0x69, 0x72, 0x63, 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x7A, 0x45, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x50, 0x30, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x01, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xEC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x3C, 0x01, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x5C, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x7C, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x01, 0x00, 0x00, 0x9C, 0x01, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x01, 0x00, 0x00, 0xD4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x04, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xFF, 0xFE, 0xFF, 0x38, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xA3, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x00, 0xAB, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x69, 0x72, 0x63, 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x00, 0x70, 0x73, 0x5F, 0x32, 0x5F, 0x30, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0xAB, 0xFE, 0xFF, 0x7C, 0x00, 0x50, 0x52, 0x45, 0x53, 0x01, 0x02, 0x58, 0x46, 0xFE, 0xFF, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x01, 0x02, 0x58, 0x46, 0x02, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x88, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x00, 0xAB, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x69, 0x72, 0x63, 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x78, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0xFE, 0xFF, 0x0C, 0x00, 0x50, 0x52, 0x53, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x1A, 0x00, 0x43, 0x4C, 0x49, 0x54, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x1F, 0x00, 0x46, 0x58, 0x4C, 0x43, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x30, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x40, 0xA0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x06, 0x00, 0x0F, 0xA0, 0x00, 0x00, 0xE0, 0x3F, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xB0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xAA, 0xB0, 0x00, 0x00, 0xAA, 0xB0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0xB0, 0x00, 0x00, 0x00, 0xB0, 0x00, 0x00, 0xFF, 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x81, 0x04, 0x00, 0x00, 0xA0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x81, 0x05, 0x00, 0x00, 0xA1, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x55, 0xA0, 0x06, 0x00, 0xAA, 0xA0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0xA1, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xAA, 0x80, 0x06, 0x00, 0x55, 0xA0, 0x00, 0x00, 0x55, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xA0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0xAA, 0xA0, 0x06, 0x00, 0x55, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x06, 0x00, 0x55, 0xA0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0xA0, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xAA, 0x80, 0x00, 0x00, 0x00, 0xA0, 0x23, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xAA, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x03, 0x00, 0xFF, 0xA0, 0x00, 0x00, 0xAA, 0x81, 0x03, 0x00, 0xFF, 0xA0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0xFF, 0xA0, 0x00, 0x00, 0xAA, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x03, 0x00, 0xFF, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xE4, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0F, 0x80, 0x00, 0x00, 0xE4, 0x80, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x01, 0x00, 0x00, 0x00, 0x02, 0xFE, 0xFF, 0xFE, 0xFF, 0x34, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x94, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x50, 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x61, 0x74, 0x72, 0x69, 0x78, 0x00, 0xAB, 0xAB, 0xAB, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5F, 0x32, 0x5F, 0x30, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0F, 0x90, 0x1F, 0x00, 0x00, 0x02, 0x0A, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0F, 0x90, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x00, 0x00, 0xE4, 0xA0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x01, 0x00, 0xE4, 0xA0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x02, 0x00, 0xE4, 0xA0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x03, 0x00, 0xE4, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0F, 0xD0, 0x01, 0x00, 0xE4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x00, 0xE4, 0x90, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0x46, 0xFE, 0xFF, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0x46, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x5C, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x7A, 0x45, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x64, 0x00, 0xAB, 0xAB, 0xAB, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x78, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0xFE, 0xFF, 0x02, 0x00, 0x43, 0x4C, 0x49, 0x54, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x0C, 0x00, 0x46, 0x58, 0x4C, 0x43, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0x00, 0x00 }; _effect = Effect.FromMemory(Device, compiledEffect, ShaderFlags.None); } catch (Exception e) { Console.WriteLine(e); return; } #endregion _technique = _effect.GetTechnique(0); if (!_initialized) { _initialized = true; Drawing.OnPreReset += OnPreReset; Drawing.OnPreReset += OnPostReset; AppDomain.CurrentDomain.DomainUnload += Dispose; } }
void CreateVertexBuffer() { // Create vertex buffer - vertex format type depends on draw technique switch (m_drawTechnique) { case MyMeshDrawTechnique.MESH: case MyMeshDrawTechnique.DECAL: case MyMeshDrawTechnique.HOLO: case MyMeshDrawTechnique.ALPHA_MASKED: case MyMeshDrawTechnique.SKINNED: { if (m_forLoadingTexCoords0 == null) throw new Exception("Model '" + m_assetName + "' doesn't have texture channel 0 specified, but this shader requires it"); if (m_forLoadingTexCoords0.Length == 0) { MyVertexFormatPosition[] vertexArray = new MyVertexFormatPosition[GetVerticesCount()]; for (int i = 0; i < GetVerticesCount(); i++) { vertexArray[i].Position = m_vertices[i].Position; } m_vertexDeclaration = MyVertexFormatPosition.VertexDeclaration; m_vertexStride = MyVertexFormatPosition.Stride; m_vertexBufferSize = vertexArray.Length * m_vertexStride; m_vertexBuffer = new VertexBuffer(MyRender.GraphicsDevice, m_vertexBufferSize, Usage.WriteOnly, VertexFormat.None, Pool.Default); m_vertexBuffer.SetData(vertexArray); m_vertexBuffer.Tag = this; } else if (MyRenderConstants.RenderQualityProfile.UseNormals) { if (m_forLoadingTangents == null) throw new Exception("Model '" + m_assetName + "' doesn't have tangent vectors calculated, but this shader requires them"); if (BoneIndices.Length > 0) { MyVertexFormatPositionNormalTextureTangentSkinned[] vertexArray = new MyVertexFormatPositionNormalTextureTangentSkinned[GetVerticesCount()]; for (int i = 0; i < GetVerticesCount(); i++) { vertexArray[i].PositionPacked = m_vertices[i].Position; vertexArray[i].NormalPacked = m_vertices[i].Normal; vertexArray[i].TexCoordPacked = m_forLoadingTexCoords0[i]; vertexArray[i].TangentPacked = m_forLoadingTangents[i]; vertexArray[i].BoneIndices = new Byte4(BoneIndices[i].X, BoneIndices[i].Y, BoneIndices[i].Z, BoneIndices[i].W); vertexArray[i].BoneWeights = BoneWeights[i]; } m_vertexDeclaration = MyVertexFormatPositionNormalTextureTangentSkinned.VertexDeclaration; m_vertexStride = MyVertexFormatPositionNormalTextureTangentSkinned.Stride; m_vertexBufferSize = vertexArray.Length * m_vertexStride; m_vertexBuffer = new VertexBuffer(MyRender.GraphicsDevice, m_vertexBufferSize, Usage.WriteOnly, VertexFormat.None, Pool.Default); m_vertexBuffer.SetData(vertexArray); m_vertexBuffer.Tag = this; } else { MyVertexFormatPositionNormalTextureTangent[] vertexArray = new MyVertexFormatPositionNormalTextureTangent[GetVerticesCount()]; for (int i = 0; i < GetVerticesCount(); i++) { vertexArray[i].PositionPacked = m_vertices[i].Position; vertexArray[i].NormalPacked = m_vertices[i].Normal; vertexArray[i].TexCoordPacked = m_forLoadingTexCoords0[i]; vertexArray[i].TangentPacked = m_forLoadingTangents[i]; } m_vertexDeclaration = MyVertexFormatPositionNormalTextureTangent.VertexDeclaration; m_vertexStride = MyVertexFormatPositionNormalTextureTangent.Stride; m_vertexBufferSize = vertexArray.Length * m_vertexStride; m_vertexBuffer = new VertexBuffer(MyRender.GraphicsDevice, m_vertexBufferSize, Usage.WriteOnly, VertexFormat.None, Pool.Default); m_vertexBuffer.SetData(vertexArray); m_vertexBuffer.Tag = this; } } else { MyVertexFormatPositionNormalTexture[] vertexArray = new MyVertexFormatPositionNormalTexture[GetVerticesCount()]; for (int i = 0; i < GetVerticesCount(); i++) { vertexArray[i].Position = GetVertexInt(i); vertexArray[i].Normal = GetVertexNormal(i); vertexArray[i].TexCoord = m_forLoadingTexCoords0[i].ToVector2(); } m_vertexDeclaration = MyVertexFormatPositionNormalTexture.VertexDeclaration; m_vertexStride = MyVertexFormatPositionNormalTexture.Stride; m_vertexBufferSize = vertexArray.Length * m_vertexStride; m_vertexBuffer = new VertexBuffer(MyRender.GraphicsDevice, m_vertexBufferSize, Usage.WriteOnly, VertexFormat.None, Pool.Default); m_vertexBuffer.SetData(vertexArray); m_vertexBuffer.Tag = this; } } break; case MyMeshDrawTechnique.VOXELS_DEBRIS: { MyVertexFormatPositionNormal[] vertexArray = new MyVertexFormatPositionNormal[GetVerticesCount()]; for (int i = 0; i < GetVerticesCount(); i++) { vertexArray[i].Position = GetVertexInt(i); vertexArray[i].Normal = GetVertexNormal(i); } m_vertexDeclaration = MyVertexFormatPositionNormal.VertexDeclaration; m_vertexStride = MyVertexFormatPositionNormal.Stride; m_vertexBufferSize = vertexArray.Length * m_vertexStride; m_vertexBuffer = new VertexBuffer(MyRender.GraphicsDevice, m_vertexBufferSize, Usage.WriteOnly, VertexFormat.None, Pool.Default); m_vertexBuffer.SetData(vertexArray); m_vertexBuffer.Tag = this; } break; default: { throw new InvalidBranchException(); } } MyPerformanceCounter.PerAppLifetime.ModelVertexBuffersSize += m_vertexBufferSize; SignResource(m_vertexBuffer); }
public void UnloadContent() { if (m_vertexBuffer != null) { m_vertexBuffer.Dispose(); m_vertexBuffer = null; MyPerformanceCounter.PerAppLifetime.ModelVertexBuffersSize -= m_vertexBufferSize; m_vertexBufferSize = 0; } if (m_indexBuffer != null) { m_indexBuffer.Dispose(); m_indexBuffer = null; MyPerformanceCounter.PerAppLifetime.ModelIndexBuffersSize -= m_indexBufferSize; m_indexBufferSize = 0; } LoadState = Textures.LoadState.Unloaded; m_loadedContent = false; }
public void LoadBuffers(MyModelData modelData, string assetName = null) { System.Diagnostics.Debug.Assert(modelData.Sections.Count > 0, "Invalid object"); if (modelData.Sections.Count == 0) return; // create index buffer { m_trianglesCount = modelData.Indices.Count / 3; m_Indices_16bit = new ushort[modelData.Indices.Count]; for (int i = 0; i < modelData.Indices.Count; ++i) m_Indices_16bit[i] = (ushort)modelData.Indices[i]; m_indexBuffer = new IndexBuffer(MyRender.GraphicsDevice, m_Indices_16bit.Length * sizeof(short), Usage.WriteOnly, Pool.Default, true); m_indexBuffer.SetData(m_Indices_16bit); m_indexBuffer.Tag = this; m_indexBufferSize = m_Indices_16bit.Length * sizeof(short); SignResource(m_indexBuffer); } // create vertex buffer { m_verticesCount = modelData.Positions.Count; m_vertices = new MyCompressedVertexNormal[m_verticesCount]; var vertexArray = new MyVertexFormatPositionNormalTextureTangent[m_verticesCount]; for (int i = 0; i < modelData.Positions.Count; ++i) { vertexArray[i].Position = modelData.Positions[i]; vertexArray[i].Normal = modelData.Normals[i]; vertexArray[i].Tangent = modelData.Tangents[i]; vertexArray[i].TexCoord = modelData.TexCoords[i]; m_vertices[i] = new MyCompressedVertexNormal() { Position = vertexArray[i].PositionPacked, Normal = vertexArray[i].NormalPacked }; } m_vertexDeclaration = MyVertexFormatPositionNormalTextureTangent.VertexDeclaration; m_vertexStride = MyVertexFormatPositionNormalTextureTangent.Stride; m_vertexBufferSize = vertexArray.Length * m_vertexStride; m_vertexBuffer = new VertexBuffer(MyRender.GraphicsDevice, m_vertexBufferSize, Usage.WriteOnly, VertexFormat.None, Pool.Default); m_vertexBuffer.SetData(vertexArray); m_vertexBuffer.Tag = this; SignResource(m_vertexBuffer); } m_meshContainer.Clear(); // apply materials here for (int s = 0; s < modelData.Sections.Count; ++s) { var mpi = new MyMeshPartInfo(); mpi.Technique = m_drawTechnique; // Disabled, because it assert always when models are loaded before materials //System.Diagnostics.Debug.Assert(MyRenderModels.Materials.ContainsKey(modelData.Sections[s].MaterialName), "Mesh material not present!"); if (MyRenderModels.Materials.ContainsKey(modelData.Sections[s].MaterialName)) mpi.m_MaterialDesc = MyRenderModels.Materials[modelData.Sections[s].MaterialName]; var start = modelData.Sections[s].IndexStart; var end = start + modelData.Sections[s].TriCount*3; for (int i = start; i < end; ++i) mpi.m_indices.Add(modelData.Indices[i]); m_meshContainer.Add(new MyRenderMesh(mpi, null) { IndexStart = modelData.Sections[s].IndexStart, TriCount = modelData.Sections[s].TriCount }); } // store properties of this model { BoundingBox = modelData.AABB; BoundingSphere = new BoundingSphere(modelData.AABB.Center, modelData.AABB.HalfExtents.Length()); BoundingBoxSize = BoundingBox.Size; BoundingBoxSizeHalf = BoundingBox.HalfExtents; ModelInfo = new MyModelInfo(m_trianglesCount, m_verticesCount, BoundingBoxSize); PreloadTextures(LoadingMode.Immediate); LoadState = Textures.LoadState.Loaded; m_loadedContent = true; m_loadedData = true; } }
private void SignResource(VertexBuffer vertexBuffer) { vertexBuffer.DebugName = m_assetName + "_vb"; }
/// <summary> /// Dispose /// </summary> public void Dispose() { m_meshContainer.Clear(); m_vertexBuffer.Dispose(); m_vertexBuffer = null; MyPerformanceCounter.PerAppLifetime.ModelVertexBuffersSize -= m_vertexBufferSize; m_vertexBufferSize = 0; m_indexBuffer.Dispose(); m_indexBuffer = null; MyPerformanceCounter.PerAppLifetime.ModelIndexBuffersSize -= m_indexBufferSize; m_indexBufferSize = 0; }
private static void Main() { var form = new RenderForm("SharpDX - MiniCube Direct3D9 Sample"); // Creates the Device var direct3D = new Direct3D(); var device = new Device(direct3D, 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters(form.ClientSize.Width, form.ClientSize.Height)); // Creates the VertexBuffer var vertices = new VertexBuffer(device, Utilities.SizeOf<Vector4>() * 2 * 36, Usage.WriteOnly, VertexFormat.None, Pool.Managed); vertices.Lock(0, 0, LockFlags.None).WriteRange(new[] { new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), // Front new Vector4(-1.0f, 1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4( 1.0f, 1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4( 1.0f, 1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4( 1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(-1.0f, -1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f), // BACK new Vector4( 1.0f, 1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f), new Vector4(-1.0f, 1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f), new Vector4(-1.0f, -1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f), new Vector4( 1.0f, -1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f), new Vector4( 1.0f, 1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f), new Vector4(-1.0f, 1.0f, -1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f), // Top new Vector4(-1.0f, 1.0f, 1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f), new Vector4( 1.0f, 1.0f, 1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f), new Vector4(-1.0f, 1.0f, -1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f), new Vector4( 1.0f, 1.0f, 1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f), new Vector4( 1.0f, 1.0f, -1.0f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f), new Vector4(-1.0f,-1.0f, -1.0f, 1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f), // Bottom new Vector4( 1.0f,-1.0f, 1.0f, 1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f), new Vector4(-1.0f,-1.0f, 1.0f, 1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f), new Vector4(-1.0f,-1.0f, -1.0f, 1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f), new Vector4( 1.0f,-1.0f, -1.0f, 1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f), new Vector4( 1.0f,-1.0f, 1.0f, 1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f), new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f), // Left new Vector4(-1.0f, -1.0f, 1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f), new Vector4(-1.0f, 1.0f, 1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f), new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f), new Vector4(-1.0f, 1.0f, 1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f), new Vector4(-1.0f, 1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f), new Vector4( 1.0f, -1.0f, -1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f), // Right new Vector4( 1.0f, 1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f), new Vector4( 1.0f, -1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f), new Vector4( 1.0f, -1.0f, -1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f), new Vector4( 1.0f, 1.0f, -1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f), new Vector4( 1.0f, 1.0f, 1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f), }); vertices.Unlock(); // Compiles the effect var effect = Effect.FromFile(device, "MiniCube.fx", ShaderFlags.None); // Allocate Vertex Elements var vertexElems = new[] { new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0), new VertexElement(0, 16, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Color, 0), VertexElement.VertexDeclarationEnd }; // Creates and sets the Vertex Declaration var vertexDecl = new VertexDeclaration(device, vertexElems); device.SetStreamSource(0, vertices, 0, Utilities.SizeOf<Vector4>() * 2); device.VertexDeclaration = vertexDecl; // Get the technique var technique = effect.GetTechnique(0); var pass = effect.GetPass(technique, 0); // Prepare matrices var view = Matrix.LookAtLH(new Vector3(0, 0, -5), new Vector3(0, 0, 0), Vector3.UnitY); var proj = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, form.ClientSize.Width / (float)form.ClientSize.Height, 0.1f, 100.0f); var viewProj = Matrix.Multiply(view, proj); // Use clock var clock = new Stopwatch(); clock.Start(); RenderLoop.Run(form, () => { var time = clock.ElapsedMilliseconds / 1000.0f; device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); device.BeginScene(); effect.Technique = technique; effect.Begin(); effect.BeginPass(0); var worldViewProj = Matrix.RotationX(time) * Matrix.RotationY(time * 2) * Matrix.RotationZ(time * .7f) * viewProj; effect.SetValue("worldViewProj", worldViewProj); device.DrawPrimitives(PrimitiveType.TriangleList, 0, 12); effect.EndPass(); effect.End(); device.EndScene(); device.Present(); }); effect.Dispose(); vertices.Dispose(); device.Dispose(); direct3D.Dispose(); }
static void Main() { var form = new RenderForm("SlimDX2 - MiniTri Direct3D9 Sample"); var device = new Device(new Direct3D(), 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters(form.ClientSize.Width,form.ClientSize.Height)); var vertices = new VertexBuffer(device, 3 * 20, Usage.WriteOnly, VertexFormat.None, Pool.Managed); vertices.Lock(0, 0, LockFlags.None).WriteRange(new[] { new Vertex() { Color = Color.Red, Position = new Vector4(400.0f, 100.0f, 0.5f, 1.0f) }, new Vertex() { Color = Color.Blue, Position = new Vector4(650.0f, 500.0f, 0.5f, 1.0f) }, new Vertex() { Color = Color.Green, Position = new Vector4(150.0f, 500.0f, 0.5f, 1.0f) } }); vertices.Unlock(); var vertexElems = new[] { new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.PositionTransformed, 0), new VertexElement(0, 16, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0), VertexElement.VertexDeclarationEnd }; var vertexDecl = new VertexDeclaration(device, vertexElems); RenderLoop.Run(form, () => { device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); device.BeginScene(); device.SetStreamSource(0, vertices, 0, 20); device.VertexDeclaration = vertexDecl; device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1); device.EndScene(); device.Present(); }); }