public EMesh(EMesh copy, Layer l, Editor e) : this(copy.tile, l, e) { for (int i = 0; i < vertices.Length; i++) { vertices[i].Position = copy.vertices[i].Position; } }
public void RemoveMesh(EMesh mesh) { if (mesh.Layer != this) { return; } mesh.Layer = null; }
public void AddMesh(EMesh mesh) { if (mesh.Layer == this) { return; } mesh.Layer = this; }
public EMesh(EMesh copy, Layer l, Editor e) : this(l, e) { for (int i = 0; i < vertices.Count; i++) { vertices[i].CopyFrom(copy.Vertices[i]); } Design = copy.Design; }
public EVertex(EMesh mesh, Vertex vertex, Editor editor) { this.editor = editor; this.mesh = mesh; this.vertex = vertex; Position = Vector2.Zero; UV = Vector2.Zero; UploadHSL(); rectModel = (Model2D)Model.CreateFromPrimitive(MeshPrimitive.Quad); }
public void MoveMesh(EMesh e, int n) { int index = meshList.IndexOf(e); if (index + n < 0 || index + n > meshList.Count - 1) { return; } EMesh temp = meshList[index + n]; meshList[index + n] = e; meshList[index] = temp; }
public void CreateMesh(System.Drawing.RectangleF rect, MeshDesign design) { if (activeLayers.Count == 0 || activeLayers.Count > 1) { return; } EMesh mesh = new EMesh(rect, design, activeLayers[0], this); activeLayers[0].AddMesh(mesh); SetSelected(new EMesh[] { mesh }); ActiveHistory.Add(new CreateAction(mesh, ActiveHistory)); }
public void PasteSelected() { List <EMesh> newMeshes = new List <EMesh>(); Layer l = ActiveLayers[0]; foreach (EMesh m in meshClipboard) { EMesh nm = new EMesh(m, l, this); l.AddMesh(nm); newMeshes.Add(nm); } SetSelected(newMeshes); ActiveHistory.Add(new CreateAction(newMeshes, ActiveHistory)); }
public void AddMesh(EMesh e) { if (meshList.Contains(e)) { return; } if (e.Layer != null) { e.Layer.RemoveMesh(e); } meshList.Add(e); e.SetLayer(this); }
public EVertex(Editor e, EMesh mesh, Vertex vertex, Vector2 position) { editor = e; this.mesh = mesh; this.vertex = vertex; this.position = position; Color = new Vector3(1f, 1f, 1f); vertexModel = new Model2D(new Vector2[] { new Vector2(-0.04f, -0.04f), new Vector2(0.04f, -0.04f), new Vector2(0.04f, 0.04f), new Vector2(-0.04f, 0.04f) }); }
void Begin() { editor = new Editor(this); Program.NewEditorInstance(editor); VSync = VSyncMode.Off; screenClearProgram = new ShaderProgram(screenClearVertex, screenClearFragment); screenClearMesh = new Mesh(screenClearProgram); screenClearMesh.GetAttribute <Vector2>("vertexPosition").Data = new Vector2[] { new Vector2(-1f, -1f), new Vector2(1f, -1f), new Vector2(1f, 1f), new Vector2(-1f, 1f) }; EMesh.CompileProgram(); }
public override void OnRender() { if (_material == null) { return; } EMesh mesh = actor.GetComponent <EMeshFilter>().GetMesh(); if (mesh != null) { _material.Use(); mesh.UseMesh(); Vector3 localp = actor.position; Quaternion localr = actor.rotate; Vector3 locals = actor.scale; Matrix4 model = Matrix4.CreateTranslation(localp) * Matrix4.CreateFromQuaternion(localr) * Matrix4.CreateScale(locals); Matrix4 view = ECamera.mainCamera.lookMatrix; Matrix4 projection = ECamera.mainCamera.projection; Matrix4 m1 = model * view * projection; GL.UniformMatrix4(20, false, ref m1); GL.UniformMatrix4(21, false, ref model); GL.UniformMatrix4(22, false, ref view); GL.UniformMatrix4(23, false, ref projection); GL.Uniform4(50, new Vector4((float)ETime.PassTime / (float)10, (float)ETime.PassTime / (float)5, (float)ETime.PassTime / (float)3, (float)ETime.PassTime / (float)1)); // Prefix GL.Uniform3(GL.GetUniformLocation(_material.shader.program, "cameraPos"), ECamera.mainCamera.actor.position); // Direction Light for (int i = 0; i < EDirectionLight.GetAllDirectionLight.Length; i++) { GL.Uniform3(GL.GetUniformLocation(_material.shader.program, $"dirLight[{i}].direction"), EDirectionLight.GetAllDirectionLight[i].actor.forward); GL.Uniform3(GL.GetUniformLocation(_material.shader.program, $"dirLight[{i}].ambient"), new Vector3(EDirectionLight.GetAllDirectionLight[i].color.R, EDirectionLight.GetAllDirectionLight[i].color.G, EDirectionLight.GetAllDirectionLight[i].color.B)); } // Point light for (int i = 0; i < EPointLight.GetAllPointLight.Length; i++) { GL.Uniform3(GL.GetUniformLocation(_material.shader.program, $"pointLight[{i}].position"), EPointLight.GetAllPointLight[i].actor.position); GL.Uniform3(GL.GetUniformLocation(_material.shader.program, $"pointLight[{i}].color"), new Vector3(EPointLight.GetAllPointLight[i].color.R, EPointLight.GetAllPointLight[i].color.G, EPointLight.GetAllPointLight[i].color.B)); GL.Uniform1(GL.GetUniformLocation(_material.shader.program, $"pointLight[{i}].intensity"), EPointLight.GetAllPointLight[i].intensity); GL.Uniform1(GL.GetUniformLocation(_material.shader.program, $"pointLight[{i}].minrange"), EPointLight.GetAllPointLight[i].minrange); GL.Uniform1(GL.GetUniformLocation(_material.shader.program, $"pointLight[{i}].maxrange"), EPointLight.GetAllPointLight[i].maxrange); } GL.DrawArrays(PrimitiveType.Triangles, 0, mesh.vertexStruct.Length); //GL.DrawElements(PrimitiveType.Triangles, mesh.vertexStruct.Length, DrawElementsType.UnsignedInt, 0); } base.OnRender(); }
public CreateAction(EMesh mesh, HistorySystem s) : this(new EMesh[] { mesh }, s) { }
public MeshNode(EMesh m, Editor e) : base() { editor = e; mesh = m; }
public bool Intersects(EMesh m) { BakePolygon(); return(m.Intersects(polygon)); }
public void RemoveMesh(EMesh e) { meshList.Remove(e); e.SetLayer(null); }
public void SetMesh(EMesh m) { _mesh = m; }