Skip to content

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

Open
rds1983 wants to merge 6 commits intoFNA-XNA:masterfrom
rds1983:model_builder
Open

New extension classes to create a Model at the run-time#495
rds1983 wants to merge 6 commits intoFNA-XNA:masterfrom
rds1983:model_builder

Conversation

@rds1983
Copy link
Copy Markdown
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
@flibitijibibo flibitijibibo force-pushed the master branch 2 times, most recently from a287f9a to e0fbaf7 Compare April 5, 2026 23:47
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