Skip to content

Commit

Permalink
Merge pull request #2 from B3zaleel/implement-ctm-loading
Browse files Browse the repository at this point in the history
Implement ctm loading
  • Loading branch information
B3zaleel authored May 13, 2024
2 parents 0bc8648 + 34d2c20 commit 171cf2d
Show file tree
Hide file tree
Showing 19 changed files with 704 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase

dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion
dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants
dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase
dotnet_naming_rule.local_constants_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.local_constants_should_be_pascalcase.symbols = local_constants
dotnet_naming_rule.local_constants_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
Expand All @@ -224,13 +224,13 @@ dotnet_naming_rule.private_static_fields_should_be_camelcase.severity = suggesti
dotnet_naming_rule.private_static_fields_should_be_camelcase.symbols = private_static_fields
dotnet_naming_rule.private_static_fields_should_be_camelcase.style = _camelcase

dotnet_naming_rule.public_constant_fields_should_be_camelcase.severity = suggestion
dotnet_naming_rule.public_constant_fields_should_be_camelcase.symbols = public_constant_fields
dotnet_naming_rule.public_constant_fields_should_be_camelcase.style = _camelcase
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = _pascalcase

dotnet_naming_rule.public_static_readonly_fields_should_be_camelcase.severity = suggestion
dotnet_naming_rule.public_static_readonly_fields_should_be_camelcase.symbols = public_static_readonly_fields
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ StyleCopReport.xml
*_h.h
*.ilk
*.meta
*obj/
!*Obj/
*.iobj
*.pch
*.pdb
Expand Down
14 changes: 14 additions & 0 deletions ThreeDModels.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Format", "Format", "{2E7AAD
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThreeDModels.Format.Obj.UnitTests", "tests\ThreeDModels\Format\Obj.UnitTests\ThreeDModels.Format.Obj.UnitTests.csproj", "{272082CD-8882-40F1-A232-E64F43156B1F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThreeDModels.Format.Ctm", "src\ThreeDModels\Format\Ctm\ThreeDModels.Format.Ctm.csproj", "{6F517121-325F-410D-B7B3-7B1D2FC1E420}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThreeDModels.Format.Ctm.UnitTests", "tests\ThreeDModels\Format\Ctm.UnitTests\ThreeDModels.Format.Ctm.UnitTests.csproj", "{0C3E07D5-30ED-4B46-94D0-DF39D4101D95}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -36,6 +40,14 @@ Global
{272082CD-8882-40F1-A232-E64F43156B1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{272082CD-8882-40F1-A232-E64F43156B1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{272082CD-8882-40F1-A232-E64F43156B1F}.Release|Any CPU.Build.0 = Release|Any CPU
{6F517121-325F-410D-B7B3-7B1D2FC1E420}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F517121-325F-410D-B7B3-7B1D2FC1E420}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F517121-325F-410D-B7B3-7B1D2FC1E420}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F517121-325F-410D-B7B3-7B1D2FC1E420}.Release|Any CPU.Build.0 = Release|Any CPU
{0C3E07D5-30ED-4B46-94D0-DF39D4101D95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C3E07D5-30ED-4B46-94D0-DF39D4101D95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C3E07D5-30ED-4B46-94D0-DF39D4101D95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C3E07D5-30ED-4B46-94D0-DF39D4101D95}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A75E239E-4BB5-423D-B7E9-D60E96855389} = {7D388FB1-4C7A-410B-B186-92D5CD8819E9}
Expand All @@ -44,5 +56,7 @@ Global
{20393DEC-9CB9-4259-B145-0655B408ACA1} = {A6C0B1F1-9114-40AD-8816-BDBEDC940CED}
{2E7AAD7B-6592-4BCD-9766-CBD16C6553BF} = {20393DEC-9CB9-4259-B145-0655B408ACA1}
{272082CD-8882-40F1-A232-E64F43156B1F} = {2E7AAD7B-6592-4BCD-9766-CBD16C6553BF}
{6F517121-325F-410D-B7B3-7B1D2FC1E420} = {9352709B-38FB-4B82-BB5B-740A7746887C}
{0C3E07D5-30ED-4B46-94D0-DF39D4101D95} = {2E7AAD7B-6592-4BCD-9766-CBD16C6553BF}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions src/ThreeDModels/Format/Ctm/CompressionMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ThreeDModels.Format.Ctm;

public enum CompressionMethod
{
RAW = 0x00574152,
MG1 = 0x0031474d,
MG2 = 0x0032474d,
}
7 changes: 7 additions & 0 deletions src/ThreeDModels/Format/Ctm/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace ThreeDModels.Format.Ctm;

public static class Constants
{
public const int Version = 0x00000005;
public const int PackedDataPropsSize = 5;
}
14 changes: 14 additions & 0 deletions src/ThreeDModels/Format/Ctm/Ctm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using ThreeDModels.Format.Ctm.Elements;

namespace ThreeDModels.Format.Ctm;

public class Ctm
{
public List<Vertex> Vertices { get; set; } = [];
public List<Triangle> Triangles { get; set; } = [];
public List<UvMap> UvMaps { get; set; } = [];
public List<AttributeMap> AttributeMaps { get; set; } = [];
public required CompressionMethod CompressionMethod { get; set; } = CompressionMethod.RAW;
public int Flags { get; set; } = 0;
public string Comment { get; set; } = string.Empty;
}
Loading

0 comments on commit 171cf2d

Please sign in to comment.