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

Content Loading at runtime #176

Open
5 tasks
Doprez opened this issue Nov 12, 2024 · 0 comments
Open
5 tasks

Content Loading at runtime #176

Doprez opened this issue Nov 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Doprez
Copy link
Collaborator

Doprez commented Nov 12, 2024

Currently loading content in Stride at runtime without the windows specific libraries is a pain and not well documented. This is a bit of a personal document I wanted to bring up publicly in case others want to pitch in findings or help out in research and documentation.

Loadable Content

Images or Textures

This one is actually easy and only requires a couple of lines already.

// supported files should be dds, bmp, jpg, png, gif, tiff, wmp, tga
var file = File.OpenRead("test.png");
// graphics device can come from the game class or the ScriptComponent class.
var texture = Texture.Load(GraphicsDevice, file); 

Image is also the same but you most likely want the above.

Models and Skeletons

This one is annoyingly close to being easy but fails when trying to actually add the ModelComponent to a scene.

  1. Add Stride.Importer.3D
  2. create a new MeshConverter class and load a file.
var meshConverter = new MeshConverter(new LoggerResult());
var model = _meshConverter.Convert(_modelPath + "FPS_Arms_GameReadyVer.fbx", _modelPath, false);
  1. Calculate the bounding boxes.
  2. Add the model to a component and to an entity in the scene.
var modelComponent = new ModelComponent()
{
	Model = model,
	BoundingBox = model.BoundingBox,
	BoundingSphere = model.BoundingSphere,
};
var entity = new Entity()
{
	modelComponent
};
entity.Scene = Entity.Scene;
  1. witness the crash in the ModelComponent class :(

Audio

Honestly no clue where to even start here. It seems like the required classes are in the OpenAL wrapper but hidden as internal? I may just be missing something there though.

I did however do some playing around with a custom implementation of audio with the added bonus of Steams audio engine. It's very unfinished though.
https://github.com/Doprez/Doprez.Stride.SteamAudio

Shaders

Again not really sure where to start here but it looks like it may be possible using this for direct3d and this for opengl/vulkan

Although Im not sure if those source files expect SDSL or HLSL. Based on my brief research it looks like it should be for hlsls and GLSL but it's a bit of a rabbit hole.

Tasks

  • Model import extensions (Im feel like I'm annoyingly close to something usable but debugging this is a pain so far.)
  • Skeleton import extensions
  • Audio import extensions
  • Texture import extensions (Its already pretty simple though so maybe not?)
  • Shader import extensions (May be worth waiting on the shader rewrite?)
@Doprez Doprez added the enhancement New feature or request label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant