private void CreateTextureNode(string filename) { EZMFile ezmFile = EZMFile.Load(filename); ezmFile.LoadTextures(); var rootElement = this.scene.RootNode; for (int i = 0; i < ezmFile.MeshSystem.Meshes.Length; i++) { EZMMesh mesh = ezmFile.MeshSystem.Meshes[i]; EZMAnimation animation = ezmFile.MeshSystem.Animations.Length > 0 ? ezmFile.MeshSystem.Animations[0] : null; var container = new EZMVertexBufferContainer(mesh, animation); for (int j = 0; j < mesh.MeshSections.Length; j++) { var model = new EZMTextureModel(container, mesh.MeshSections[j]); var node = EZMTextureNode.Create(model); rootElement.Children.Add(node); } } }
public static EZMTextureNode Create(EZMTextureModel model) { int boneCount = model.BoneCount; string completeVertexCode = vertexCode.Replace("UNDEFINED_BONE_COUNT", string.Format("{0}", boneCount)); var vs = new VertexShader(completeVertexCode); var fs = new FragmentShader(fragmentCode); var array = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add("inPosition", EZMTextureModel.strPosition); //map.Add("inNormal", EZMTextureModel.strNormal); map.Add("inUV", EZMTextureModel.strUV); map.Add("inBlendWeights", EZMTextureModel.strBlendWeights); map.Add("inBlendIndices", EZMTextureModel.strBlendIndices); var builder = new RenderMethodBuilder(array, map);//, new PolygonModeSwitch(PolygonMode.Line)); var node = new EZMTextureNode(model, builder); node.Initialize(); return(node); }