public override bool Calculate() { if (m_Param == null) { m_Param = new MeshParam(); } MeshParam input = null; if (!GetInput(0, out input)) { return(false); } if (m_Param != null) { m_Param.m_Mesh = new Mesh(); var vertices = input.m_Mesh.vertices; var ns = input.m_Mesh.normals; Vector3 from = new Vector3(m_ScaleFromX, m_ScaleFromY, m_ScaleFromZ); for (var i = 0; i < vertices.Length; i++) { Vector3 delta = vertices[i] - from; delta *= m_Scale; vertices[i] = delta + from; // ns[i] = q * ns[i]; } m_Param.m_Mesh.vertices = vertices; //m_Param.m_Mesh.normals = ns; m_Param.m_Mesh.uv = input.m_Mesh.uv; m_Param.m_Mesh.triangles = input.m_Mesh.triangles; m_Param.m_Mesh.RecalculateNormals(); SnapShot(); //Build(); } // CreateCachedTextureIcon(); //m_Cached = m_Param.GetHWSourceTexture(); if (Outputs.Count > 0) { Outputs[0].SetValue <MeshParam>(m_Param); } // CheckDiskIcon(name, m_Param); return(true); }
public override bool Calculate() { if (m_Param == null) { m_Param = new MeshParam(); } MeshParam input = null; if (!GetInput(0, out input)) { return(false); } if (m_Param != null) { m_Param.m_Mesh = new Mesh(); var vertices = input.m_Mesh.vertices; var ns = input.m_Mesh.normals; for (var i = 0; i < vertices.Length; i++) { Quaternion q = Quaternion.Euler(0, vertices[i].y * m_ScaleTwist, 0); vertices[i] = q * vertices[i]; ns[i] = q * ns[i]; } m_Param.m_Mesh.vertices = vertices; m_Param.m_Mesh.normals = ns; m_Param.m_Mesh.uv = input.m_Mesh.uv; m_Param.m_Mesh.triangles = input.m_Mesh.triangles; SnapShot(); //Build(); } // CreateCachedTextureIcon(); //m_Cached = m_Param.GetHWSourceTexture(); if (Outputs.Count > 0) { Outputs[0].SetValue <MeshParam>(m_Param); } // CheckDiskIcon(name, m_Param); return(true); }
public override bool Calculate() { if (m_Param == null) { m_Param = new MeshParam(); } if (m_Param != null) { Build(); } // CreateCachedTextureIcon(); //m_Cached = m_Param.GetHWSourceTexture(); if (Outputs.Count > 0) { Outputs[0].SetValue <MeshParam>(m_Param); } // CheckDiskIcon(name, m_Param); return(true); }
public bool GetInput(int _input, out MeshParam _out) { _out = null; if (Inputs == null || _input >= Inputs.Count) { Debug.LogError("not enough inputs for " + this); return(false); } if (Inputs[_input].connection != null) { _out = Inputs[_input].connection.GetValue <MeshParam>(); } else { return(false); } //_out = TextureParam.GetWhite(); return(true); }