Ext.KHR_EmissiveStrength.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using SharpGLTF.SchemaReflection;
  4. namespace SharpGLTF
  5. {
  6. class EmissiveStrengthExtension : SchemaProcessor
  7. {
  8. private static string SchemaUri => Constants.KhronosExtensionPath("KHR_materials_emissive_strength", "material.KHR_materials_emissive_strength.schema.json");
  9. private const string ExtensionRootClassName = "KHR_materials_emissive_strength glTF Material Extension";
  10. public override IEnumerable<(string, SchemaType.Context)> Process()
  11. {
  12. var ctx = SchemaProcessing.LoadSchemaContext(SchemaUri);
  13. ctx.IgnoredByCodeEmitter("glTF Property");
  14. ctx.IgnoredByCodeEmitter("glTF Child of Root Property");
  15. ctx.IgnoredByCodeEmitter("Texture Info");
  16. var cls = ctx.FindClass(ExtensionRootClassName);
  17. // straightforward extension, nothing to do
  18. yield return ("ext.MaterialsEmissiveStrength.g", ctx);
  19. }
  20. public override void PrepareTypes(CodeGen.CSharpEmitter newEmitter, SchemaType.Context ctx)
  21. {
  22. newEmitter.SetRuntimeName(ExtensionRootClassName, "MaterialEmissiveStrength");
  23. }
  24. }
  25. }