Browse Source

updated (legacy) monogame project

Vicente Penades 3 years ago
parent
commit
207cb0e555

+ 0 - 4
examples/SharpGLTF.Runtime.MonoGame/MeshPrimitiveReader.cs

@@ -1,11 +1,7 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
-using System.Numerics;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices.WindowsRuntime;
 
 
-using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Graphics;
 using Microsoft.Xna.Framework.Graphics;
 
 
 using SharpGLTF.Schema2;
 using SharpGLTF.Schema2;

+ 1 - 3
examples/SharpGLTF.Runtime.MonoGame/MonoGameModelInstance.cs

@@ -78,9 +78,7 @@ namespace SharpGLTF.Runtime
 
 
             if (modelXform is Transforms.RigidTransform statXform)
             if (modelXform is Transforms.RigidTransform statXform)
             {
             {
-                var statTransform = statXform.WorldMatrix.ToXna();
-
-                worldXform = Matrix.Multiply(statTransform, worldXform);
+                worldXform = Matrix.Multiply(statXform.WorldMatrix, worldXform);
 
 
                 foreach (var effect in mesh.Effects)
                 foreach (var effect in mesh.Effects)
                 {
                 {

+ 2 - 2
examples/SharpGLTF.Runtime.MonoGame/MonoGameModelTemplate.cs

@@ -125,7 +125,7 @@ namespace SharpGLTF.Runtime
             {
             {
                 var b = _Meshes[inst.Template.LogicalMeshIndex].BoundingSphere;
                 var b = _Meshes[inst.Template.LogicalMeshIndex].BoundingSphere;
 
 
-                if (inst.Transform is Transforms.RigidTransform statXform) b = b.Transform(statXform.WorldMatrix.ToXna());
+                if (inst.Transform is Transforms.RigidTransform statXform) b = b.Transform(statXform.WorldMatrix);
 
 
                 if (inst.Transform is Transforms.SkinnedTransform skinXform)
                 if (inst.Transform is Transforms.SkinnedTransform skinXform)
                 {
                 {
@@ -134,7 +134,7 @@ namespace SharpGLTF.Runtime
 
 
                     var bb = b;
                     var bb = b;
 
 
-                    foreach (var xb in skinXform.SkinMatrices.Select(item => bb.Transform(item.ToXna())))
+                    foreach (var xb in skinXform.SkinMatrices.Select(item => bb.Transform(item)))
                     {
                     {
                         b = BoundingSphere.CreateMerged(b, xb);
                         b = BoundingSphere.CreateMerged(b, xb);
                     }
                     }

+ 2 - 2
examples/SharpGLTF.Runtime.MonoGame/SharpGLTF.Runtime.MonoGame.csproj

@@ -1,14 +1,14 @@
 <Project Sdk="Microsoft.NET.Sdk">
 <Project Sdk="Microsoft.NET.Sdk">
 
 
   <PropertyGroup>
   <PropertyGroup>
-    <TargetFramework>net471</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <RootNamespace>SharpGLTF.Runtime</RootNamespace>
     <RootNamespace>SharpGLTF.Runtime</RootNamespace>
     <LangVersion>7.3</LangVersion>
     <LangVersion>7.3</LangVersion>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />    
+    <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />    
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>

+ 0 - 22
examples/SharpGLTF.Runtime.MonoGame/_Extensions.cs

@@ -8,16 +8,6 @@ namespace SharpGLTF.Runtime
 {
 {
     static class _Extensions
     static class _Extensions
     {
     {
-        public static Vector2 ToXna(this System.Numerics.Vector2 v)
-        {
-            return new Vector2(v.X, v.Y);
-        }
-
-        public static Vector3 ToXna(this System.Numerics.Vector3 v)
-        {
-            return new Vector3(v.X, v.Y, v.Z);
-        }
-
         public static Vector4 ToXna(this System.Numerics.Vector4 v)
         public static Vector4 ToXna(this System.Numerics.Vector4 v)
         {
         {
             return new Vector4(v.X, v.Y, v.Z, v.W);
             return new Vector4(v.X, v.Y, v.Z, v.W);
@@ -32,18 +22,6 @@ namespace SharpGLTF.Runtime
                 m.M31, m.M32, m.M33, m.M34,
                 m.M31, m.M32, m.M33, m.M34,
                 m.M41, m.M42, m.M43, m.M44
                 m.M41, m.M42, m.M43, m.M44
                 );
                 );
-        }       
-
-        public static BoundingSphere CreateBoundingSphere(this Schema2.Mesh mesh)
-        {
-            var points = mesh
-                .Primitives
-                .Select(item => item.GetVertexAccessor("POSITION"))
-                .Where(item => item != null)
-                .SelectMany(item => item.AsVector3Array())
-                .Select(item => item.ToXna());
-
-            return BoundingSphere.CreateFromPoints(points);
         }
         }
     }
     }
 }
 }