예제 #1
0
 public CPUSimulation(FiniteDeformationMesh mesh)
 {
     this.mesh             = mesh;
     constraints           = new Constraint[mesh.totalconstraints];
     previousnodepositions = new Vector3[mesh.nodes.Length];
     nodevelocities        = new List <float[]>();
 }
예제 #2
0
        public GPUSimulation(FiniteDeformationMesh mesh)
        {
            this.mesh = mesh;
            buffers   = new BuffersHelper();
            nodes     = new GPUBuffer <Node>(mesh.nodes);
            buffers.Add(nodes, "nodes");
            buffers.Add(new GPUBuffer <Edge>(mesh.edges), "edges");
            buffers.Add(new GPUBuffer <Constraint>(mesh.totalconstraints), "constraints");
            deformationshader = new ShaderWrapper("DeformationModel");

            deformationshader.Shader.SetInt("numnodes", mesh.nodes.Length);
            deformationshader.Shader.SetInt("numedges", mesh.edges.Length);

            buffers.SetBuffers(deformationshader.Shader, 0, 1, 2, 3);
        }