Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New extension classes to create a Model at the run-time #495

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rds1983
Copy link
Contributor

@rds1983 rds1983 commented Sep 17, 2024

This PR provides an extension classes to create Model at the run-time.
Usage is like this:

  // Create meshes
  var meshes = new List<ModelMeshDescEXT>();
  var mesh1 = new ModelMeshDescEXT();
  mesh1.Name = "mesh1";
  mesh1.AddModelMeshPart(indexBuffer1, 0, vertexBuffer1, 0, vertexBuffer1.VertexCount, primitivesCount1);
  meshes.Add(mesh1);

  var mesh2 = new ModelMeshDescEXT();
  mesh2.Name = "mesh2";
  mesh2.AddModelMeshPart(indexBuffer2, 0, vertexBuffer2, 0, vertexBuffer2.VertexCount, primitivesCount2);
  meshes.Add(mesh2);

  // Create bones
  var bones = new List<ModelBoneDescEXT>();
  var bone1 = new ModelBoneDescEXT();
  bone1.Name = "bone1";
  bones.Add(bone1);

  var bone2 = new ModelBoneDescEXT();
  bone2.Name = "bone2";
  bone2.Meshes.Add(mesh1);
  bone2.Meshes.Add(mesh2);
  bone1.Children.Add(bone2);
  bones.Add(bone2);

  var model = ModelBuilderEXT.Create(device, meshes, bones, bones[0]);
  ... 

Such API is enough to, say, load gltf at the run-time.

@rds1983 rds1983 changed the title New extension class to create a Model at the run-time New extension classes to create a Model at the run-time Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant