public SkinnedMeshCapturer(usdiExporter exporter, ComponentCapturer parent, SkinnedMeshRenderer target) : base(exporter, parent, target.GetComponent <Transform>(), false) { m_usd = usdi.usdiCreateMesh(ctx, parent.usd, CreateName(target)); m_target = target; m_buffer = new MeshBuffer(); if (m_target.GetComponent <Cloth>() != null) { base.scale = false; } m_captureNormals = exporter.m_captureMeshNormals; m_captureTangents = exporter.m_captureMeshTangents; m_captureUVs = exporter.m_captureMeshUVs; m_captureBones = exporter.m_captureSkinnedMeshAs == SkinnedMeshCaptureMode.BoneAndWeights; m_captureEveryFrame = !m_captureBones; var conf = target.GetComponent <usdiMeshExportConfig>(); if (conf != null) { m_captureNormals = conf.m_captureNormals; m_captureTangents = conf.m_captureTangents; m_captureUVs = conf.m_captureUVs; m_captureEveryFrame = conf.m_captureEveryFrame; m_captureEveryFrameUV = conf.m_captureEveryFrameUV; m_captureEveryFrameIndices = conf.m_captureEveryFrameIndices; } }
internal static void CheckRectangle(Brush brush, Pen pen, Rect rectangle, int width, int height, [CallerMemberName] string methodName = "unknown") { Application.EnableMSAA = false; MeshBuffer meshBuffer = new MeshBuffer(); MeshList meshList = new MeshList(); BuiltinGeometryRenderer renderer = new BuiltinGeometryRenderer(); byte[] bytes; using (var context = new RenderContextForTest(width, height)) { renderer.OnBeforeRead(); renderer.DrawRectangle(brush, pen, rectangle);//This must be called after the RenderContextForTest is created, for uploading textures to GPU via OpenGL. renderer.OnAfterRead(meshList); //rebuild mesh buffer meshBuffer.Clear(); meshBuffer.Init(); meshBuffer.Append(meshList); //draw mesh buffer to screen context.Clear(); context.DrawMeshes(meshBuffer); bytes = context.GetRenderedRawBytes(); } Util.CheckExpectedImage(bytes, width, height, $"{RootDir}{nameof(DrawRectangle)}\\{methodName}.png"); }
public static void CaptureMesh(AbcAPI.aeObject abc, Mesh mesh, Cloth cloth, MeshBuffer dst_buf) { dst_buf.indices = mesh.triangles; dst_buf.uvs = mesh.uv; if (cloth == null) { dst_buf.vertices = mesh.vertices; dst_buf.normals = mesh.normals; } else { dst_buf.vertices = cloth.vertices; dst_buf.normals = cloth.normals; } var data = new AbcAPI.aePolyMeshData(); data.indices = GetArrayPtr(dst_buf.indices); data.positions = GetArrayPtr(dst_buf.vertices); if (dst_buf.normals != null) { data.normals = GetArrayPtr(dst_buf.normals); } if (dst_buf.uvs != null) { data.uvs = GetArrayPtr(dst_buf.uvs); } data.positionCount = dst_buf.vertices.Length; data.indexCount = dst_buf.indices.Length; AbcAPI.aePolyMeshWriteSample(abc, ref data); }
public override void OnFill(MeshBuffer m) { if (base.mOuterUV == this.mInnerUV) { base.OnFill(m); } else { NineRectangle rectangle; NineRectangle rectangle2; Vector4 vector; Vector4 vector2; float3 num = new float3 { xyz = base.cachedTransform.localScale }; vector.x = this.mOuterUV.xMin; vector.y = this.mInnerUV.xMin; vector.z = this.mInnerUV.xMax; vector.w = this.mOuterUV.xMax; vector2.x = this.mOuterUV.yMin; vector2.y = this.mInnerUV.yMin; vector2.z = this.mInnerUV.yMax; vector2.w = this.mOuterUV.yMax; NineRectangle.Calculate(base.pivot, base.atlas.pixelSize, base.mainTexture, ref vector, ref vector2, ref num.xy, out rectangle, out rectangle2); Color color = base.color; if (this.mFillCenter) { NineRectangle.Fill9(ref rectangle, ref rectangle2, ref color, m); } else { NineRectangle.Fill8(ref rectangle, ref rectangle2, ref color, m); } } }
public SkinnedMeshCapturer(SkinnedMeshRenderer target, AbcAPI.aeObject abc) { m_obj = target.gameObject; m_abc = abc; m_target = target; m_mesh_buffer = new MeshBuffer(); }
public static void CaptureMesh(AbcAPI.aeObject abc, Mesh mesh, Cloth cloth, MeshBuffer dst_buf) { dst_buf.Clear(); dst_buf.indices.LockList(ls => mesh.GetTriangles(ls, 0)); dst_buf.uvs.LockList(ls => mesh.GetUVs(0, ls)); if (cloth == null) { dst_buf.vertices.LockList(ls => mesh.GetVertices(ls)); dst_buf.normals.LockList(ls => mesh.GetNormals(ls)); } else { dst_buf.vertices.Assign(cloth.vertices); dst_buf.normals.Assign(cloth.normals); } var data = new AbcAPI.aePolyMeshData(); data.indices = dst_buf.indices; data.positions = dst_buf.vertices; data.normals = dst_buf.normals; data.uvs = dst_buf.uvs; data.positionCount = dst_buf.vertices.Count; data.indexCount = dst_buf.indices.Count; AbcAPI.aePolyMeshWriteSample(abc, ref data); }
internal static void DrawNodeToImage_NewPipeline(out byte[] imageRawBytes, Node node, int width, int height) { Application.EnableMSAA = false; MeshBuffer meshBuffer = new MeshBuffer(); MeshList meshList = new MeshList(); BuiltinGeometryRenderer geometryRenderer = new BuiltinGeometryRenderer(); using (var context = new RenderContextForTest(width, height)) { RenderContext renderContext = new RenderContext(geometryRenderer, meshList); //This must be called after the RenderContextForTest is created, for uploading textures to GPU via OpenGL. node.Render(renderContext); //rebuild mesh buffer meshBuffer.Clear(); meshBuffer.Init(); meshBuffer.Build(meshList); //draw mesh buffer to screen context.Clear(); context.DrawMeshes(meshBuffer); imageRawBytes = context.GetRenderedRawBytes(); } }
public MeshCapturer(MeshRenderer target, aeAPI.aeObject abc) { m_obj = target.gameObject; m_abc = abc; m_target = target; m_mesh_buffer = new MeshBuffer(); }
internal static void DrawNodesToImage(out byte[] imageRawBytes, IList <Node> nodes, int width, int height) { MeshBuffer meshBuffer = new MeshBuffer(); MeshList meshList = new MeshList(); IPrimitiveRenderer primitiveRenderer = new BuiltinPrimitiveRenderer(); using (var context = new RenderContextForTest(width, height)) { //This must be called after the context is created, for creating textures when the OpenGL context is built. foreach (var node in nodes) { node.Draw(primitiveRenderer, meshList); } //rebuild mesh buffer meshBuffer.Clear(); meshBuffer.Init(); meshBuffer.Build(meshList); //draw mesh buffer to screen context.Clear(); context.DrawMeshes(meshBuffer); imageRawBytes = context.GetRenderedRawBytes(); } }
public SkinnedMeshCapturer(AlembicExporter exp, ComponentCapturer parent, SkinnedMeshRenderer target) : base(exp, parent, target) { m_target = target; var mesh = target.sharedMesh; if (mesh == null) { return; } m_abc = parent.abc.NewPolyMesh(target.name); m_mbuf = new MeshBuffer(); m_mbuf.SetupSubmeshes(m_abc, mesh, m_target.sharedMaterials); m_meshSrc = target.sharedMesh; m_cloth = m_target.GetComponent <Cloth>(); if (m_cloth != null) { m_cbuf = new ClothBuffer(); m_cbuf.rootBone = m_target.rootBone != null ? m_target.rootBone : m_target.GetComponent <Transform>(); var tc = m_parent as TransformCapturer; if (tc != null) { tc.capturePosition = false; tc.captureRotation = false; tc.captureScale = false; } } }
public static void CaptureMesh(usdi.Mesh usd, ref usdi.MeshData data, MeshBuffer dst_buf) { data = usdi.MeshData.default_value; if (dst_buf.vertices != null) { data.points = usdi.GetArrayPtr(dst_buf.vertices); data.num_points = dst_buf.vertices.Length; } if (dst_buf.indices != null) { data.indices = usdi.GetArrayPtr(dst_buf.indices); data.num_indices = dst_buf.indices.Length; } if (dst_buf.normals != null) { data.normals = usdi.GetArrayPtr(dst_buf.normals); } if (dst_buf.tangents != null) { data.tangents = usdi.GetArrayPtr(dst_buf.tangents); } if (dst_buf.uvs != null) { data.uvs = usdi.GetArrayPtr(dst_buf.uvs); } if (dst_buf.weights != null && dst_buf.bones != null) { data.weights = usdi.GetArrayPtr(dst_buf.weights); data.bindposes = usdi.GetArrayPtr(dst_buf.bindposes); data.num_bones = dst_buf.bones.Length; data.max_bone_weights = 4; usdi.usdiMeshAssignBones(usd, ref data, dst_buf.bones, dst_buf.bones.Length); usdi.usdiMeshAssignRootBone(usd, ref data, dst_buf.rootBone); } }
public override void OnFill(MeshBuffer m) { NineRectangle nineRectangle; NineRectangle nineRectangle1; Vector4 vector4 = new Vector4(); Vector4 vector41 = new Vector4(); if (this.mOuterUV == this.mInnerUV) { base.OnFill(m); return; } float3 _float3 = new float3() { xyz = base.cachedTransform.localScale }; vector4.x = this.mOuterUV.xMin; vector4.y = this.mInnerUV.xMin; vector4.z = this.mInnerUV.xMax; vector4.w = this.mOuterUV.xMax; vector41.x = this.mOuterUV.yMin; vector41.y = this.mInnerUV.yMin; vector41.z = this.mInnerUV.yMax; vector41.w = this.mOuterUV.yMax; NineRectangle.Calculate(base.pivot, base.atlas.pixelSize, base.mainTexture, ref vector4, ref vector41, ref _float3.xy, out nineRectangle, out nineRectangle1); Color color = base.color; if (!this.mFillCenter) { NineRectangle.Fill8(ref nineRectangle, ref nineRectangle1, ref color, m); } else { NineRectangle.Fill9(ref nineRectangle, ref nineRectangle1, ref color, m); } }
public MeshCapturer(ComponentCapturer parent, MeshRenderer target) : base(parent) { m_obj = target.gameObject; m_abc = AbcAPI.aeNewPolyMesh(parent.abc, target.name); m_target = target; m_mesh_buffer = new MeshBuffer(); }
void Start() { if (mMeshBuffer == null) { mMeshBuffer = new MeshBuffer(); } ViewMeshFilter.mesh = mMeshBuffer.mesh; }
void generateMultiple16bitMeshbuffers(int N) { Vertex3D[] vertices32bit; uint[] indices32bit; generateVerticesAndIndices(N, out vertices32bit, out indices32bit); List <Vertex3D> verticesChunk = new List <Vertex3D>(); List <ushort> indicesChunk = new List <ushort>(); int totalCubes = N * N * N; int indicesInCube = indices32bit.Length / totalCubes; int verticesInCube = vertices32bit.Length / totalCubes; int maximumVerticesPerChunk = ushort.MaxValue; // must not be more than 0xffff (because we use 16-bit indices) int verticesIndexOffset = 0; device.Logger.Log("Batching cubes into 16-bit meshbuffers..."); for (int cubeIndex = 0; cubeIndex < totalCubes; cubeIndex++) { // add vertices for (int i = 0; i < verticesInCube; i++) { verticesChunk.Add(vertices32bit[cubeIndex * verticesInCube + i]); } // add indices for (int i = 0; i < indicesInCube; i++) { indicesChunk.Add((ushort)(indices32bit[cubeIndex * indicesInCube + i] - verticesIndexOffset)); } if (verticesChunk.Count + verticesInCube > maximumVerticesPerChunk || // if this chunk is full cubeIndex == totalCubes - 1) // or this is last cube { // we create meshbuffer and add it to the main mesh MeshBuffer mb = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit); mb.SetHardwareMappingHint(HardwareMappingHint.Static, HardwareBufferType.VertexAndIndex); //mb.Append(verticesChunk.ToArray(), indicesChunk.ToArray()); mb.Append(verticesChunk.ToArray(), indicesChunk.ToArray()); mb.RecalculateBoundingBox(); mesh.AddMeshBuffer(mb); mb.Drop(); // clean up vertex and index chunks verticesIndexOffset += verticesChunk.Count; verticesChunk.Clear(); indicesChunk.Clear(); device.Logger.Log( (((cubeIndex + 1) * 100) / totalCubes) + "%: " + mesh + ". ~" + Program.MemUsageText); GC.Collect(); } } }
void GenerateRemapIndices(Mesh mesh, MeshBuffer mbuf) { mbuf.Capture(mesh, Matrix4x4.identity, false, false, false, false); var weights4 = new PinnedList <BoneWeight>(); weights4.LockList(l => { mesh.GetBoneWeights(l); }); remap.Resize(mbuf.points.Count); numRemappedVertices = NativeMethods.aeGenerateRemapIndices(remap, mbuf.points, weights4, mbuf.points.Count); }
CollisionShape bulletGetCollisionShape(Shape shape, SceneNode node) { switch (shape) { case Shape.Box: { return(new BoxShape(node.BoundingBox.Extent.X / 2)); } case Shape.Shpere: { return(new SphereShape(node.BoundingBox.Extent.X / 2)); } case Shape.Mesh: { MeshSceneNode meshNode = node as MeshSceneNode; if (meshNode == null) { throw new ArgumentException(); } TriangleMesh triangleMesh = new TriangleMesh(); for (int i = 0; i < meshNode.Mesh.MeshBufferCount; i++) { MeshBuffer b = meshNode.Mesh.GetMeshBuffer(i); ushort[] inds = b.Indices as ushort[]; Vertex3DTTCoords[] verts = b.Vertices as Vertex3DTTCoords[]; if (inds == null || verts == null) { throw new ArgumentException(); } for (int j = 0; j < inds.Length; j += 3) { Vector3Df v0 = verts[inds[j + 0]].Position; Vector3Df v1 = verts[inds[j + 1]].Position; Vector3Df v2 = verts[inds[j + 2]].Position; triangleMesh.AddTriangle( new Vector3(v0.X, v0.Y, v0.Z), new Vector3(v1.X, v1.Y, v1.Z), new Vector3(v2.X, v2.Y, v2.Z)); } } return(new BvhTriangleMeshShape(triangleMesh, false)); } default: throw new ArgumentException(); } }
public static void CaptureMesh( usdi.Mesh usd, ref usdi.MeshData data, MeshBuffer buf, Mesh mesh, MeshCaptureFlags flags) { buf.vertices = flags.points ? mesh.vertices : null; buf.normals = flags.normals ? mesh.normals : null; buf.tangents = flags.tangents ? mesh.tangents : null; buf.indices = flags.indices ? mesh.triangles : null; buf.uvs = flags.uvs ? mesh.uv : null; CaptureMesh(usd, ref data, buf); }
/// <summary> /// Generates a MeshBuffer which represents all the vertices and indices for values of y /// between y0 and y1, and add it to the mesh. /// </summary> void addStrip(HeightMap map, ColorFunc cf, int y0, int y1) { Vertex3D[] vertices = new Vertex3D[(y1 - y0 + 1) * width]; ushort[] indices = new ushort[(y1 - y0) * (width - 1) * 6]; // "6" is a number of indices in 2 triangles (which forms a quad) // calculate vertices int i = 0; for (int y = y0; y <= y1; ++y) { for (int x = 0; x < width; ++x) { float z = map.GetHeight(x, y); float xf = (float)x / (float)width; float yf = (float)y / (float)height; vertices[i++] = new Vertex3D( new Vector3Df(x, scale * z, y), // position map.GetNormal(x, y, scale), // normal calculate(cf, xf, yf, z), // color new Vector2Df(xf, yf) // tcoords ); } } // calculate indices i = 0; for (int y = y0; y < y1; ++y) { for (int x = 0; x < width - 1; ++x) { int n = (y - y0) * width + x; indices[i++] = (ushort)n; indices[i++] = (ushort)(n + width); indices[i++] = (ushort)(n + width + 1); indices[i++] = (ushort)(n + width + 1); indices[i++] = (ushort)(n + 1); indices[i++] = (ushort)n; } } // append calculated verices and indices to mesh buffer MeshBuffer buf = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit); // create new buffer Mesh.AddMeshBuffer(buf); buf.Append(vertices, indices); buf.RecalculateBoundingBox(); buf.Drop(); }
static void Main(string[] args) { GraphicsDebug.Init(); Wnd = new Window("Test", 800, 600); Pipeline DefaultPipeline = Wnd.CreatePipeline(new ResourceLayout[] { UniformLayouts.TextureLayout, UniformLayouts.UniformsLayout }); CommandList List = Wnd.CreateCommandList(); MeshBuffer Msh = Wnd.CreateGraphicsObject <MeshBuffer>(); Msh.Upload(new Vertex3D[] { new Vertex3D(new Vector3(0, 0, 0), RgbaFloat.Red, new Vector2(0, 0)), new Vertex3D(new Vector3(0, 1, 0), RgbaFloat.Green, new Vector2(0, 1)), new Vertex3D(new Vector3(1, 1, 0), RgbaFloat.Blue, new Vector2(1, 1)), new Vertex3D(new Vector3(1, 0, 0), RgbaFloat.Yellow, new Vector2(1, 0)), }, new ushort[] { 2, 1, 0, 2, 0, 3 }); TextureBuffer Tex = Wnd.CreateGraphicsObject <TextureBuffer>(); Tex.Update(UniformLayouts.TextureLayout, Image.FromFile("Data/Textures/Test.png")); ResourceSet TexResource = Wnd.CreateResourceSet(UniformLayouts.TextureLayout, new BindableResource[] { Tex.TexView, Tex.TexSampler }); DeviceBuffer UniformBuffer = Wnd.GfxDev.ResourceFactory.CreateBuffer(new BufferDescription((uint)sizeof(Uniforms), BufferUsage.UniformBuffer, 0)); ResourceSet UniformsRes = Wnd.CreateResourceSet(UniformLayouts.UniformsLayout, new BindableResource[] { UniformBuffer }); while (!Wnd.ShouldClose) { { List.Begin(); List.SetFramebuffer(Wnd.GetFramebuffer()); List.ClearColorTarget(0, RgbaFloat.CornflowerBlue); List.SetPipeline(DefaultPipeline); List.SetGraphicsResourceSet(0, TexResource); /*List.SetGraphicsResourceSet(1, UniformsRes); * List.UpdateBuffer(UniformBuffer, 0, new Uniforms() { * Clr = new Vector4(50, 143, 168, 255) / new Vector4(255), * });*/ Msh.Render(List); List.End(); } Wnd.SubmitCommands(List); Wnd.WaitForIdle(); Wnd.SwapBuffers(); Wnd.PumpEvents(); } }
internal static void DrawNodeTreeToImage(out byte[] imageRawBytes, Node root, int width, int height, Rect clipRect) { if (root == null) { throw new ArgumentNullException(nameof(root)); } MeshBuffer meshBuffer = new MeshBuffer(); MeshList meshList = new MeshList(); BuiltinGeometryRenderer geometryRenderer = new BuiltinGeometryRenderer(); using (var context = new RenderContextForTest(width, height)) { if (root is Node rootNode) { using (var dc = rootNode.RenderOpen()) { dc.DrawBoxModel(rootNode.RuleSet, rootNode.Rect); } } root.Foreach(visual => { if (!(visual is Node node)) { return(true); } using (var dc = node.RenderOpen()) { dc.DrawBoxModel(node.RuleSet, node.Rect); } return(true); }); //This must be called after the context is created, for uploading textures to GPU via OpenGL. root.Render(new RenderContext(geometryRenderer, meshList)); //rebuild mesh buffer meshBuffer.Clear(); meshBuffer.Init(); meshBuffer.Build(meshList); //draw mesh buffer to screen context.Clear(); context.DrawMeshes(meshBuffer); imageRawBytes = context.GetRenderedRawBytes(); } }
public MarchingCubes(int size, float target, int[] order) { mb = new MeshBuffer(); this.size = size; rS = size + 1; this.target = target; this.order = order; for (int e = 0; e < 12; e++) { edgeVertex[e] = new TVector3(); } }
void create_model_indices(LaserDataSceneNode node, ushort sides, ushort slices) { // crear los indices MeshBuffer mbuffer = node.get_mesh_buffer(); //uint ind_count =(uint)( (slices - 1) * (sides - 1) * 12); uint ind_count = (uint)((slices - 1) * (sides - 1) * 6); mbuffer.AllocateIndices(ind_count); m_buffer_index = 0; for (ushort i = 0; i < slices - 1; i++) { for (ushort j = 0; j < sides - 1; j++) { //first triangle mbuffer.SetIndex(m_buffer_index, (ushort)((i + 1) * sides + j)); m_buffer_index++; mbuffer.SetIndex(m_buffer_index, (ushort)(i * sides + j)); m_buffer_index++; mbuffer.SetIndex(m_buffer_index, (ushort)((i + 1) * sides + j + 1)); m_buffer_index++; //second triangle mbuffer.SetIndex(m_buffer_index, (ushort)((i + 1) * sides + j + 1)); m_buffer_index++; mbuffer.SetIndex(m_buffer_index, (ushort)(i * sides + j)); m_buffer_index++; mbuffer.SetIndex(m_buffer_index, (ushort)(i * sides + j + 1)); m_buffer_index++; /* * //third triangle * mbuffer.SetIndex(m_buffer_index, (ushort)((i + 1) * sides + j)); * m_buffer_index++; * mbuffer.SetIndex(m_buffer_index, (ushort)(i * sides + j)); * m_buffer_index++; * mbuffer.SetIndex(m_buffer_index, (ushort)((i + 1) * sides + j + 1)); * m_buffer_index++; * * //fourth triangle * mbuffer.SetIndex(m_buffer_index, (ushort)((i + 1) * sides + j + 1)); * m_buffer_index++; * mbuffer.SetIndex(m_buffer_index, (ushort)(i * sides + j)); * m_buffer_index++; * mbuffer.SetIndex(m_buffer_index, (ushort)(i * sides + j + 1)); * m_buffer_index++;*/ } } }
public MeshCapturer(AlembicExporter exp, ComponentCapturer parent, MeshRenderer target) : base(exp, parent, target) { m_target = target; var mesh = m_target.GetComponent <MeshFilter>().sharedMesh; if (mesh == null) { return; } m_abc = parent.abc.NewPolyMesh(target.name); m_mbuf = new MeshBuffer(); m_mbuf.SetupSubmeshes(m_abc, mesh, m_target.sharedMaterials); }
public override void OnFill(MeshBuffer m) { if (this.mFont == null) { return; } Color color = (!this.mInvisibleHack ? base.color : Color.clear); this.MakePositionPerfect(); UIWidget.Pivot pivot = base.pivot; int num = m.vSize; if (pivot != UIWidget.Pivot.Left && pivot != UIWidget.Pivot.TopLeft && pivot != UIWidget.Pivot.BottomLeft) { if (pivot == UIWidget.Pivot.Right || pivot == UIWidget.Pivot.TopRight || pivot == UIWidget.Pivot.BottomRight) { UIFont uIFont = this.mFont; string str = this.processedText; bool flag = this.mEncoding; UIFont.SymbolStyle symbolStyle = this.mSymbols; Vector2 vector2 = this.relativeSize; uIFont.Print(str, color, m, flag, symbolStyle, UIFont.Alignment.Right, Mathf.RoundToInt(vector2.x * (float)this.mFont.size), ref this.mSelection, this.mCarratChar, this.mHighlightTextColor, this.mHighlightColor, this.mHighlightChar, this.mHighlightCharSplit); } else { UIFont uIFont1 = this.mFont; string str1 = this.processedText; bool flag1 = this.mEncoding; UIFont.SymbolStyle symbolStyle1 = this.mSymbols; Vector2 vector21 = this.relativeSize; uIFont1.Print(str1, color, m, flag1, symbolStyle1, UIFont.Alignment.Center, Mathf.RoundToInt(vector21.x * (float)this.mFont.size), ref this.mSelection, this.mCarratChar, this.mHighlightTextColor, this.mHighlightColor, this.mHighlightChar, this.mHighlightCharSplit); } } else if (!this.mOverflowRight) { this.mFont.Print(this.processedText, color, m, this.mEncoding, this.mSymbols, UIFont.Alignment.Left, 0, ref this.mSelection, this.mCarratChar, this.mHighlightTextColor, this.mHighlightColor, this.mHighlightChar, this.mHighlightCharSplit); } else { UIFont uIFont2 = this.mFont; string str2 = this.processedText; bool flag2 = this.mEncoding; UIFont.SymbolStyle symbolStyle2 = this.mSymbols; Vector2 vector22 = this.relativeSize; uIFont2.Print(str2, color, m, flag2, symbolStyle2, UIFont.Alignment.LeftOverflowRight, Mathf.RoundToInt(vector22.x * (float)this.mFont.size), ref this.mSelection, this.mCarratChar, this.mHighlightTextColor, this.mHighlightColor, this.mHighlightChar, this.mHighlightCharSplit); } m.ApplyEffect(base.cachedTransform, num, this.effectStyle, this.effectColor, (float)this.mFont.size); }
public void export_to_obj(string filename) { if (has_vertices() == false) { System.Windows.Forms.MessageBox.Show("No hay grafica para exportar."); return; } System.IO.StreamWriter writer = new System.IO.StreamWriter(filename); string buffer; // escribir encabezado writer.WriteLine("g laser_data_mesh"); MeshBuffer mbuffer = get_mesh_buffer(); // Escribir las coordenadas for (uint i = 0; i < mbuffer.VertexCount; i++) { Vertex3D vert = mbuffer.GetVertex(i); buffer = "v " + vert.Position.X.ToString() + " " + vert.Position.Y.ToString() + " " + vert.Position.Z.ToString(); writer.WriteLine(buffer); } // Escribir las normales for (uint i = 0; i < mbuffer.VertexCount; i++) { Vertex3D vert = mbuffer.GetVertex(i); buffer = "vn " + vert.Normal.X.ToString() + " " + vert.Normal.Y.ToString() + " " + vert.Normal.Z.ToString(); writer.WriteLine(buffer); } // Escribir los indices for (uint i = 0; i < mbuffer.IndexCount / 3; i++) { string i0 = (mbuffer.GetIndex(i * 3) + 1).ToString(); string i1 = (mbuffer.GetIndex(i * 3 + 1) + 1).ToString(); string i2 = (mbuffer.GetIndex(i * 3 + 2) + 1).ToString(); buffer = "f " + i0 + "//" + i0 + " " + i1 + "//" + i1 + " " + i2 + "//" + i2; writer.WriteLine(buffer); } writer.Close(); writer = null; }
public void Init(Camera camera) { renderCamera = camera; spriteBufferObject = new SpriteBuffer(); spriteBufferObject.renderCamera = camera; meshBufferObject = new MeshBuffer(); meshBufferObject.renderCamera = camera; spriteShapeBufferObject = new SpriteShapeBuffer(); spriteShapeBufferObject.renderCamera = camera; tilemapBufferObject = new TilemapBuffer(); tilemapBufferObject.renderCamera = camera; }
public void ComputeBoundingBox() { try { using (MeshBuffer b = meshObj.GetVertexBuffer(0)) { using (DataStream v = b.Map()) { v.Position = 0; bb = BoundingBox.FromPoints(v, meshObj.VertexCount, MeshInputElements10.GetStride(inputElements)); } } } catch (Exception ex) { } }
public SkinnedMeshCapturer(ComponentCapturer parent, SkinnedMeshRenderer target) : base(parent) { m_obj = target.gameObject; m_abc = AbcAPI.aeNewPolyMesh(parent.abc, target.name); m_target = target; m_mesh_buffer = new MeshBuffer(); if (m_target.GetComponent <Cloth>() != null) { var t = m_parent as TransformCapturer; if (t != null) { t.scale = false; } } }
void generateSingle32BitMeshbuffer(int N) { Vertex3D[] vertices32bit; uint[] indices32bit; generateVerticesAndIndices(N, out vertices32bit, out indices32bit); MeshBuffer mb = MeshBuffer.Create(VertexType.Standard, IndexType._32Bit); mesh.AddMeshBuffer(mb); mb.Drop(); device.Logger.Log("Appending " + vertices32bit.Length + " vertices and " + indices32bit.Length + " indices to 32-bit meshbuffer..."); mb.Append(vertices32bit, indices32bit); mb.SetHardwareMappingHint(HardwareMappingHint.Static, HardwareBufferType.VertexAndIndex); }
public static void CaptureMesh( usdi.Mesh usd, ref usdi.MeshData data, MeshBuffer buf, SkinnedMeshRenderer smr, MeshCaptureFlags flags, bool captureBones) { Cloth cloth = smr.GetComponent <Cloth>(); if (cloth != null) { var mesh = buf.bakedMesh; smr.BakeMesh(mesh); buf.vertices = flags.points ? cloth.vertices : null; buf.normals = flags.normals ? cloth.normals : null; buf.tangents = flags.tangents ? mesh.tangents : null; buf.indices = flags.indices ? mesh.triangles : null; buf.uvs = flags.uvs ? mesh.uv : null; } else if (captureBones && buf.bones != null) { var mesh = smr.sharedMesh; buf.vertices = flags.points ? mesh.vertices : null; buf.normals = flags.normals ? mesh.normals : null; buf.tangents = flags.tangents ? mesh.tangents : null; buf.indices = flags.indices ? mesh.triangles : null; buf.uvs = flags.uvs ? mesh.uv : null; buf.weights = mesh.boneWeights; buf.bindposes = mesh.bindposes; } else { var mesh = buf.bakedMesh; smr.BakeMesh(mesh); buf.vertices = flags.points ? mesh.vertices : null; buf.normals = flags.normals ? mesh.normals : null; buf.tangents = flags.tangents ? mesh.tangents : null; buf.indices = flags.indices ? mesh.triangles : null; buf.uvs = flags.uvs ? mesh.uv : null; } CaptureMesh(usd, ref data, buf); }
public NavRenderer(Form1 F) : base(F.Device) { P = F; P.ObjectSelected += new EventHandler(P_ObjectSelected); RisenWorld.WorldCleared += new WorldCleared(RisenWorld_OnClear); RisenWorld.LrentFileAdded += new FilesAdded(RisenWorld_OnFileAdded); RisenWorld.LoadingFinished += new LoadingFinished(RisenWorld_LoadingFinished); RisenWorld.EntityAdded += new EntityAdded(RisenWorld_EntityAdded); tSorter = new ThreadedLibraryRenderer(); tSorter.Predicate = ComparePredicate; E = new EffectWrapper("gizmo.fx", D); GizmoComponent.colorVertex[] V = new GizmoComponent.colorVertex[100]; for(int i = 0; i < V.Length; i++) V[i] = new GizmoComponent.colorVertex(i,0); mBuffer = new MeshBuffer(V, V[0], F.Device, PrimitiveTopology.TriangleList); }
public override void OnFill(MeshBuffer m) { float single; float single1; Vertex vertex = new Vertex(); Vertex vertex1 = new Vertex(); Vertex vertex2 = new Vertex(); Vertex vertex3 = new Vertex(); float single2 = 0f; float single3 = 0f; float single4 = 1f; float single5 = -1f; float single6 = this.mOuterUV.xMin; float single7 = this.mOuterUV.yMin; float single8 = this.mOuterUV.xMax; float single9 = this.mOuterUV.yMax; if (this.mFillDirection == UIFilledSprite.FillDirection.Horizontal || this.mFillDirection == UIFilledSprite.FillDirection.Vertical) { float single10 = (single8 - single6) * this.mFillAmount; float single11 = (single9 - single7) * this.mFillAmount; if (this.fillDirection == UIFilledSprite.FillDirection.Horizontal) { if (!this.mInvert) { single4 = single4 * this.mFillAmount; single8 = single6 + single10; } else { single2 = 1f - this.mFillAmount; single6 = single8 - single10; } } else if (this.fillDirection == UIFilledSprite.FillDirection.Vertical) { if (!this.mInvert) { single3 = -(1f - this.mFillAmount); single9 = single7 + single11; } else { single5 = single5 * this.mFillAmount; single7 = single9 - single11; } } } Vector2[] vector2 = new Vector2[4]; Vector2[] vector2Array = new Vector2[4]; vector2[0] = new Vector2(single4, single3); vector2[1] = new Vector2(single4, single5); vector2[2] = new Vector2(single2, single5); vector2[3] = new Vector2(single2, single3); vector2Array[0] = new Vector2(single8, single9); vector2Array[1] = new Vector2(single8, single7); vector2Array[2] = new Vector2(single6, single7); vector2Array[3] = new Vector2(single6, single9); Color color = base.color; if (this.fillDirection != UIFilledSprite.FillDirection.Radial90) { if (this.fillDirection == UIFilledSprite.FillDirection.Radial180) { Vector2[] vector21 = new Vector2[4]; Vector2[] vector2Array1 = new Vector2[4]; for (int i = 0; i < 2; i++) { vector21[0] = new Vector2(0f, 0f); vector21[1] = new Vector2(0f, 1f); vector21[2] = new Vector2(1f, 1f); vector21[3] = new Vector2(1f, 0f); vector2Array1[0] = new Vector2(0f, 0f); vector2Array1[1] = new Vector2(0f, 1f); vector2Array1[2] = new Vector2(1f, 1f); vector2Array1[3] = new Vector2(1f, 0f); if (this.mInvert) { if (i > 0) { this.Rotate(vector21, i); this.Rotate(vector2Array1, i); } } else if (i < 1) { this.Rotate(vector21, 1 - i); this.Rotate(vector2Array1, 1 - i); } if (i != 1) { single = (!this.mInvert ? 0.5f : 1f); single1 = (!this.mInvert ? 1f : 0.5f); } else { single = (!this.mInvert ? 1f : 0.5f); single1 = (!this.mInvert ? 0.5f : 1f); } vector21[1].y = Mathf.Lerp(single, single1, vector21[1].y); vector21[2].y = Mathf.Lerp(single, single1, vector21[2].y); vector2Array1[1].y = Mathf.Lerp(single, single1, vector2Array1[1].y); vector2Array1[2].y = Mathf.Lerp(single, single1, vector2Array1[2].y); float single12 = this.mFillAmount * 2f - (float)i; bool flag = i % 2 == 1; if (this.AdjustRadial(vector21, vector2Array1, single12, !flag)) { if (this.mInvert) { flag = !flag; } if (!flag) { int num = m.Alloc(PrimitiveKind.Quad); for (int j = 3; j > -1; j--) { m.v[num].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector21[j].x); m.v[num].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector21[j].y); m.v[num].z = 0f; m.v[num].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array1[j].x); m.v[num].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array1[j].y); m.v[num].r = color.r; m.v[num].g = color.g; m.v[num].b = color.b; m.v[num].a = color.a; num++; } } else { int num1 = m.Alloc(PrimitiveKind.Quad); for (int k = 0; k < 4; k++) { m.v[num1].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector21[k].x); m.v[num1].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector21[k].y); m.v[num1].z = 0f; m.v[num1].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array1[k].x); m.v[num1].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array1[k].y); m.v[num1].r = color.r; m.v[num1].g = color.g; m.v[num1].b = color.b; m.v[num1].a = color.a; num1++; } } } } return; } if (this.fillDirection == UIFilledSprite.FillDirection.Radial360) { float[] singleArray = new float[] { 0.5f, 1f, 0f, 0.5f, 0.5f, 1f, 0.5f, 1f, 0f, 0.5f, 0.5f, 1f, 0f, 0.5f, 0f, 0.5f }; Vector2[] vector22 = new Vector2[4]; Vector2[] vector2Array2 = new Vector2[4]; for (int l = 0; l < 4; l++) { vector22[0] = new Vector2(0f, 0f); vector22[1] = new Vector2(0f, 1f); vector22[2] = new Vector2(1f, 1f); vector22[3] = new Vector2(1f, 0f); vector2Array2[0] = new Vector2(0f, 0f); vector2Array2[1] = new Vector2(0f, 1f); vector2Array2[2] = new Vector2(1f, 1f); vector2Array2[3] = new Vector2(1f, 0f); if (this.mInvert) { if (l > 0) { this.Rotate(vector22, l); this.Rotate(vector2Array2, l); } } else if (l < 3) { this.Rotate(vector22, 3 - l); this.Rotate(vector2Array2, 3 - l); } for (int m1 = 0; m1 < 4; m1++) { int num2 = (!this.mInvert ? l * 4 : (3 - l) * 4); float single13 = singleArray[num2]; float single14 = singleArray[num2 + 1]; float single15 = singleArray[num2 + 2]; float single16 = singleArray[num2 + 3]; vector22[m1].x = Mathf.Lerp(single13, single14, vector22[m1].x); vector22[m1].y = Mathf.Lerp(single15, single16, vector22[m1].y); vector2Array2[m1].x = Mathf.Lerp(single13, single14, vector2Array2[m1].x); vector2Array2[m1].y = Mathf.Lerp(single15, single16, vector2Array2[m1].y); } float single17 = this.mFillAmount * 4f - (float)l; bool flag1 = l % 2 == 1; if (this.AdjustRadial(vector22, vector2Array2, single17, !flag1)) { if (this.mInvert) { flag1 = !flag1; } if (!flag1) { int num3 = m.Alloc(PrimitiveKind.Quad); for (int n = 3; n > -1; n--) { m.v[num3].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector22[n].x); m.v[num3].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector22[n].y); m.v[num3].z = 0f; m.v[num3].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array2[n].x); m.v[num3].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array2[n].y); m.v[num3].r = color.r; m.v[num3].g = color.g; m.v[num3].b = color.b; m.v[num3].a = color.a; num3++; } } else { int num4 = m.Alloc(PrimitiveKind.Quad); for (int o = 0; o < 4; o++) { m.v[num4].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector22[o].x); m.v[num4].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector22[o].y); m.v[num4].z = 0f; m.v[num4].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array2[o].x); m.v[num4].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array2[o].y); m.v[num4].r = color.r; m.v[num4].g = color.g; m.v[num4].b = color.b; m.v[num4].a = color.a; num4++; } } } } return; } } else if (!this.AdjustRadial(vector2, vector2Array, this.mFillAmount, this.mInvert)) { return; } vertex.x = vector2[0].x; vertex.y = vector2[0].y; vertex.u = vector2Array[0].x; vertex.v = vector2Array[0].y; vertex1.x = vector2[1].x; vertex1.y = vector2[1].y; vertex1.u = vector2Array[1].x; vertex1.v = vector2Array[1].y; vertex2.x = vector2[2].x; vertex2.y = vector2[2].y; vertex2.u = vector2Array[2].x; vertex2.v = vector2Array[2].y; vertex3.x = vector2[3].x; vertex3.y = vector2[3].y; vertex3.u = vector2Array[3].x; vertex3.v = vector2Array[3].y; float single18 = 0f; float single19 = single18; vertex3.z = single18; float single20 = single19; single19 = single20; vertex2.z = single20; float single21 = single19; single19 = single21; vertex1.z = single21; vertex.z = single19; float single22 = color.r; single19 = single22; vertex3.r = single22; float single23 = single19; single19 = single23; vertex2.r = single23; float single24 = single19; single19 = single24; vertex1.r = single24; vertex.r = single19; float single25 = color.g; single19 = single25; vertex3.g = single25; float single26 = single19; single19 = single26; vertex2.g = single26; float single27 = single19; single19 = single27; vertex1.g = single27; vertex.g = single19; float single28 = color.b; single19 = single28; vertex3.b = single28; float single29 = single19; single19 = single29; vertex2.b = single29; float single30 = single19; single19 = single30; vertex1.b = single30; vertex.b = single19; float single31 = color.a; single19 = single31; vertex3.a = single31; float single32 = single19; single19 = single32; vertex2.a = single32; float single33 = single19; single19 = single33; vertex1.a = single33; vertex.a = single19; m.Quad(vertex, vertex1, vertex2, vertex3); }
public void Set(MeshBuffer m) { if (this.mFilter == null) { this.mFilter = base.gameObject.GetComponent<MeshFilter>(); } if (this.mFilter == null) { this.mFilter = base.gameObject.AddComponent<MeshFilter>(); } if (this.mRen == null) { this.mRen = base.gameObject.GetComponent<MeshRenderer>(); } if (this.mRen == null) { this.mRen = base.gameObject.AddComponent<MeshRenderer>(); this.UpdateMaterials(); } if (m.vSize >= 65000) { if (this.mFilter.mesh != null) { this.mFilter.mesh.Clear(); } Debug.LogError(string.Concat("Too many vertices on one panel: ", m.vSize)); } else { bool flag = m.ExtractMeshBuffers(ref this.mVerts, ref this.mUVs, ref this.mColors, ref this.mIndices); Mesh mesh = this.GetMesh(ref flag, m.vSize); mesh.vertices = this.mVerts; mesh.uv = this.mUVs; mesh.colors = this.mColors; mesh.triangles = this.mIndices; mesh.RecalculateBounds(); this.mFilter.mesh = mesh; } }
private static void FillColumn1(ref NineRectangle nqV, ref NineRectangle nqT, int columnStart, ref Color color, MeshBuffer m) { if (nqV.xx.y == nqV.yy.y) { if (nqV.yy.y == nqV.zz.y) { if (nqV.zz.y != nqV.ww.y) { switch (columnStart) { case 0: { m.FastCell(nqV.xz, nqV.yw, nqT.xz, nqT.yw, ref color); break; } case 1: { m.FastCell(nqV.yz, nqV.zw, nqT.yz, nqT.zw, ref color); break; } case 2: { m.FastCell(nqV.zz, nqV.ww, nqT.zz, nqT.ww, ref color); break; } } } } else if (nqV.zz.y != nqV.ww.y) { int num = m.Alloc(PrimitiveKind.Grid1x2, 0f, color); switch (columnStart) { case 0: { m.v[num].x = nqV.xx.x; m.v[num].y = nqV.yy.y; m.v[num].u = nqT.xx.x; m.v[num].v = nqT.yy.y; m.v[num + 1].x = nqV.yy.x; m.v[num + 1].y = nqV.yy.y; m.v[num + 1].u = nqT.yy.x; m.v[num + 1].v = nqT.yy.y; m.v[num + 2].x = nqV.xx.x; m.v[num + 2].y = nqV.zz.y; m.v[num + 2].u = nqT.xx.x; m.v[num + 2].v = nqT.zz.y; m.v[num + 3].x = nqV.yy.x; m.v[num + 3].y = nqV.zz.y; m.v[num + 3].u = nqT.yy.x; m.v[num + 3].v = nqT.zz.y; m.v[num + 4].x = nqV.xx.x; m.v[num + 4].y = nqV.ww.y; m.v[num + 4].u = nqT.xx.x; m.v[num + 4].v = nqT.ww.y; m.v[num + 5].x = nqV.yy.x; m.v[num + 5].y = nqV.ww.y; m.v[num + 5].u = nqT.yy.x; m.v[num + 5].v = nqT.ww.y; break; } case 1: { m.v[num].x = nqV.yy.x; m.v[num].y = nqV.yy.y; m.v[num].u = nqT.yy.x; m.v[num].v = nqT.yy.y; m.v[num + 1].x = nqV.zz.x; m.v[num + 1].y = nqV.yy.y; m.v[num + 1].u = nqT.zz.x; m.v[num + 1].v = nqT.yy.y; m.v[num + 2].x = nqV.yy.x; m.v[num + 2].y = nqV.zz.y; m.v[num + 2].u = nqT.yy.x; m.v[num + 2].v = nqT.zz.y; m.v[num + 3].x = nqV.zz.x; m.v[num + 3].y = nqV.zz.y; m.v[num + 3].u = nqT.zz.x; m.v[num + 3].v = nqT.zz.y; m.v[num + 4].x = nqV.yy.x; m.v[num + 4].y = nqV.ww.y; m.v[num + 4].u = nqT.yy.x; m.v[num + 4].v = nqT.ww.y; m.v[num + 5].x = nqV.zz.x; m.v[num + 5].y = nqV.ww.y; m.v[num + 5].u = nqT.zz.x; m.v[num + 5].v = nqT.ww.y; break; } case 2: { m.v[num].x = nqV.zz.x; m.v[num].y = nqV.yy.y; m.v[num].u = nqT.zz.x; m.v[num].v = nqT.yy.y; m.v[num + 1].x = nqV.ww.x; m.v[num + 1].y = nqV.yy.y; m.v[num + 1].u = nqT.ww.x; m.v[num + 1].v = nqT.yy.y; m.v[num + 2].x = nqV.zz.x; m.v[num + 2].y = nqV.zz.y; m.v[num + 2].u = nqT.zz.x; m.v[num + 2].v = nqT.zz.y; m.v[num + 3].x = nqV.ww.x; m.v[num + 3].y = nqV.zz.y; m.v[num + 3].u = nqT.ww.x; m.v[num + 3].v = nqT.zz.y; m.v[num + 4].x = nqV.zz.x; m.v[num + 4].y = nqV.ww.y; m.v[num + 4].u = nqT.zz.x; m.v[num + 4].v = nqT.ww.y; m.v[num + 5].x = nqV.ww.x; m.v[num + 5].y = nqV.ww.y; m.v[num + 5].u = nqT.ww.x; m.v[num + 5].v = nqT.ww.y; break; } } } else { switch (columnStart) { case 0: { m.FastCell(nqV.xy, nqV.yz, nqT.xy, nqT.yz, ref color); break; } case 1: { m.FastCell(nqV.yy, nqV.zz, nqT.yy, nqT.zz, ref color); break; } case 2: { m.FastCell(nqV.zy, nqV.wz, nqT.zy, nqT.wz, ref color); break; } } } } else if (nqV.yy.y == nqV.zz.y) { if (nqV.zz.y != nqV.ww.y) { switch (columnStart) { case 0: { m.FastCell(nqV.xx, nqV.yy, nqT.xx, nqT.yy, ref color); m.FastCell(nqV.xz, nqV.yw, nqT.xz, nqT.yw, ref color); break; } case 1: { m.FastCell(nqV.yx, nqV.zy, nqT.yx, nqT.zy, ref color); m.FastCell(nqV.yz, nqV.zw, nqT.yz, nqT.zw, ref color); break; } case 2: { m.FastCell(nqV.zx, nqV.wy, nqT.zx, nqT.wy, ref color); m.FastCell(nqV.zz, nqV.ww, nqT.zz, nqT.ww, ref color); break; } } } else { switch (columnStart) { case 0: { m.FastCell(nqV.xx, nqV.yy, nqT.xx, nqT.yy, ref color); break; } case 1: { m.FastCell(nqV.yx, nqV.zy, nqT.yx, nqT.zy, ref color); break; } case 2: { m.FastCell(nqV.zx, nqV.wy, nqT.zx, nqT.wy, ref color); break; } } } } else if (nqV.zz.y != nqV.ww.y) { int num1 = m.Alloc(PrimitiveKind.Grid1x2, 0f, color); switch (columnStart) { case 0: { m.v[num1].x = nqV.xx.x; m.v[num1].y = nqV.xx.y; m.v[num1].u = nqT.xx.x; m.v[num1].v = nqT.xx.y; m.v[num1 + 1].x = nqV.yy.x; m.v[num1 + 1].y = nqV.xx.y; m.v[num1 + 1].u = nqT.yy.x; m.v[num1 + 1].v = nqT.xx.y; m.v[num1 + 2].x = nqV.xx.x; m.v[num1 + 2].y = nqV.yy.y; m.v[num1 + 2].u = nqT.xx.x; m.v[num1 + 2].v = nqT.yy.y; m.v[num1 + 3].x = nqV.yy.x; m.v[num1 + 3].y = nqV.yy.y; m.v[num1 + 3].u = nqT.yy.x; m.v[num1 + 3].v = nqT.yy.y; m.v[num1 + 4].x = nqV.xx.x; m.v[num1 + 4].y = nqV.zz.y; m.v[num1 + 4].u = nqT.xx.x; m.v[num1 + 4].v = nqT.zz.y; m.v[num1 + 5].x = nqV.yy.x; m.v[num1 + 5].y = nqV.zz.y; m.v[num1 + 5].u = nqT.yy.x; m.v[num1 + 5].v = nqT.zz.y; m.v[num1 + 6].x = nqV.xx.x; m.v[num1 + 6].y = nqV.ww.y; m.v[num1 + 6].u = nqT.xx.x; m.v[num1 + 6].v = nqT.ww.y; m.v[num1 + 7].x = nqV.yy.x; m.v[num1 + 7].y = nqV.ww.y; m.v[num1 + 7].u = nqT.yy.x; m.v[num1 + 7].v = nqT.ww.y; break; } case 1: { m.v[num1].x = nqV.yy.x; m.v[num1].y = nqV.xx.y; m.v[num1].u = nqT.yy.x; m.v[num1].v = nqT.xx.y; m.v[num1 + 1].x = nqV.zz.x; m.v[num1 + 1].y = nqV.xx.y; m.v[num1 + 1].u = nqT.zz.x; m.v[num1 + 1].v = nqT.xx.y; m.v[num1 + 2].x = nqV.yy.x; m.v[num1 + 2].y = nqV.yy.y; m.v[num1 + 2].u = nqT.yy.x; m.v[num1 + 2].v = nqT.yy.y; m.v[num1 + 3].x = nqV.zz.x; m.v[num1 + 3].y = nqV.yy.y; m.v[num1 + 3].u = nqT.zz.x; m.v[num1 + 3].v = nqT.yy.y; m.v[num1 + 4].x = nqV.yy.x; m.v[num1 + 4].y = nqV.zz.y; m.v[num1 + 4].u = nqT.yy.x; m.v[num1 + 4].v = nqT.zz.y; m.v[num1 + 5].x = nqV.zz.x; m.v[num1 + 5].y = nqV.zz.y; m.v[num1 + 5].u = nqT.zz.x; m.v[num1 + 5].v = nqT.zz.y; m.v[num1 + 6].x = nqV.yy.x; m.v[num1 + 6].y = nqV.ww.y; m.v[num1 + 6].u = nqT.yy.x; m.v[num1 + 6].v = nqT.ww.y; m.v[num1 + 7].x = nqV.zz.x; m.v[num1 + 7].y = nqV.ww.y; m.v[num1 + 7].u = nqT.zz.x; m.v[num1 + 7].v = nqT.ww.y; break; } case 2: { m.v[num1].x = nqV.zz.x; m.v[num1].y = nqV.xx.y; m.v[num1].u = nqT.zz.x; m.v[num1].v = nqT.xx.y; m.v[num1 + 1].x = nqV.ww.x; m.v[num1 + 1].y = nqV.xx.y; m.v[num1 + 1].u = nqT.ww.x; m.v[num1 + 1].v = nqT.xx.y; m.v[num1 + 2].x = nqV.zz.x; m.v[num1 + 2].y = nqV.yy.y; m.v[num1 + 2].u = nqT.zz.x; m.v[num1 + 2].v = nqT.yy.y; m.v[num1 + 3].x = nqV.ww.x; m.v[num1 + 3].y = nqV.yy.y; m.v[num1 + 3].u = nqT.ww.x; m.v[num1 + 3].v = nqT.yy.y; m.v[num1 + 4].x = nqV.zz.x; m.v[num1 + 4].y = nqV.zz.y; m.v[num1 + 4].u = nqT.zz.x; m.v[num1 + 4].v = nqT.zz.y; m.v[num1 + 5].x = nqV.ww.x; m.v[num1 + 5].y = nqV.zz.y; m.v[num1 + 5].u = nqT.ww.x; m.v[num1 + 5].v = nqT.zz.y; m.v[num1 + 6].x = nqV.zz.x; m.v[num1 + 6].y = nqV.ww.y; m.v[num1 + 6].u = nqT.zz.x; m.v[num1 + 6].v = nqT.ww.y; m.v[num1 + 7].x = nqV.ww.x; m.v[num1 + 7].y = nqV.ww.y; m.v[num1 + 7].u = nqT.ww.x; m.v[num1 + 7].v = nqT.ww.y; break; } } } else { int num2 = m.Alloc(PrimitiveKind.Grid1x2, 0f, color); switch (columnStart) { case 0: { m.v[num2].x = nqV.xx.x; m.v[num2].y = nqV.xx.y; m.v[num2].u = nqT.xx.x; m.v[num2].v = nqT.xx.y; m.v[num2 + 1].x = nqV.yy.x; m.v[num2 + 1].y = nqV.xx.y; m.v[num2 + 1].u = nqT.yy.x; m.v[num2 + 1].v = nqT.xx.y; m.v[num2 + 2].x = nqV.xx.x; m.v[num2 + 2].y = nqV.yy.y; m.v[num2 + 2].u = nqT.xx.x; m.v[num2 + 2].v = nqT.yy.y; m.v[num2 + 3].x = nqV.yy.x; m.v[num2 + 3].y = nqV.yy.y; m.v[num2 + 3].u = nqT.yy.x; m.v[num2 + 3].v = nqT.yy.y; m.v[num2 + 4].x = nqV.xx.x; m.v[num2 + 4].y = nqV.zz.y; m.v[num2 + 4].u = nqT.xx.x; m.v[num2 + 4].v = nqT.zz.y; m.v[num2 + 5].x = nqV.yy.x; m.v[num2 + 5].y = nqV.zz.y; m.v[num2 + 5].u = nqT.yy.x; m.v[num2 + 5].v = nqT.zz.y; break; } case 1: { m.v[num2].x = nqV.yy.x; m.v[num2].y = nqV.xx.y; m.v[num2].u = nqT.yy.x; m.v[num2].v = nqT.xx.y; m.v[num2 + 1].x = nqV.zz.x; m.v[num2 + 1].y = nqV.xx.y; m.v[num2 + 1].u = nqT.zz.x; m.v[num2 + 1].v = nqT.xx.y; m.v[num2 + 2].x = nqV.yy.x; m.v[num2 + 2].y = nqV.yy.y; m.v[num2 + 2].u = nqT.yy.x; m.v[num2 + 2].v = nqT.yy.y; m.v[num2 + 3].x = nqV.zz.x; m.v[num2 + 3].y = nqV.yy.y; m.v[num2 + 3].u = nqT.zz.x; m.v[num2 + 3].v = nqT.yy.y; m.v[num2 + 4].x = nqV.yy.x; m.v[num2 + 4].y = nqV.zz.y; m.v[num2 + 4].u = nqT.yy.x; m.v[num2 + 4].v = nqT.zz.y; m.v[num2 + 5].x = nqV.zz.x; m.v[num2 + 5].y = nqV.zz.y; m.v[num2 + 5].u = nqT.zz.x; m.v[num2 + 5].v = nqT.zz.y; break; } case 2: { m.v[num2].x = nqV.zz.x; m.v[num2].y = nqV.xx.y; m.v[num2].u = nqT.zz.x; m.v[num2].v = nqT.xx.y; m.v[num2 + 1].x = nqV.ww.x; m.v[num2 + 1].y = nqV.xx.y; m.v[num2 + 1].u = nqT.ww.x; m.v[num2 + 1].v = nqT.xx.y; m.v[num2 + 2].x = nqV.zz.x; m.v[num2 + 2].y = nqV.yy.y; m.v[num2 + 2].u = nqT.zz.x; m.v[num2 + 2].v = nqT.yy.y; m.v[num2 + 3].x = nqV.ww.x; m.v[num2 + 3].y = nqV.yy.y; m.v[num2 + 3].u = nqT.ww.x; m.v[num2 + 3].v = nqT.yy.y; m.v[num2 + 4].x = nqV.zz.x; m.v[num2 + 4].y = nqV.zz.y; m.v[num2 + 4].u = nqT.zz.x; m.v[num2 + 4].v = nqT.zz.y; m.v[num2 + 5].x = nqV.ww.x; m.v[num2 + 5].y = nqV.zz.y; m.v[num2 + 5].u = nqT.ww.x; m.v[num2 + 5].v = nqT.zz.y; break; } } } }
private static void Commit3x3(int start, ref NineRectangle nqV, ref NineRectangle nqT, ref Color color, MeshBuffer m) { m.v[start].x = nqV.xx.x; m.v[start].y = nqV.xx.y; m.v[start].u = nqT.xx.x; m.v[start].v = nqT.xx.y; Vector2 vector2 = nqV.yx; m.v[start + 1].x = vector2.x; Vector2 vector21 = nqV.yx; m.v[start + 1].y = vector21.y; Vector2 vector22 = nqT.yx; m.v[start + 1].u = vector22.x; Vector2 vector23 = nqT.yx; m.v[start + 1].v = vector23.y; Vector2 vector24 = nqV.zx; m.v[start + 2].x = vector24.x; Vector2 vector25 = nqV.zx; m.v[start + 2].y = vector25.y; Vector2 vector26 = nqT.zx; m.v[start + 2].u = vector26.x; Vector2 vector27 = nqT.zx; m.v[start + 2].v = vector27.y; Vector2 vector28 = nqV.wx; m.v[start + 3].x = vector28.x; Vector2 vector29 = nqV.wx; m.v[start + 3].y = vector29.y; Vector2 vector210 = nqT.wx; m.v[start + 3].u = vector210.x; Vector2 vector211 = nqT.wx; m.v[start + 3].v = vector211.y; Vector2 vector212 = nqV.xy; m.v[start + 4].x = vector212.x; Vector2 vector213 = nqV.xy; m.v[start + 4].y = vector213.y; Vector2 vector214 = nqT.xy; m.v[start + 4].u = vector214.x; Vector2 vector215 = nqT.xy; m.v[start + 4].v = vector215.y; m.v[start + 1 + 4].x = nqV.yy.x; m.v[start + 1 + 4].y = nqV.yy.y; m.v[start + 1 + 4].u = nqT.yy.x; m.v[start + 1 + 4].v = nqT.yy.y; Vector2 vector216 = nqV.zy; m.v[start + 2 + 4].x = vector216.x; Vector2 vector217 = nqV.zy; m.v[start + 2 + 4].y = vector217.y; Vector2 vector218 = nqT.zy; m.v[start + 2 + 4].u = vector218.x; Vector2 vector219 = nqT.zy; m.v[start + 2 + 4].v = vector219.y; Vector2 vector220 = nqV.wy; m.v[start + 3 + 4].x = vector220.x; Vector2 vector221 = nqV.wy; m.v[start + 3 + 4].y = vector221.y; Vector2 vector222 = nqT.wy; m.v[start + 3 + 4].u = vector222.x; Vector2 vector223 = nqT.wy; m.v[start + 3 + 4].v = vector223.y; Vector2 vector224 = nqV.xz; m.v[start + 8].x = vector224.x; Vector2 vector225 = nqV.xz; m.v[start + 8].y = vector225.y; Vector2 vector226 = nqT.xz; m.v[start + 8].u = vector226.x; Vector2 vector227 = nqT.xz; m.v[start + 8].v = vector227.y; Vector2 vector228 = nqV.yz; m.v[start + 1 + 8].x = vector228.x; Vector2 vector229 = nqV.yz; m.v[start + 1 + 8].y = vector229.y; Vector2 vector230 = nqT.yz; m.v[start + 1 + 8].u = vector230.x; Vector2 vector231 = nqT.yz; m.v[start + 1 + 8].v = vector231.y; m.v[start + 2 + 8].x = nqV.zz.x; m.v[start + 2 + 8].y = nqV.zz.y; m.v[start + 2 + 8].u = nqT.zz.x; m.v[start + 2 + 8].v = nqT.zz.y; Vector2 vector232 = nqV.wz; m.v[start + 3 + 8].x = vector232.x; Vector2 vector233 = nqV.wz; m.v[start + 3 + 8].y = vector233.y; Vector2 vector234 = nqT.wz; m.v[start + 3 + 8].u = vector234.x; Vector2 vector235 = nqT.wz; m.v[start + 3 + 8].v = vector235.y; Vector2 vector236 = nqV.xw; m.v[start + 12].x = vector236.x; Vector2 vector237 = nqV.xw; m.v[start + 12].y = vector237.y; Vector2 vector238 = nqT.xw; m.v[start + 12].u = vector238.x; Vector2 vector239 = nqT.xw; m.v[start + 12].v = vector239.y; Vector2 vector240 = nqV.yw; m.v[start + 1 + 12].x = vector240.x; Vector2 vector241 = nqV.yw; m.v[start + 1 + 12].y = vector241.y; Vector2 vector242 = nqT.yw; m.v[start + 1 + 12].u = vector242.x; Vector2 vector243 = nqT.yw; m.v[start + 1 + 12].v = vector243.y; Vector2 vector244 = nqV.zw; m.v[start + 2 + 12].x = vector244.x; Vector2 vector245 = nqV.zw; m.v[start + 2 + 12].y = vector245.y; Vector2 vector246 = nqT.zw; m.v[start + 2 + 12].u = vector246.x; Vector2 vector247 = nqT.zw; m.v[start + 2 + 12].v = vector247.y; m.v[start + 3 + 12].x = nqV.ww.x; m.v[start + 3 + 12].y = nqV.ww.y; m.v[start + 3 + 12].u = nqT.ww.x; m.v[start + 3 + 12].v = nqT.ww.y; for (int i = 0; i < 16; i++) { m.v[start + i].z = 0f; m.v[start + i].r = color.r; m.v[start + i].g = color.g; m.v[start + i].b = color.b; m.v[start + i].a = color.a; } }
public GizmoComponent(Form1 Parent) { tRenderer = new AdvTextRenderer(new Font("Arial", 23), Parent.Device, Color.White); Parent.BackBufferControl.MouseMove += new System.Windows.Forms.MouseEventHandler(BackBufferControl_MouseMove); P = Parent; API_Device D = Parent.Device; E = new EffectWrapper("gizmo.fx", D); float f = scale; float q = scale * s; Vector4[] V = new Vector4[] { new Vector4(0, 0, 0, 1), new Vector4(f, 0, 0, 1), // 1 new Vector4(0, f, 0, 1), new Vector4(0, 0, f, 1), new Vector4(q, 0, 0, 1), // 4 new Vector4(0, q, 0, 1), new Vector4(0, 0, q, 1), new Vector4(q, q, 0, 1), // 7 new Vector4(0, q, q, 1), new Vector4(q, 0, q, 1), }; int[] I = new int[] { 0, 1, 0, 2, 0, 3, 4, 7, 5, 7, 5, 8, 6, 8, 6, 9, 4, 9, }; int[] I2 = new int[] { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, }; colorVertex[] Dy = new colorVertex[I.Length]; for (int i = 0; i < Dy.Length; i++) Dy[i] = new colorVertex(I[i], I2[i]); meshBuffer = new MeshBuffer(Dy, Dy[0], D, PrimitiveTopology.LineList); E.Variables["PointA"].SetVariable(V); ColorA = new Vector4[10]; Vector4 x = new Vector4(1, 0, 0, 1); Vector4 y = new Vector4(0, 0, 1, 1); Vector4 z = new Vector4(0, 1, 0, 1); ColorA[0] = x; ColorA[1] = y; ColorA[2] = z; ColorA[3] = x; ColorA[4] = y; ColorA[5] = y; ColorA[6] = z; ColorA[7] = z; ColorA[8] = x; }
public void WriteToBuffers(MeshBuffer m) { this.mGeom.WriteToBuffers(m); }
public override void OnFill(MeshBuffer m) { Vertex vertex = new Vertex(); Vertex vertex1 = new Vertex(); Vertex vertex2 = new Vertex(); Vertex vertex3 = new Vertex(); Texture texture = base.material.mainTexture; if (texture == null) { return; } Rect pixels = this.mInner; if (base.atlas.coordinates == UIAtlas.Coordinates.TexCoords) { pixels = NGUIMath.ConvertToPixels(pixels, texture.width, texture.height, true); } Vector2 vector2 = base.cachedTransform.localScale; float single = base.atlas.pixelSize; float single1 = Mathf.Abs(pixels.width / vector2.x) * single; float single2 = Mathf.Abs(pixels.height / vector2.y) * single; if (single1 < 0.01f || single2 < 0.01f) { Debug.LogWarning(string.Concat("The tiled sprite (", NGUITools.GetHierarchy(base.gameObject), ") is too small.\nConsider using a bigger one.")); single1 = 0.01f; single2 = 0.01f; } Vector2 vector21 = new Vector2(pixels.xMin / (float)texture.width, pixels.yMin / (float)texture.height); Vector2 vector22 = new Vector2(pixels.xMax / (float)texture.width, pixels.yMax / (float)texture.height); Vector2 vector23 = vector22; float single3 = 0f; Color color = base.color; float single4 = color.r; float single5 = single4; vertex3.r = single4; float single6 = single5; single5 = single6; vertex2.r = single6; float single7 = single5; single5 = single7; vertex1.r = single7; vertex.r = single5; float single8 = color.g; single5 = single8; vertex3.g = single8; float single9 = single5; single5 = single9; vertex2.g = single9; float single10 = single5; single5 = single10; vertex1.g = single10; vertex.g = single5; float single11 = color.b; single5 = single11; vertex3.b = single11; float single12 = single5; single5 = single12; vertex2.b = single12; float single13 = single5; single5 = single13; vertex1.b = single13; vertex.b = single5; float single14 = color.a; single5 = single14; vertex3.a = single14; float single15 = single5; single5 = single15; vertex2.a = single15; float single16 = single5; single5 = single16; vertex1.a = single16; vertex.a = single5; float single17 = 0f; single5 = single17; vertex3.z = single17; float single18 = single5; single5 = single18; vertex2.z = single18; float single19 = single5; single5 = single19; vertex1.z = single19; vertex.z = single5; while (single3 < 1f) { float single20 = 0f; vector23.x = vector22.x; float single21 = single3 + single2; if (single21 > 1f) { vector23.y = vector21.y + (vector22.y - vector21.y) * (1f - single3) / (single21 - single3); single21 = 1f; } while (single20 < 1f) { float single22 = single20 + single1; if (single22 > 1f) { vector23.x = vector21.x + (vector22.x - vector21.x) * (1f - single20) / (single22 - single20); single22 = 1f; } vertex.x = single22; vertex.y = -single3; vertex1.x = single22; vertex1.y = -single21; vertex2.x = single20; vertex2.y = -single21; vertex3.x = single20; vertex3.y = -single3; vertex.u = vector23.x; vertex.v = 1f - vector21.y; vertex1.u = vector23.x; vertex1.v = 1f - vector23.y; vertex2.u = vector21.x; vertex2.v = 1f - vector23.y; vertex3.u = vector21.x; vertex3.v = 1f - vector21.y; m.Quad(vertex, vertex1, vertex2, vertex3); single20 = single20 + single1; } single3 = single3 + single2; } }
void buildShadowVolume(List<Vector3Df> shadowVertices, MeshBuffer meshbuffer, Matrix matrix, Vector3Df light) { ushort[] indices = meshbuffer.Indices as ushort[]; if (indices == null) throw new ArgumentException(); Triangle3Df t123 = new Triangle3Df(); for (int i = 0; i < indices.Length; i += 3) { Vector3Df v1 = meshbuffer.GetPosition(indices[i]); Vector3Df v2 = meshbuffer.GetPosition(indices[i + 1]); Vector3Df v3 = meshbuffer.GetPosition(indices[i + 2]); matrix.TransformVector(ref v1); matrix.TransformVector(ref v2); matrix.TransformVector(ref v3); t123.Set(v1, v2, v3); Vector3Df v1Dir = v1 - light; if (!t123.IsFrontFacing(v1Dir)) continue; Vector3Df v2Dir = v2 - light; Vector3Df v3Dir = v3 - light; // calc near points Vector3Df v1near = v1 + v1Dir * shadowNearMultiplier; Vector3Df v2near = v2 + v2Dir * shadowNearMultiplier; Vector3Df v3near = v3 + v3Dir * shadowNearMultiplier; // calc infinity points Vector3Df v1inf = v1 + v1Dir.Normalize() * shadowInfinityRange; Vector3Df v2inf = v2 + v2Dir.Normalize() * shadowInfinityRange; Vector3Df v3inf = v3 + v3Dir.Normalize() * shadowInfinityRange; // top shadowVertices.Add(v1near); shadowVertices.Add(v2near); shadowVertices.Add(v3near); // bottom shadowVertices.Add(v3inf); shadowVertices.Add(v2inf); shadowVertices.Add(v1inf); // side1 shadowVertices.Add(v1inf); shadowVertices.Add(v2near); shadowVertices.Add(v1near); shadowVertices.Add(v1inf); shadowVertices.Add(v2inf); shadowVertices.Add(v2near); // side2 shadowVertices.Add(v2inf); shadowVertices.Add(v3near); shadowVertices.Add(v2near); shadowVertices.Add(v2inf); shadowVertices.Add(v3inf); shadowVertices.Add(v3near); // side3 shadowVertices.Add(v1near); shadowVertices.Add(v3near); shadowVertices.Add(v1inf); shadowVertices.Add(v3near); shadowVertices.Add(v3inf); shadowVertices.Add(v1inf); } }
public NodeDisplayerPostProc(Form1 P) { LineDrawer = new EffectWrapper("Line.fx", P.Device); this.P = P; short[] indices = new short[] { 0, 1, 0, 2, 0, 3, 1, 4, 1, 6, 2, 4, 2, 5, 3, 5, 3, 6, 4, 7, 5, 7, 6, 7 }; BoundingBox boundingBox = new BoundingBox(new Vector3(-1.0f), new Vector3(+1.0f)); StaticVertex[] vertices = new StaticVertex[8]; vertices[0].Position = new Vector4(boundingBox.Minimum.X, boundingBox.Minimum.Y, boundingBox.Minimum.Z, 1f); vertices[1].Position = new Vector4(boundingBox.Minimum.X, boundingBox.Minimum.Y, boundingBox.Maximum.Z, 1f); vertices[2].Position = new Vector4(boundingBox.Minimum.X, boundingBox.Maximum.Y, boundingBox.Minimum.Z, 1f); vertices[3].Position = new Vector4(boundingBox.Maximum.X, boundingBox.Minimum.Y, boundingBox.Minimum.Z, 1f); vertices[4].Position = new Vector4(boundingBox.Minimum.X, boundingBox.Maximum.Y, boundingBox.Maximum.Z, 1f); vertices[5].Position = new Vector4(boundingBox.Maximum.X, boundingBox.Maximum.Y, boundingBox.Minimum.Z, 1f); vertices[6].Position = new Vector4(boundingBox.Maximum.X, boundingBox.Minimum.Y, boundingBox.Maximum.Z, 1f); vertices[7].Position = new Vector4(boundingBox.Maximum.X, boundingBox.Maximum.Y, boundingBox.Maximum.Z, 1f); mBuffer = new MeshBuffer(vertices, indices, SlimDX.DXGI.Format.R16_UInt, vertices[0], P.Device, SlimDX.Direct3D11.PrimitiveTopology.LineList, SlimDX.Direct3D11.CpuAccessFlags.Write); }
public override void OnFill(MeshBuffer m) { NineRectangle nineRectangle; NineRectangle nineRectangle1 = new NineRectangle(); NineRectangle nineRectangle2; NineRectangle nineRectangle3 = new NineRectangle(); Vector4 vector4 = new Vector4(); Vector4 vector41 = new Vector4(); float single = this._degreesOfRotation * 0.0174532924f; float single1 = this._sliceDegrees * 0.0174532924f; float single2 = this._sliceFill; int num = this.slices + 1; float single3 = (single - single1 * (float)this.slices) * single2; float single4 = single3 / (float)num; float single5 = single3 / 6.28318548f; float single6 = (single - single3) / (float)num; float3 _float3 = new float3() { xyz = base.cachedTransform.localScale }; float single7 = (_float3.x >= _float3.y ? _float3.x : _float3.y); _float3.xy.x = 3.14159274f * single7 / (float)num * single5; _float3.xy.y = single7 * (this.outerRadius * 0.5f); vector4.x = this.mOuterUV.xMin; vector4.y = this.mInnerUV.xMin; vector4.z = this.mInnerUV.xMax; vector4.w = this.mOuterUV.xMax; vector41.x = this.mOuterUV.yMin; vector41.y = this.mInnerUV.yMin; vector41.z = this.mInnerUV.yMax; vector41.w = this.mOuterUV.yMax; NineRectangle.Calculate(UIWidget.Pivot.Center, base.atlas.pixelSize, base.mainTexture, ref vector4, ref vector41, ref _float3.xy, out nineRectangle, out nineRectangle2); if (this.innerRadius <= 0f || Mathf.Approximately(nineRectangle.zz.x - nineRectangle.yy.x, 0f)) { nineRectangle1.xx.x = nineRectangle.xx.x; nineRectangle1.xx.y = nineRectangle.xx.y; nineRectangle1.yy.x = nineRectangle.yy.x; nineRectangle1.yy.y = nineRectangle.yy.y; nineRectangle1.zz.x = nineRectangle.zz.x; nineRectangle1.zz.y = nineRectangle.zz.y; nineRectangle1.ww.x = nineRectangle.ww.x; nineRectangle1.ww.y = nineRectangle.ww.y; nineRectangle3.xx.x = nineRectangle2.xx.x; nineRectangle3.xx.y = nineRectangle2.xx.y; nineRectangle3.yy.x = nineRectangle2.yy.x; nineRectangle3.yy.y = nineRectangle2.yy.y; nineRectangle3.zz.x = nineRectangle2.zz.x; nineRectangle3.zz.y = nineRectangle2.zz.y; nineRectangle3.ww.x = nineRectangle2.ww.x; nineRectangle3.ww.y = nineRectangle2.ww.y; } else { _float3.xy.x = 3.14159274f * single7 * this.innerRadius / (float)num * single5; NineRectangle.Calculate(UIWidget.Pivot.Center, base.atlas.pixelSize, base.mainTexture, ref vector4, ref vector41, ref _float3.xy, out nineRectangle1, out nineRectangle3); float single8 = (nineRectangle.yy.x + nineRectangle.zz.x) * 0.5f; if (nineRectangle1.yy.x > single8) { float single9 = (nineRectangle1.yy.x - single8) / (nineRectangle.ww.x - single8); if (single9 < 1f) { float single10 = 1f - single9; nineRectangle1.xx.y = nineRectangle.xx.y * single9 + nineRectangle1.xx.y * single10; nineRectangle1.yy.x = nineRectangle.yy.x * single9 + 0.5f * single10; nineRectangle1.yy.y = nineRectangle.yy.y * single9 + nineRectangle1.yy.y * single10; nineRectangle1.zz.x = nineRectangle.zz.x * single9 + 0.5f * single10; nineRectangle1.zz.y = nineRectangle.zz.y * single9 + nineRectangle1.zz.y * single10; nineRectangle1.ww.y = nineRectangle.ww.y * single9 + nineRectangle1.ww.y * single10; nineRectangle1.ww.x = nineRectangle.ww.x; nineRectangle1.xx.x = nineRectangle.xx.x; } else { nineRectangle1.xx.x = nineRectangle.xx.x; nineRectangle1.xx.y = nineRectangle.xx.y; nineRectangle1.yy.x = nineRectangle.yy.x; nineRectangle1.yy.y = nineRectangle.yy.y; nineRectangle1.zz.x = nineRectangle.zz.x; nineRectangle1.zz.y = nineRectangle.zz.y; nineRectangle1.ww.x = nineRectangle.ww.x; nineRectangle1.ww.y = nineRectangle.ww.y; nineRectangle3.xx.x = nineRectangle2.xx.x; nineRectangle3.xx.y = nineRectangle2.xx.y; nineRectangle3.yy.x = nineRectangle2.yy.x; nineRectangle3.yy.y = nineRectangle2.yy.y; nineRectangle3.zz.x = nineRectangle2.zz.x; nineRectangle3.zz.y = nineRectangle2.zz.y; nineRectangle3.ww.x = nineRectangle2.ww.x; nineRectangle3.ww.y = nineRectangle2.ww.y; } } } float single11 = Mathf.Abs(nineRectangle.ww.x - nineRectangle.xx.x); float single12 = single4 / single11; if (single1 > 0f) { single11 = single11 + single1 / single12; single12 = single4 / single11; } float single13 = this.innerRadius * 0.5f; float single14 = this.outerRadius * 0.5f; float single15 = Mathf.Min(nineRectangle.xx.y, nineRectangle.ww.y); float single16 = Mathf.Max(nineRectangle.ww.y, nineRectangle.xx.y) - single15; Color color = base.color; int num1 = m.vSize; float single17 = single6 + single4; float single18 = single6 * -0.5f + (this._facialRotationOffset * 0.5f + 0.5f) * single4 + this._addDegrees * 0.0174532924f; while (true) { Vertex[] vertexArray = m.v; int num2 = m.vSize; for (int i = num1; i < num2; i++) { float single19 = single13 + (vertexArray[i].y - single15) / single16 * single14; float single20 = vertexArray[i].x * single12 + single18; vertexArray[i].x = 0.5f + Mathf.Sin(single20) * single19; vertexArray[i].y = -0.5f + Mathf.Cos(single20) * single19; } int num3 = num - 1; num = num3; if (num3 <= 0) { break; } single18 = single18 + single17; num1 = num2; } }
public override void OnFill(MeshBuffer m) { m.FastQuad(this.mOuterUV, base.color); }
public abstract void OnFill(MeshBuffer m);
public static void Fill9(ref NineRectangle nqV, ref NineRectangle nqT, ref Color color, MeshBuffer m) { if (nqV.xx.x == nqV.yy.x) { if (nqV.yy.x == nqV.zz.x) { if (nqV.zz.x != nqT.ww.x) { NineRectangle.FillColumn1(ref nqV, ref nqT, 2, ref color, m); } } else if (nqV.zz.x != nqT.ww.x) { NineRectangle.FillColumn2(ref nqV, ref nqT, 1, ref color, m); } else { NineRectangle.FillColumn1(ref nqV, ref nqT, 1, ref color, m); } } else if (nqV.yy.x == nqV.zz.x) { if (nqV.zz.x != nqV.ww.x) { NineRectangle.FillColumn2(ref nqV, ref nqT, 2, ref color, m); } else { NineRectangle.FillColumn1(ref nqV, ref nqT, 1, ref color, m); } } else if (nqV.zz.x != nqV.ww.x) { NineRectangle.FillColumn3(ref nqV, ref nqT, ref color, m); } else { NineRectangle.FillColumn2(ref nqV, ref nqT, 0, ref color, m); } }
public void SetMeshBuffer(BlockLayer layer, MeshBuffer buffer) { _meshBuffers[(int)layer] = buffer; }
private void BuildMesh(MeshBuffer buffer) { MeshFilter meshFilter = GetComponent<MeshFilter>(); Mesh mesh = meshFilter.mesh; if (mesh == null) { mesh = new Mesh(); mesh.MarkDynamic(); } else mesh.Clear(); //get the arrays we have just created and assign them to the new mesh mesh.vertices = buffer.GetVertices(); //mesh.tangents = buffer.GetTangents(); mesh.normals = buffer.GetNormals(); mesh.triangles = buffer.GetTriangles(); //mesh.colors32 = buffer.GetColors32(); mesh.uv = buffer.GetUVs(); //clear our mesh buffer buffer.Clear(); meshFilter.mesh = mesh; }
private static void FillColumn2(ref NineRectangle nqV, ref NineRectangle nqT, int columnStart, ref Color color, MeshBuffer m) { int num; int num1; int num2; int num3; int num4; int num5; int num6; if (nqV.xx.y == nqV.yy.y) { if (nqV.yy.y == nqV.zz.y) { if (nqV.zz.y != nqV.ww.y) { switch (columnStart) { case 0: { num = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num].x = nqV.xx.x; m.v[num].y = nqV.zz.y; m.v[num].u = nqT.xx.x; m.v[num].v = nqT.zz.y; m.v[num + 1].x = nqV.yy.x; m.v[num + 1].y = nqV.zz.y; m.v[num + 1].u = nqT.yy.x; m.v[num + 1].v = nqT.zz.y; m.v[num + 2].x = nqV.zz.x; m.v[num + 2].y = nqV.zz.y; m.v[num + 2].u = nqT.zz.x; m.v[num + 2].v = nqT.zz.y; m.v[num + 3].x = nqV.xx.x; m.v[num + 3].y = nqV.ww.y; m.v[num + 3].u = nqT.xx.x; m.v[num + 3].v = nqT.ww.y; m.v[num + 4].x = nqV.yy.x; m.v[num + 4].y = nqV.ww.y; m.v[num + 4].u = nqT.yy.x; m.v[num + 4].v = nqT.ww.y; m.v[num + 5].x = nqV.zz.x; m.v[num + 5].y = nqV.ww.y; m.v[num + 5].u = nqT.zz.x; m.v[num + 5].v = nqT.ww.y; break; } case 1: { num = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num].x = nqV.yy.x; m.v[num].y = nqV.zz.y; m.v[num].u = nqT.yy.x; m.v[num].v = nqT.zz.y; m.v[num + 1].x = nqV.zz.x; m.v[num + 1].y = nqV.zz.y; m.v[num + 1].u = nqT.zz.x; m.v[num + 1].v = nqT.zz.y; m.v[num + 2].x = nqV.ww.x; m.v[num + 2].y = nqV.zz.y; m.v[num + 2].u = nqT.ww.x; m.v[num + 2].v = nqT.zz.y; m.v[num + 3].x = nqV.yy.x; m.v[num + 3].y = nqV.ww.y; m.v[num + 3].u = nqT.yy.x; m.v[num + 3].v = nqT.ww.y; m.v[num + 4].x = nqV.zz.x; m.v[num + 4].y = nqV.ww.y; m.v[num + 4].u = nqT.zz.x; m.v[num + 4].v = nqT.ww.y; m.v[num + 5].x = nqV.ww.x; m.v[num + 5].y = nqV.ww.y; m.v[num + 5].u = nqT.ww.x; m.v[num + 5].v = nqT.ww.y; break; } case 2: { m.FastCell(nqV.xz, nqV.yw, nqT.xz, nqT.yw, ref color); m.FastCell(nqV.zz, nqV.ww, nqT.zz, nqT.ww, ref color); break; } } } } else if (nqV.zz.y != nqV.ww.y) { switch (columnStart) { case 0: { num2 = m.Alloc(PrimitiveKind.Grid2x2, 0f, color); m.v[num2].x = nqV.xx.x; m.v[num2].y = nqV.yy.y; m.v[num2].u = nqT.xx.x; m.v[num2].v = nqT.yy.y; m.v[num2 + 1].x = nqV.yy.x; m.v[num2 + 1].y = nqV.yy.y; m.v[num2 + 1].u = nqT.yy.x; m.v[num2 + 1].v = nqT.yy.y; m.v[num2 + 2].x = nqV.zz.x; m.v[num2 + 2].y = nqV.yy.y; m.v[num2 + 2].u = nqT.zz.x; m.v[num2 + 2].v = nqT.yy.y; m.v[num2 + 3].x = nqV.xx.x; m.v[num2 + 3].y = nqV.zz.y; m.v[num2 + 3].u = nqT.xx.x; m.v[num2 + 3].v = nqT.zz.y; m.v[num2 + 4].x = nqV.yy.x; m.v[num2 + 4].y = nqV.zz.y; m.v[num2 + 4].u = nqT.yy.x; m.v[num2 + 4].v = nqT.zz.y; m.v[num2 + 5].x = nqV.zz.x; m.v[num2 + 5].y = nqV.zz.y; m.v[num2 + 5].u = nqT.zz.x; m.v[num2 + 5].v = nqT.zz.y; m.v[num2 + 6].x = nqV.xx.x; m.v[num2 + 6].y = nqV.ww.y; m.v[num2 + 6].u = nqT.xx.x; m.v[num2 + 6].v = nqT.ww.y; m.v[num2 + 7].x = nqV.yy.x; m.v[num2 + 7].y = nqV.ww.y; m.v[num2 + 7].u = nqT.yy.x; m.v[num2 + 7].v = nqT.ww.y; m.v[num2 + 8].x = nqV.zz.x; m.v[num2 + 8].y = nqV.ww.y; m.v[num2 + 8].u = nqT.zz.x; m.v[num2 + 8].v = nqT.ww.y; break; } case 1: { num2 = m.Alloc(PrimitiveKind.Grid2x2, 0f, color); m.v[num2].x = nqV.yy.x; m.v[num2].y = nqV.yy.y; m.v[num2].u = nqT.yy.x; m.v[num2].v = nqT.yy.y; m.v[num2 + 1].x = nqV.zz.x; m.v[num2 + 1].y = nqV.yy.y; m.v[num2 + 1].u = nqT.zz.x; m.v[num2 + 1].v = nqT.yy.y; m.v[num2 + 2].x = nqV.ww.x; m.v[num2 + 2].y = nqV.yy.y; m.v[num2 + 2].u = nqT.ww.x; m.v[num2 + 2].v = nqT.yy.y; m.v[num2 + 3].x = nqV.yy.x; m.v[num2 + 3].y = nqV.zz.y; m.v[num2 + 3].u = nqT.yy.x; m.v[num2 + 3].v = nqT.zz.y; m.v[num2 + 4].x = nqV.zz.x; m.v[num2 + 4].y = nqV.zz.y; m.v[num2 + 4].u = nqT.zz.x; m.v[num2 + 4].v = nqT.zz.y; m.v[num2 + 5].x = nqV.ww.x; m.v[num2 + 5].y = nqV.zz.y; m.v[num2 + 5].u = nqT.ww.x; m.v[num2 + 5].v = nqT.zz.y; m.v[num2 + 6].x = nqV.yy.x; m.v[num2 + 6].y = nqV.ww.y; m.v[num2 + 6].u = nqT.yy.x; m.v[num2 + 6].v = nqT.ww.y; m.v[num2 + 7].x = nqV.zz.x; m.v[num2 + 7].y = nqV.ww.y; m.v[num2 + 7].u = nqT.zz.x; m.v[num2 + 7].v = nqT.ww.y; m.v[num2 + 8].x = nqV.ww.x; m.v[num2 + 8].y = nqV.ww.y; m.v[num2 + 8].u = nqT.ww.x; m.v[num2 + 8].v = nqT.ww.y; break; } case 2: { num2 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num2].x = nqV.xx.x; m.v[num2].y = nqV.yy.y; m.v[num2].u = nqT.xx.x; m.v[num2].v = nqT.yy.y; m.v[num2 + 1].x = nqV.yy.x; m.v[num2 + 1].y = nqV.yy.y; m.v[num2 + 1].u = nqT.yy.x; m.v[num2 + 1].v = nqT.yy.y; m.v[num2 + 2].x = nqV.xx.x; m.v[num2 + 2].y = nqV.zz.y; m.v[num2 + 2].u = nqT.xx.x; m.v[num2 + 2].v = nqT.zz.y; m.v[num2 + 3].x = nqV.yy.x; m.v[num2 + 3].y = nqV.zz.y; m.v[num2 + 3].u = nqT.yy.x; m.v[num2 + 3].v = nqT.zz.y; m.v[num2 + 4].x = nqV.yy.x; m.v[num2 + 4].y = nqV.ww.y; m.v[num2 + 4].u = nqT.yy.x; m.v[num2 + 4].v = nqT.ww.y; m.v[num2 + 5].x = nqV.zz.x; m.v[num2 + 5].y = nqV.ww.y; m.v[num2 + 5].u = nqT.zz.x; m.v[num2 + 5].v = nqT.ww.y; num2 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num2].x = nqV.zz.x; m.v[num2].y = nqV.yy.y; m.v[num2].u = nqT.zz.x; m.v[num2].v = nqT.yy.y; m.v[num2 + 1].x = nqV.ww.x; m.v[num2 + 1].y = nqV.yy.y; m.v[num2 + 1].u = nqT.ww.x; m.v[num2 + 1].v = nqT.yy.y; m.v[num2 + 2].x = nqV.zz.x; m.v[num2 + 2].y = nqV.zz.y; m.v[num2 + 2].u = nqT.zz.x; m.v[num2 + 2].v = nqT.zz.y; m.v[num2 + 3].x = nqV.ww.x; m.v[num2 + 3].y = nqV.zz.y; m.v[num2 + 3].u = nqT.ww.x; m.v[num2 + 3].v = nqT.zz.y; m.v[num2 + 4].x = nqV.zz.x; m.v[num2 + 4].y = nqV.ww.y; m.v[num2 + 4].u = nqT.zz.x; m.v[num2 + 4].v = nqT.ww.y; m.v[num2 + 5].x = nqV.ww.x; m.v[num2 + 5].y = nqV.ww.y; m.v[num2 + 5].u = nqT.ww.x; m.v[num2 + 5].v = nqT.ww.y; break; } } } else { switch (columnStart) { case 0: { num1 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num1].x = nqV.xx.x; m.v[num1].y = nqV.yy.y; m.v[num1].u = nqT.xx.x; m.v[num1].v = nqT.yy.y; m.v[num1 + 1].x = nqV.yy.x; m.v[num1 + 1].y = nqV.yy.y; m.v[num1 + 1].u = nqT.yy.x; m.v[num1 + 1].v = nqT.yy.y; m.v[num1 + 2].x = nqV.zz.x; m.v[num1 + 2].y = nqV.yy.y; m.v[num1 + 2].u = nqT.zz.x; m.v[num1 + 2].v = nqT.yy.y; m.v[num1 + 3].x = nqV.xx.x; m.v[num1 + 3].y = nqV.zz.y; m.v[num1 + 3].u = nqT.xx.x; m.v[num1 + 3].v = nqT.zz.y; m.v[num1 + 4].x = nqV.yy.x; m.v[num1 + 4].y = nqV.zz.y; m.v[num1 + 4].u = nqT.yy.x; m.v[num1 + 4].v = nqT.zz.y; m.v[num1 + 5].x = nqV.zz.x; m.v[num1 + 5].y = nqV.zz.y; m.v[num1 + 5].u = nqT.zz.x; m.v[num1 + 5].v = nqT.zz.y; break; } case 1: { num1 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num1].x = nqV.yy.x; m.v[num1].y = nqV.yy.y; m.v[num1].u = nqT.yy.x; m.v[num1].v = nqT.yy.y; m.v[num1 + 1].x = nqV.zz.x; m.v[num1 + 1].y = nqV.yy.y; m.v[num1 + 1].u = nqT.zz.x; m.v[num1 + 1].v = nqT.yy.y; m.v[num1 + 2].x = nqV.ww.x; m.v[num1 + 2].y = nqV.yy.y; m.v[num1 + 2].u = nqT.ww.x; m.v[num1 + 2].v = nqT.yy.y; m.v[num1 + 3].x = nqV.yy.x; m.v[num1 + 3].y = nqV.zz.y; m.v[num1 + 3].u = nqT.yy.x; m.v[num1 + 3].v = nqT.zz.y; m.v[num1 + 4].x = nqV.zz.x; m.v[num1 + 4].y = nqV.zz.y; m.v[num1 + 4].u = nqT.zz.x; m.v[num1 + 4].v = nqT.zz.y; m.v[num1 + 5].x = nqV.ww.x; m.v[num1 + 5].y = nqV.zz.y; m.v[num1 + 5].u = nqT.ww.x; m.v[num1 + 5].v = nqT.zz.y; break; } case 2: { m.FastCell(nqV.xy, nqV.yz, nqT.xy, nqT.yz, ref color); m.FastCell(nqV.zy, nqV.wz, nqT.zy, nqT.wz, ref color); break; } } } } else if (nqV.yy.y == nqV.zz.y) { if (nqV.zz.y != nqV.ww.y) { switch (columnStart) { case 0: { num4 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num4].x = nqV.xx.x; m.v[num4].y = nqV.xx.y; m.v[num4].u = nqT.xx.x; m.v[num4].v = nqT.xx.y; m.v[num4 + 1].x = nqV.yy.x; m.v[num4 + 1].y = nqV.xx.y; m.v[num4 + 1].u = nqT.yy.x; m.v[num4 + 1].v = nqT.xx.y; m.v[num4 + 2].x = nqV.zz.x; m.v[num4 + 2].y = nqV.xx.y; m.v[num4 + 2].u = nqT.zz.x; m.v[num4 + 2].v = nqT.xx.y; m.v[num4 + 3].x = nqV.xx.x; m.v[num4 + 3].y = nqV.yy.y; m.v[num4 + 3].u = nqT.xx.x; m.v[num4 + 3].v = nqT.yy.y; m.v[num4 + 4].x = nqV.yy.x; m.v[num4 + 4].y = nqV.yy.y; m.v[num4 + 4].u = nqT.yy.x; m.v[num4 + 4].v = nqT.yy.y; m.v[num4 + 5].x = nqV.zz.x; m.v[num4 + 5].y = nqV.yy.y; m.v[num4 + 5].u = nqT.zz.x; m.v[num4 + 5].v = nqT.yy.y; num4 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num4].x = nqV.xx.x; m.v[num4].y = nqV.zz.y; m.v[num4].u = nqT.xx.x; m.v[num4].v = nqT.zz.y; m.v[num4 + 1].x = nqV.yy.x; m.v[num4 + 1].y = nqV.zz.y; m.v[num4 + 1].u = nqT.yy.x; m.v[num4 + 1].v = nqT.zz.y; m.v[num4 + 2].x = nqV.zz.x; m.v[num4 + 2].y = nqV.zz.y; m.v[num4 + 2].u = nqT.zz.x; m.v[num4 + 2].v = nqT.zz.y; m.v[num4 + 3].x = nqV.xx.x; m.v[num4 + 3].y = nqV.ww.y; m.v[num4 + 3].u = nqT.xx.x; m.v[num4 + 3].v = nqT.ww.y; m.v[num4 + 4].x = nqV.yy.x; m.v[num4 + 4].y = nqV.ww.y; m.v[num4 + 4].u = nqT.yy.x; m.v[num4 + 4].v = nqT.ww.y; m.v[num4 + 5].x = nqV.zz.x; m.v[num4 + 5].y = nqV.ww.y; m.v[num4 + 5].u = nqT.zz.x; m.v[num4 + 5].v = nqT.ww.y; break; } case 1: { num4 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num4].x = nqV.yy.x; m.v[num4].y = nqV.xx.y; m.v[num4].u = nqT.yy.x; m.v[num4].v = nqT.xx.y; m.v[num4 + 1].x = nqV.zz.x; m.v[num4 + 1].y = nqV.xx.y; m.v[num4 + 1].u = nqT.zz.x; m.v[num4 + 1].v = nqT.xx.y; m.v[num4 + 2].x = nqV.ww.x; m.v[num4 + 2].y = nqV.xx.y; m.v[num4 + 2].u = nqT.ww.x; m.v[num4 + 2].v = nqT.xx.y; m.v[num4 + 3].x = nqV.yy.x; m.v[num4 + 3].y = nqV.yy.y; m.v[num4 + 3].u = nqT.yy.x; m.v[num4 + 3].v = nqT.yy.y; m.v[num4 + 4].x = nqV.zz.x; m.v[num4 + 4].y = nqV.yy.y; m.v[num4 + 4].u = nqT.zz.x; m.v[num4 + 4].v = nqT.yy.y; m.v[num4 + 5].x = nqV.ww.x; m.v[num4 + 5].y = nqV.yy.y; m.v[num4 + 5].u = nqT.ww.x; m.v[num4 + 5].v = nqT.yy.y; num4 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num4].x = nqV.yy.x; m.v[num4].y = nqV.zz.y; m.v[num4].u = nqT.yy.x; m.v[num4].v = nqT.zz.y; m.v[num4 + 1].x = nqV.zz.x; m.v[num4 + 1].y = nqV.zz.y; m.v[num4 + 1].u = nqT.zz.x; m.v[num4 + 1].v = nqT.zz.y; m.v[num4 + 2].x = nqV.ww.x; m.v[num4 + 2].y = nqV.zz.y; m.v[num4 + 2].u = nqT.ww.x; m.v[num4 + 2].v = nqT.zz.y; m.v[num4 + 3].x = nqV.yy.x; m.v[num4 + 3].y = nqV.ww.y; m.v[num4 + 3].u = nqT.yy.x; m.v[num4 + 3].v = nqT.ww.y; m.v[num4 + 4].x = nqV.zz.x; m.v[num4 + 4].y = nqV.ww.y; m.v[num4 + 4].u = nqT.zz.x; m.v[num4 + 4].v = nqT.ww.y; m.v[num4 + 5].x = nqV.ww.x; m.v[num4 + 5].y = nqV.ww.y; m.v[num4 + 5].u = nqT.ww.x; m.v[num4 + 5].v = nqT.ww.y; break; } case 2: { m.FastCell(nqV.xx, nqV.yy, nqT.xx, nqT.yy, ref color); m.FastCell(nqV.zx, nqV.wy, nqT.zx, nqT.wy, ref color); m.FastCell(nqV.xz, nqV.yw, nqT.xz, nqT.yw, ref color); m.FastCell(nqV.zz, nqV.ww, nqT.zz, nqT.ww, ref color); break; } } } else { switch (columnStart) { case 0: { num3 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num3].x = nqV.xx.x; m.v[num3].y = nqV.xx.y; m.v[num3].u = nqT.xx.x; m.v[num3].v = nqT.xx.y; m.v[num3 + 1].x = nqV.yy.x; m.v[num3 + 1].y = nqV.xx.y; m.v[num3 + 1].u = nqT.yy.x; m.v[num3 + 1].v = nqT.xx.y; m.v[num3 + 2].x = nqV.zz.x; m.v[num3 + 2].y = nqV.xx.y; m.v[num3 + 2].u = nqT.zz.x; m.v[num3 + 2].v = nqT.xx.y; m.v[num3 + 3].x = nqV.xx.x; m.v[num3 + 3].y = nqV.yy.y; m.v[num3 + 3].u = nqT.xx.x; m.v[num3 + 3].v = nqT.yy.y; m.v[num3 + 4].x = nqV.yy.x; m.v[num3 + 4].y = nqV.yy.y; m.v[num3 + 4].u = nqT.yy.x; m.v[num3 + 4].v = nqT.yy.y; m.v[num3 + 5].x = nqV.zz.x; m.v[num3 + 5].y = nqV.yy.y; m.v[num3 + 5].u = nqT.zz.x; m.v[num3 + 5].v = nqT.yy.y; break; } case 1: { num3 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num3].x = nqV.yy.x; m.v[num3].y = nqV.xx.y; m.v[num3].u = nqT.yy.x; m.v[num3].v = nqT.xx.y; m.v[num3 + 1].x = nqV.zz.x; m.v[num3 + 1].y = nqV.xx.y; m.v[num3 + 1].u = nqT.zz.x; m.v[num3 + 1].v = nqT.xx.y; m.v[num3 + 2].x = nqV.ww.x; m.v[num3 + 2].y = nqV.xx.y; m.v[num3 + 2].u = nqT.ww.x; m.v[num3 + 2].v = nqT.xx.y; m.v[num3 + 3].x = nqV.yy.x; m.v[num3 + 3].y = nqV.yy.y; m.v[num3 + 3].u = nqT.yy.x; m.v[num3 + 3].v = nqT.yy.y; m.v[num3 + 4].x = nqV.zz.x; m.v[num3 + 4].y = nqV.yy.y; m.v[num3 + 4].u = nqT.zz.x; m.v[num3 + 4].v = nqT.yy.y; m.v[num3 + 5].x = nqV.ww.x; m.v[num3 + 5].y = nqV.yy.y; m.v[num3 + 5].u = nqT.ww.x; m.v[num3 + 5].v = nqT.yy.y; break; } case 2: { m.FastCell(nqV.xx, nqV.yy, nqT.xx, nqT.yy, ref color); m.FastCell(nqV.zx, nqV.wy, nqT.zx, nqT.wy, ref color); break; } } } } else if (nqV.zz.y != nqV.ww.y) { switch (columnStart) { case 0: { num6 = m.Alloc(PrimitiveKind.Grid2x3, 0f, color); m.v[num6].x = nqV.xx.x; m.v[num6].y = nqV.xx.y; m.v[num6].u = nqT.xx.x; m.v[num6].v = nqT.xx.y; m.v[num6 + 1].x = nqV.yy.x; m.v[num6 + 1].y = nqV.xx.y; m.v[num6 + 1].u = nqT.yy.x; m.v[num6 + 1].v = nqT.xx.y; m.v[num6 + 2].x = nqV.zz.x; m.v[num6 + 2].y = nqV.xx.y; m.v[num6 + 2].u = nqT.zz.x; m.v[num6 + 2].v = nqT.xx.y; m.v[num6 + 3].x = nqV.xx.x; m.v[num6 + 3].y = nqV.yy.y; m.v[num6 + 3].u = nqT.xx.x; m.v[num6 + 3].v = nqT.yy.y; m.v[num6 + 4].x = nqV.yy.x; m.v[num6 + 4].y = nqV.yy.y; m.v[num6 + 4].u = nqT.yy.x; m.v[num6 + 4].v = nqT.yy.y; m.v[num6 + 5].x = nqV.zz.x; m.v[num6 + 5].y = nqV.yy.y; m.v[num6 + 5].u = nqT.zz.x; m.v[num6 + 5].v = nqT.yy.y; m.v[num6 + 6].x = nqV.xx.x; m.v[num6 + 6].y = nqV.zz.y; m.v[num6 + 6].u = nqT.xx.x; m.v[num6 + 6].v = nqT.zz.y; m.v[num6 + 7].x = nqV.yy.x; m.v[num6 + 7].y = nqV.zz.y; m.v[num6 + 7].u = nqT.yy.x; m.v[num6 + 7].v = nqT.zz.y; m.v[num6 + 8].x = nqV.zz.x; m.v[num6 + 8].y = nqV.zz.y; m.v[num6 + 8].u = nqT.zz.x; m.v[num6 + 8].v = nqT.zz.y; m.v[num6 + 9].x = nqV.xx.x; m.v[num6 + 9].y = nqV.ww.y; m.v[num6 + 9].u = nqT.xx.x; m.v[num6 + 9].v = nqT.ww.y; m.v[num6 + 10].x = nqV.yy.x; m.v[num6 + 10].y = nqV.ww.y; m.v[num6 + 10].u = nqT.yy.x; m.v[num6 + 10].v = nqT.ww.y; m.v[num6 + 11].x = nqV.zz.x; m.v[num6 + 11].y = nqV.ww.y; m.v[num6 + 11].u = nqT.zz.x; m.v[num6 + 11].v = nqT.ww.y; break; } case 1: { num6 = m.Alloc(PrimitiveKind.Grid2x3, 0f, color); m.v[num6].x = nqV.yy.x; m.v[num6].y = nqV.xx.y; m.v[num6].u = nqT.yy.x; m.v[num6].v = nqT.xx.y; m.v[num6 + 1].x = nqV.zz.x; m.v[num6 + 1].y = nqV.xx.y; m.v[num6 + 1].u = nqT.zz.x; m.v[num6 + 1].v = nqT.xx.y; m.v[num6 + 2].x = nqV.ww.x; m.v[num6 + 2].y = nqV.xx.y; m.v[num6 + 2].u = nqT.ww.x; m.v[num6 + 2].v = nqT.xx.y; m.v[num6 + 3].x = nqV.yy.x; m.v[num6 + 3].y = nqV.yy.y; m.v[num6 + 3].u = nqT.yy.x; m.v[num6 + 3].v = nqT.yy.y; m.v[num6 + 4].x = nqV.zz.x; m.v[num6 + 4].y = nqV.yy.y; m.v[num6 + 4].u = nqT.zz.x; m.v[num6 + 4].v = nqT.yy.y; m.v[num6 + 5].x = nqV.ww.x; m.v[num6 + 5].y = nqV.yy.y; m.v[num6 + 5].u = nqT.ww.x; m.v[num6 + 5].v = nqT.yy.y; m.v[num6 + 6].x = nqV.yy.x; m.v[num6 + 6].y = nqV.zz.y; m.v[num6 + 6].u = nqT.yy.x; m.v[num6 + 6].v = nqT.zz.y; m.v[num6 + 7].x = nqV.zz.x; m.v[num6 + 7].y = nqV.zz.y; m.v[num6 + 7].u = nqT.zz.x; m.v[num6 + 7].v = nqT.zz.y; m.v[num6 + 8].x = nqV.ww.x; m.v[num6 + 8].y = nqV.zz.y; m.v[num6 + 8].u = nqT.ww.x; m.v[num6 + 8].v = nqT.zz.y; m.v[num6 + 9].x = nqV.yy.x; m.v[num6 + 9].y = nqV.ww.y; m.v[num6 + 9].u = nqT.yy.x; m.v[num6 + 9].v = nqT.ww.y; m.v[num6 + 10].x = nqV.zz.x; m.v[num6 + 10].y = nqV.ww.y; m.v[num6 + 10].u = nqT.zz.x; m.v[num6 + 10].v = nqT.ww.y; m.v[num6 + 11].x = nqV.ww.x; m.v[num6 + 11].y = nqV.ww.y; m.v[num6 + 11].u = nqT.ww.x; m.v[num6 + 11].v = nqT.ww.y; break; } case 2: { num6 = m.Alloc(PrimitiveKind.Grid1x3, 0f, color); m.v[num6].x = nqV.xx.x; m.v[num6].y = nqV.xx.y; m.v[num6].u = nqT.xx.x; m.v[num6].v = nqT.xx.y; m.v[num6 + 1].x = nqV.yy.x; m.v[num6 + 1].y = nqV.xx.y; m.v[num6 + 1].u = nqT.yy.x; m.v[num6 + 1].v = nqT.xx.y; m.v[num6 + 2].x = nqV.xx.x; m.v[num6 + 2].y = nqV.yy.y; m.v[num6 + 2].u = nqT.xx.x; m.v[num6 + 2].v = nqT.yy.y; m.v[num6 + 3].x = nqV.yy.x; m.v[num6 + 3].y = nqV.yy.y; m.v[num6 + 3].u = nqT.yy.x; m.v[num6 + 3].v = nqT.yy.y; m.v[num6 + 4].x = nqV.xx.x; m.v[num6 + 4].y = nqV.zz.y; m.v[num6 + 4].u = nqT.xx.x; m.v[num6 + 4].v = nqT.zz.y; m.v[num6 + 5].x = nqV.yy.x; m.v[num6 + 5].y = nqV.zz.y; m.v[num6 + 5].u = nqT.yy.x; m.v[num6 + 5].v = nqT.zz.y; m.v[num6 + 6].x = nqV.xx.x; m.v[num6 + 6].y = nqV.ww.y; m.v[num6 + 6].u = nqT.xx.x; m.v[num6 + 6].v = nqT.ww.y; m.v[num6 + 7].x = nqV.yy.x; m.v[num6 + 7].y = nqV.ww.y; m.v[num6 + 7].u = nqT.yy.x; m.v[num6 + 7].v = nqT.ww.y; num6 = m.Alloc(PrimitiveKind.Grid1x3, 0f, color); m.v[num6].x = nqV.zz.x; m.v[num6].y = nqV.xx.y; m.v[num6].u = nqT.zz.x; m.v[num6].v = nqT.xx.y; m.v[num6 + 1].x = nqV.ww.x; m.v[num6 + 1].y = nqV.xx.y; m.v[num6 + 1].u = nqT.ww.x; m.v[num6 + 1].v = nqT.xx.y; m.v[num6 + 2].x = nqV.zz.x; m.v[num6 + 2].y = nqV.yy.y; m.v[num6 + 2].u = nqT.zz.x; m.v[num6 + 2].v = nqT.yy.y; m.v[num6 + 3].x = nqV.ww.x; m.v[num6 + 3].y = nqV.yy.y; m.v[num6 + 3].u = nqT.ww.x; m.v[num6 + 3].v = nqT.yy.y; m.v[num6 + 4].x = nqV.zz.x; m.v[num6 + 4].y = nqV.zz.y; m.v[num6 + 4].u = nqT.zz.x; m.v[num6 + 4].v = nqT.zz.y; m.v[num6 + 5].x = nqV.ww.x; m.v[num6 + 5].y = nqV.zz.y; m.v[num6 + 5].u = nqT.ww.x; m.v[num6 + 5].v = nqT.zz.y; m.v[num6 + 6].x = nqV.zz.x; m.v[num6 + 6].y = nqV.ww.y; m.v[num6 + 6].u = nqT.zz.x; m.v[num6 + 6].v = nqT.ww.y; m.v[num6 + 7].x = nqV.ww.x; m.v[num6 + 7].y = nqV.ww.y; m.v[num6 + 7].u = nqT.ww.x; m.v[num6 + 7].v = nqT.ww.y; break; } } } else { switch (columnStart) { case 0: { num5 = m.Alloc(PrimitiveKind.Grid2x2, 0f, color); m.v[num5].x = nqV.xx.x; m.v[num5].y = nqV.xx.y; m.v[num5].u = nqT.xx.x; m.v[num5].v = nqT.xx.y; m.v[num5 + 1].x = nqV.yy.x; m.v[num5 + 1].y = nqV.xx.y; m.v[num5 + 1].u = nqT.yy.x; m.v[num5 + 1].v = nqT.xx.y; m.v[num5 + 2].x = nqV.zz.x; m.v[num5 + 2].y = nqV.xx.y; m.v[num5 + 2].u = nqT.zz.x; m.v[num5 + 2].v = nqT.xx.y; m.v[num5 + 3].x = nqV.xx.x; m.v[num5 + 3].y = nqV.yy.y; m.v[num5 + 3].u = nqT.xx.x; m.v[num5 + 3].v = nqT.zz.y; m.v[num5 + 4].x = nqV.yy.x; m.v[num5 + 4].y = nqV.yy.y; m.v[num5 + 4].u = nqT.yy.x; m.v[num5 + 4].v = nqT.yy.y; m.v[num5 + 5].x = nqV.zz.x; m.v[num5 + 5].y = nqV.yy.y; m.v[num5 + 5].u = nqT.zz.x; m.v[num5 + 5].v = nqT.yy.y; m.v[num5 + 6].x = nqV.xx.x; m.v[num5 + 6].y = nqV.zz.y; m.v[num5 + 6].u = nqT.xx.x; m.v[num5 + 6].v = nqT.zz.y; m.v[num5 + 7].x = nqV.yy.x; m.v[num5 + 7].y = nqV.zz.y; m.v[num5 + 7].u = nqT.yy.x; m.v[num5 + 7].v = nqT.zz.y; m.v[num5 + 8].x = nqV.zz.x; m.v[num5 + 8].y = nqV.zz.y; m.v[num5 + 8].u = nqT.zz.x; m.v[num5 + 8].v = nqT.zz.y; break; } case 1: { num5 = m.Alloc(PrimitiveKind.Grid2x2, 0f, color); m.v[num5].x = nqV.yy.x; m.v[num5].y = nqV.xx.y; m.v[num5].u = nqT.yy.x; m.v[num5].v = nqT.xx.y; m.v[num5 + 1].x = nqV.zz.x; m.v[num5 + 1].y = nqV.xx.y; m.v[num5 + 1].u = nqT.zz.x; m.v[num5 + 1].v = nqT.xx.y; m.v[num5 + 2].x = nqV.ww.x; m.v[num5 + 2].y = nqV.xx.y; m.v[num5 + 2].u = nqT.ww.x; m.v[num5 + 2].v = nqT.xx.y; m.v[num5 + 3].x = nqV.yy.x; m.v[num5 + 3].y = nqV.yy.y; m.v[num5 + 3].u = nqT.yy.x; m.v[num5 + 3].v = nqT.yy.y; m.v[num5 + 4].x = nqV.zz.x; m.v[num5 + 4].y = nqV.yy.y; m.v[num5 + 4].u = nqT.zz.x; m.v[num5 + 4].v = nqT.yy.y; m.v[num5 + 5].x = nqV.ww.x; m.v[num5 + 5].y = nqV.yy.y; m.v[num5 + 5].u = nqT.ww.x; m.v[num5 + 5].v = nqT.yy.y; m.v[num5 + 6].x = nqV.yy.x; m.v[num5 + 6].y = nqV.zz.y; m.v[num5 + 6].u = nqT.yy.x; m.v[num5 + 6].v = nqT.zz.y; m.v[num5 + 7].x = nqV.zz.x; m.v[num5 + 7].y = nqV.zz.y; m.v[num5 + 7].u = nqT.zz.x; m.v[num5 + 7].v = nqT.zz.y; m.v[num5 + 8].x = nqV.ww.x; m.v[num5 + 8].y = nqV.zz.y; m.v[num5 + 8].u = nqT.ww.x; m.v[num5 + 8].v = nqT.zz.y; break; } case 2: { num5 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num5].x = nqV.xx.x; m.v[num5].y = nqV.xx.y; m.v[num5].u = nqT.xx.x; m.v[num5].v = nqT.xx.y; m.v[num5 + 1].x = nqV.yy.x; m.v[num5 + 1].y = nqV.xx.y; m.v[num5 + 1].u = nqT.yy.x; m.v[num5 + 1].v = nqT.xx.y; m.v[num5 + 2].x = nqV.xx.x; m.v[num5 + 2].y = nqV.yy.y; m.v[num5 + 2].u = nqT.xx.x; m.v[num5 + 2].v = nqT.yy.y; m.v[num5 + 3].x = nqV.yy.x; m.v[num5 + 3].y = nqV.yy.y; m.v[num5 + 3].u = nqT.yy.x; m.v[num5 + 3].v = nqT.yy.y; m.v[num5 + 4].x = nqV.yy.x; m.v[num5 + 4].y = nqV.zz.y; m.v[num5 + 4].u = nqT.yy.x; m.v[num5 + 4].v = nqT.zz.y; m.v[num5 + 5].x = nqV.zz.x; m.v[num5 + 5].y = nqV.zz.y; m.v[num5 + 5].u = nqT.zz.x; m.v[num5 + 5].v = nqT.zz.y; num5 = m.Alloc(PrimitiveKind.Grid2x1, 0f, color); m.v[num5].x = nqV.zz.x; m.v[num5].y = nqV.xx.y; m.v[num5].u = nqT.zz.x; m.v[num5].v = nqT.xx.y; m.v[num5 + 1].x = nqV.ww.x; m.v[num5 + 1].y = nqV.xx.y; m.v[num5 + 1].u = nqT.ww.x; m.v[num5 + 1].v = nqT.xx.y; m.v[num5 + 2].x = nqV.zz.x; m.v[num5 + 2].y = nqV.yy.y; m.v[num5 + 2].u = nqT.zz.x; m.v[num5 + 2].v = nqT.yy.y; m.v[num5 + 3].x = nqV.ww.x; m.v[num5 + 3].y = nqV.yy.y; m.v[num5 + 3].u = nqT.ww.x; m.v[num5 + 3].v = nqT.yy.y; m.v[num5 + 4].x = nqV.zz.x; m.v[num5 + 4].y = nqV.zz.y; m.v[num5 + 4].u = nqT.zz.x; m.v[num5 + 4].v = nqT.zz.y; m.v[num5 + 5].x = nqV.ww.x; m.v[num5 + 5].y = nqV.zz.y; m.v[num5 + 5].u = nqT.ww.x; m.v[num5 + 5].v = nqT.zz.y; break; } } } }
private static void FillColumn3(ref NineRectangle nqV, ref NineRectangle nqT, ref Color color, MeshBuffer m) { if (nqV.xx.y == nqV.yy.y) { if (nqV.yy.y == nqV.zz.y) { if (nqV.zz.y != nqV.ww.y) { int num = m.Alloc(PrimitiveKind.Grid3x1, 0f, color); m.v[num].x = nqV.xx.x; m.v[num].y = nqV.zz.y; m.v[num].u = nqT.xx.x; m.v[num].v = nqT.zz.y; m.v[num + 1].x = nqV.yy.x; m.v[num + 1].y = nqV.zz.y; m.v[num + 1].u = nqT.yy.x; m.v[num + 1].v = nqT.zz.y; m.v[num + 2].x = nqV.zz.x; m.v[num + 2].y = nqV.zz.y; m.v[num + 2].u = nqT.zz.x; m.v[num + 2].v = nqT.zz.y; m.v[num + 3].x = nqV.ww.x; m.v[num + 3].y = nqV.zz.y; m.v[num + 3].u = nqT.ww.x; m.v[num + 3].v = nqT.zz.y; m.v[num + 4].x = nqV.xx.x; m.v[num + 4].y = nqV.ww.y; m.v[num + 4].u = nqT.xx.x; m.v[num + 4].v = nqT.ww.y; m.v[num + 5].x = nqV.yy.x; m.v[num + 5].y = nqV.ww.y; m.v[num + 5].u = nqT.yy.x; m.v[num + 5].v = nqT.ww.y; m.v[num + 6].x = nqV.zz.x; m.v[num + 6].y = nqV.ww.y; m.v[num + 6].u = nqT.zz.x; m.v[num + 6].v = nqT.ww.y; m.v[num + 7].x = nqV.ww.x; m.v[num + 7].y = nqV.ww.y; m.v[num + 7].u = nqT.ww.x; m.v[num + 7].v = nqT.ww.y; } } else if (nqV.zz.y != nqV.ww.y) { int num1 = m.Alloc(PrimitiveKind.Grid3x2, 0f, color); m.v[num1].x = nqV.xx.x; m.v[num1].y = nqV.yy.y; m.v[num1].u = nqT.xx.x; m.v[num1].v = nqT.yy.y; m.v[num1 + 1].x = nqV.yy.x; m.v[num1 + 1].y = nqV.yy.y; m.v[num1 + 1].u = nqT.yy.x; m.v[num1 + 1].v = nqT.yy.y; m.v[num1 + 2].x = nqV.zz.x; m.v[num1 + 2].y = nqV.yy.y; m.v[num1 + 2].u = nqT.zz.x; m.v[num1 + 2].v = nqT.yy.y; m.v[num1 + 3].x = nqV.ww.x; m.v[num1 + 3].y = nqV.yy.y; m.v[num1 + 3].u = nqT.ww.x; m.v[num1 + 3].v = nqT.yy.y; m.v[num1 + 4].x = nqV.xx.x; m.v[num1 + 4].y = nqV.zz.y; m.v[num1 + 4].u = nqT.xx.x; m.v[num1 + 4].v = nqT.zz.y; m.v[num1 + 5].x = nqV.yy.x; m.v[num1 + 5].y = nqV.zz.y; m.v[num1 + 5].u = nqT.yy.x; m.v[num1 + 5].v = nqT.zz.y; m.v[num1 + 6].x = nqV.zz.x; m.v[num1 + 6].y = nqV.zz.y; m.v[num1 + 6].u = nqT.zz.x; m.v[num1 + 6].v = nqT.zz.y; m.v[num1 + 7].x = nqV.ww.x; m.v[num1 + 7].y = nqV.zz.y; m.v[num1 + 7].u = nqT.ww.x; m.v[num1 + 7].v = nqT.zz.y; m.v[num1 + 8].x = nqV.xx.x; m.v[num1 + 8].y = nqV.ww.y; m.v[num1 + 8].u = nqT.xx.x; m.v[num1 + 8].v = nqT.ww.y; m.v[num1 + 9].x = nqV.yy.x; m.v[num1 + 9].y = nqV.ww.y; m.v[num1 + 9].u = nqT.yy.x; m.v[num1 + 9].v = nqT.ww.y; m.v[num1 + 10].x = nqV.zz.x; m.v[num1 + 10].y = nqV.ww.y; m.v[num1 + 10].u = nqT.zz.x; m.v[num1 + 10].v = nqT.ww.y; m.v[num1 + 11].x = nqV.ww.x; m.v[num1 + 11].y = nqV.ww.y; m.v[num1 + 11].u = nqT.ww.x; m.v[num1 + 11].v = nqT.ww.y; } else { int num2 = m.Alloc(PrimitiveKind.Grid3x1, 0f, color); m.v[num2].x = nqV.xx.x; m.v[num2].y = nqV.yy.y; m.v[num2].u = nqT.xx.x; m.v[num2].v = nqT.yy.y; m.v[num2 + 1].x = nqV.yy.x; m.v[num2 + 1].y = nqV.yy.y; m.v[num2 + 1].u = nqT.yy.x; m.v[num2 + 1].v = nqT.yy.y; m.v[num2 + 2].x = nqV.zz.x; m.v[num2 + 2].y = nqV.yy.y; m.v[num2 + 2].u = nqT.zz.x; m.v[num2 + 2].v = nqT.yy.y; m.v[num2 + 3].x = nqV.ww.x; m.v[num2 + 3].y = nqV.yy.y; m.v[num2 + 3].u = nqT.ww.x; m.v[num2 + 3].v = nqT.yy.y; m.v[num2 + 4].x = nqV.xx.x; m.v[num2 + 4].y = nqV.zz.y; m.v[num2 + 4].u = nqT.xx.x; m.v[num2 + 4].v = nqT.zz.y; m.v[num2 + 5].x = nqV.yy.x; m.v[num2 + 5].y = nqV.zz.y; m.v[num2 + 5].u = nqT.yy.x; m.v[num2 + 5].v = nqT.zz.y; m.v[num2 + 6].x = nqV.zz.x; m.v[num2 + 6].y = nqV.zz.y; m.v[num2 + 6].u = nqT.zz.x; m.v[num2 + 6].v = nqT.zz.y; m.v[num2 + 7].x = nqV.ww.x; m.v[num2 + 7].y = nqV.zz.y; m.v[num2 + 7].u = nqT.ww.x; m.v[num2 + 7].v = nqT.zz.y; } } else if (nqV.yy.y == nqV.zz.y) { if (nqV.zz.y != nqV.ww.y) { int num3 = m.Alloc(PrimitiveKind.Grid3x1, 0f, color); m.v[num3].x = nqV.xx.x; m.v[num3].y = nqV.xx.y; m.v[num3].u = nqT.xx.x; m.v[num3].v = nqT.xx.y; m.v[num3 + 1].x = nqV.yy.x; m.v[num3 + 1].y = nqV.xx.y; m.v[num3 + 1].u = nqT.yy.x; m.v[num3 + 1].v = nqT.xx.y; m.v[num3 + 2].x = nqV.zz.x; m.v[num3 + 2].y = nqV.xx.y; m.v[num3 + 2].u = nqT.zz.x; m.v[num3 + 2].v = nqT.xx.y; m.v[num3 + 3].x = nqV.ww.x; m.v[num3 + 3].y = nqV.xx.y; m.v[num3 + 3].u = nqT.ww.x; m.v[num3 + 3].v = nqT.xx.y; m.v[num3 + 4].x = nqV.xx.x; m.v[num3 + 4].y = nqV.yy.y; m.v[num3 + 4].u = nqT.xx.x; m.v[num3 + 4].v = nqT.yy.y; m.v[num3 + 5].x = nqV.yy.x; m.v[num3 + 5].y = nqV.yy.y; m.v[num3 + 5].u = nqT.yy.x; m.v[num3 + 5].v = nqT.yy.y; m.v[num3 + 6].x = nqV.zz.x; m.v[num3 + 6].y = nqV.yy.y; m.v[num3 + 6].u = nqT.zz.x; m.v[num3 + 6].v = nqT.yy.y; m.v[num3 + 7].x = nqV.ww.x; m.v[num3 + 7].y = nqV.yy.y; m.v[num3 + 7].u = nqT.ww.x; m.v[num3 + 7].v = nqT.yy.y; num3 = m.Alloc(PrimitiveKind.Grid3x1, 0f, color); m.v[num3].x = nqV.xx.x; m.v[num3].y = nqV.zz.y; m.v[num3].u = nqT.xx.x; m.v[num3].v = nqT.zz.y; m.v[num3 + 1].x = nqV.yy.x; m.v[num3 + 1].y = nqV.zz.y; m.v[num3 + 1].u = nqT.yy.x; m.v[num3 + 1].v = nqT.zz.y; m.v[num3 + 2].x = nqV.zz.x; m.v[num3 + 2].y = nqV.zz.y; m.v[num3 + 2].u = nqT.zz.x; m.v[num3 + 2].v = nqT.zz.y; m.v[num3 + 3].x = nqV.ww.x; m.v[num3 + 3].y = nqV.zz.y; m.v[num3 + 3].u = nqT.ww.x; m.v[num3 + 3].v = nqT.zz.y; m.v[num3 + 4].x = nqV.xx.x; m.v[num3 + 4].y = nqV.ww.y; m.v[num3 + 4].u = nqT.xx.x; m.v[num3 + 4].v = nqT.ww.y; m.v[num3 + 5].x = nqV.yy.x; m.v[num3 + 5].y = nqV.ww.y; m.v[num3 + 5].u = nqT.yy.x; m.v[num3 + 5].v = nqT.ww.y; m.v[num3 + 6].x = nqV.zz.x; m.v[num3 + 6].y = nqV.ww.y; m.v[num3 + 6].u = nqT.zz.x; m.v[num3 + 6].v = nqT.ww.y; m.v[num3 + 7].x = nqV.ww.x; m.v[num3 + 7].y = nqV.ww.y; m.v[num3 + 7].u = nqT.ww.x; m.v[num3 + 7].v = nqT.ww.y; } else { int num4 = m.Alloc(PrimitiveKind.Grid3x1, 0f, color); m.v[num4].x = nqV.xx.x; m.v[num4].y = nqV.xx.y; m.v[num4].u = nqT.xx.x; m.v[num4].v = nqT.xx.y; m.v[num4 + 1].x = nqV.yy.x; m.v[num4 + 1].y = nqV.xx.y; m.v[num4 + 1].u = nqT.yy.x; m.v[num4 + 1].v = nqT.xx.y; m.v[num4 + 2].x = nqV.zz.x; m.v[num4 + 2].y = nqV.xx.y; m.v[num4 + 2].u = nqT.zz.x; m.v[num4 + 2].v = nqT.xx.y; m.v[num4 + 3].x = nqV.ww.x; m.v[num4 + 3].y = nqV.xx.y; m.v[num4 + 3].u = nqT.ww.x; m.v[num4 + 3].v = nqT.xx.y; m.v[num4 + 4].x = nqV.xx.x; m.v[num4 + 4].y = nqV.yy.y; m.v[num4 + 4].u = nqT.xx.x; m.v[num4 + 4].v = nqT.yy.y; m.v[num4 + 5].x = nqV.yy.x; m.v[num4 + 5].y = nqV.yy.y; m.v[num4 + 5].u = nqT.yy.x; m.v[num4 + 5].v = nqT.yy.y; m.v[num4 + 6].x = nqV.zz.x; m.v[num4 + 6].y = nqV.yy.y; m.v[num4 + 6].u = nqT.zz.x; m.v[num4 + 6].v = nqT.yy.y; m.v[num4 + 7].x = nqV.ww.x; m.v[num4 + 7].y = nqV.yy.y; m.v[num4 + 7].u = nqT.ww.x; m.v[num4 + 7].v = nqT.yy.y; } } else if (nqV.zz.y != nqV.ww.y) { NineRectangle.Commit3x3(m.Alloc(PrimitiveKind.Grid3x3), ref nqV, ref nqT, ref color, m); } else { int num5 = m.Alloc(PrimitiveKind.Grid3x2, 0f, color); m.v[num5].x = nqV.xx.x; m.v[num5].y = nqV.xx.y; m.v[num5].u = nqT.xx.x; m.v[num5].v = nqT.xx.y; m.v[num5 + 1].x = nqV.yy.x; m.v[num5 + 1].y = nqV.xx.y; m.v[num5 + 1].u = nqT.yy.x; m.v[num5 + 1].v = nqT.xx.y; m.v[num5 + 2].x = nqV.zz.x; m.v[num5 + 2].y = nqV.xx.y; m.v[num5 + 2].u = nqT.zz.x; m.v[num5 + 2].v = nqT.xx.y; m.v[num5 + 3].x = nqV.ww.x; m.v[num5 + 3].y = nqV.xx.y; m.v[num5 + 3].u = nqT.ww.x; m.v[num5 + 3].v = nqT.xx.y; m.v[num5 + 4].x = nqV.xx.x; m.v[num5 + 4].y = nqV.yy.y; m.v[num5 + 4].u = nqT.xx.x; m.v[num5 + 4].v = nqT.yy.y; m.v[num5 + 5].x = nqV.yy.x; m.v[num5 + 5].y = nqV.yy.y; m.v[num5 + 5].u = nqT.yy.x; m.v[num5 + 5].v = nqT.yy.y; m.v[num5 + 6].x = nqV.zz.x; m.v[num5 + 6].y = nqV.yy.y; m.v[num5 + 6].u = nqT.zz.x; m.v[num5 + 6].v = nqT.yy.y; m.v[num5 + 7].x = nqV.ww.x; m.v[num5 + 7].y = nqV.yy.y; m.v[num5 + 7].u = nqT.ww.x; m.v[num5 + 7].v = nqT.yy.y; m.v[num5 + 8].x = nqV.xx.x; m.v[num5 + 8].y = nqV.zz.y; m.v[num5 + 8].u = nqT.xx.x; m.v[num5 + 8].v = nqT.zz.y; m.v[num5 + 9].x = nqV.yy.x; m.v[num5 + 9].y = nqV.zz.y; m.v[num5 + 9].u = nqT.yy.x; m.v[num5 + 9].v = nqT.zz.y; m.v[num5 + 10].x = nqV.zz.x; m.v[num5 + 10].y = nqV.zz.y; m.v[num5 + 10].u = nqT.zz.x; m.v[num5 + 10].v = nqT.zz.y; m.v[num5 + 11].x = nqV.ww.x; m.v[num5 + 11].y = nqV.zz.y; m.v[num5 + 11].u = nqT.ww.x; m.v[num5 + 11].v = nqT.zz.y; } }
public void WriteToBuffers(MeshBuffer m) { this.meshBuffer.WriteBuffers(m); }
public static void Fill8(ref NineRectangle nqV, ref NineRectangle nqT, ref Color color, MeshBuffer m) { NineRectangle.Commit3x3(m.Alloc(PrimitiveKind.Hole3x3), ref nqV, ref nqT, ref color, m); }
public void Copy(ref int start, Vertex[] v, Vector3[] transformed, int end, MeshBuffer p) { int num; int num1 = (end - start) / Primitive.VertexCount(this.kind); Label0: int num2 = num1; num1 = num2 - 1; if (num2 <= 0) { return; } int num3 = p.Alloc(this.kind, out num); while (num3 < num) { p.v[num3].x = transformed[start].x; p.v[num3].y = transformed[start].y; p.v[num3].z = transformed[start].z; p.v[num3].u = v[start].u; p.v[num3].v = v[start].v; p.v[num3].r = v[start].r; p.v[num3].g = v[start].g; p.v[num3].b = v[start].b; p.v[num3].a = v[start].a; num3++; start = start + 1; } goto Label0; }
public override void OnFill(MeshBuffer m) { Vertex vertex = new Vertex(); Vertex vertex1 = new Vertex(); Vertex vertex2 = new Vertex(); Vertex vertex3 = new Vertex(); vertex.z = 0f; vertex1.z = 0f; vertex2.z = 0f; vertex3.z = 0f; Color color = base.color; float single = color.r; float single1 = single; vertex3.r = single; float single2 = single1; single1 = single2; vertex2.r = single2; float single3 = single1; single1 = single3; vertex1.r = single3; vertex.r = single1; float single4 = color.g; single1 = single4; vertex3.g = single4; float single5 = single1; single1 = single5; vertex2.g = single5; float single6 = single1; single1 = single6; vertex1.g = single6; vertex.g = single1; float single7 = color.b; single1 = single7; vertex3.b = single7; float single8 = single1; single1 = single8; vertex2.b = single8; float single9 = single1; single1 = single9; vertex1.b = single9; vertex.b = single1; float single10 = color.a; single1 = single10; vertex3.a = single10; float single11 = single1; single1 = single11; vertex2.a = single11; float single12 = single1; single1 = single12; vertex1.a = single12; vertex.a = single1; if (this._mirrorX) { if (!this._mirrorY) { vertex.x = 0.5f; vertex.y = 0f; vertex1.x = 0.5f; vertex1.y = -1f; vertex2.x = 0f; vertex2.y = -1f; vertex3.x = 0f; vertex3.y = 0f; vertex.u = 1f; vertex.v = 1f; vertex1.u = 1f; vertex1.v = 0f; vertex2.u = 0f; vertex2.v = 0f; vertex3.u = 0f; vertex3.v = 1f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); vertex.x = 1f; vertex.y = 0f; vertex1.x = 1f; vertex1.y = -1f; vertex2.x = 0.5f; vertex2.y = -1f; vertex3.x = 0.5f; vertex3.y = 0f; vertex.u = 0f; vertex.v = 1f; vertex1.u = 0f; vertex1.v = 0f; vertex2.u = 1f; vertex2.v = 0f; vertex3.u = 1f; vertex3.v = 1f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); } else { vertex.x = 0.5f; vertex.y = -0.5f; vertex1.x = 0.5f; vertex1.y = -1f; vertex2.x = 0f; vertex2.y = -1f; vertex3.x = 0f; vertex3.y = -0.5f; vertex.u = 1f; vertex.v = 1f; vertex1.u = 1f; vertex1.v = 0f; vertex2.u = 0f; vertex2.v = 0f; vertex3.u = 0f; vertex3.v = 1f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); vertex.x = 0.5f; vertex.y = 0f; vertex1.x = 0.5f; vertex1.y = -0.5f; vertex2.x = 0f; vertex2.y = -0.5f; vertex3.x = 0f; vertex3.y = 0f; vertex.u = 0f; vertex.v = 1f; vertex1.u = 0f; vertex1.v = 0f; vertex2.u = 1f; vertex2.v = 0f; vertex3.u = 1f; vertex3.v = 1f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); vertex.x = 1f; vertex.y = -0.5f; vertex1.x = 1f; vertex1.y = -1f; vertex2.x = 0.5f; vertex2.y = -1f; vertex3.x = 0.5f; vertex3.y = -0.5f; vertex.u = 1f; vertex.v = 1f; vertex1.u = 1f; vertex1.v = 0f; vertex2.u = 0f; vertex2.v = 0f; vertex3.u = 0f; vertex3.v = 1f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); vertex.x = 1f; vertex.y = 0f; vertex1.x = 1f; vertex1.y = -0.5f; vertex2.x = 0.5f; vertex2.y = -0.5f; vertex3.x = 0.5f; vertex3.y = 0f; vertex.u = 0f; vertex.v = 1f; vertex1.u = 0f; vertex1.v = 0f; vertex2.u = 1f; vertex2.v = 0f; vertex3.u = 1f; vertex3.v = 1f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); } } else if (!this._mirrorY) { vertex.x = 1f; vertex.y = 0f; vertex1.x = 1f; vertex1.y = -1f; vertex2.x = 0f; vertex2.y = -1f; vertex3.x = 0f; vertex3.y = 0f; vertex.u = 1f; vertex.v = 1f; vertex1.u = 1f; vertex1.v = 0f; vertex2.u = 0f; vertex2.v = 0f; vertex3.u = 0f; vertex3.v = 1f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); } else { vertex.x = 1f; vertex.y = -0.5f; vertex1.x = 1f; vertex1.y = -1f; vertex2.x = 0f; vertex2.y = -1f; vertex3.x = 0f; vertex3.y = -0.5f; vertex.u = 1f; vertex.v = 0f; vertex1.u = 1f; vertex1.v = 1f; vertex2.u = 0f; vertex2.v = 1f; vertex3.u = 0f; vertex3.v = 0f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); vertex.x = 1f; vertex.y = 0f; vertex1.x = 1f; vertex1.y = -0.5f; vertex2.x = 0f; vertex2.y = -0.5f; vertex3.x = 0f; vertex3.y = 0f; vertex.u = 1f; vertex.v = 1f; vertex1.u = 1f; vertex1.v = 0f; vertex2.u = 0f; vertex2.v = 0f; vertex3.u = 0f; vertex3.v = 1f; m.TextureQuad(vertex, vertex1, vertex2, vertex3); } }
public IconDrawer(Form1 F) { P = F; E = new EffectWrapper("IconDrawer.fx", F.Device); DynamicIndexVertex[] D = new DynamicIndexVertex[] { new DynamicIndexVertex(0), new DynamicIndexVertex(1), new DynamicIndexVertex(2), new DynamicIndexVertex(2), new DynamicIndexVertex(3), new DynamicIndexVertex(0)}; M = new MeshBuffer(D, D[0], Device, SlimDX.Direct3D11.PrimitiveTopology.TriangleList); }
public void Copy(ref int start, Vertex[] v, int end, MeshBuffer p) { int num; int num1 = (end - start) / Primitive.VertexCount(this.kind); Label0: int num2 = num1; num1 = num2 - 1; if (num2 <= 0) { return; } int num3 = p.Alloc(this.kind, out num); while (num3 < num) { int num4 = num3; num3 = num4 + 1; int num5 = start; int num6 = num5; start = num5 + 1; p.v[num4] = v[num6]; } goto Label0; }