MauryDev.KoGaMa.ModelAPI
1.0.0
dotnet add package MauryDev.KoGaMa.ModelAPI --version 1.0.0
NuGet\Install-Package MauryDev.KoGaMa.ModelAPI -Version 1.0.0
<PackageReference Include="MauryDev.KoGaMa.ModelAPI" Version="1.0.0" />
<PackageVersion Include="MauryDev.KoGaMa.ModelAPI" Version="1.0.0" />
<PackageReference Include="MauryDev.KoGaMa.ModelAPI" />
paket add MauryDev.KoGaMa.ModelAPI --version 1.0.0
#r "nuget: MauryDev.KoGaMa.ModelAPI, 1.0.0"
#:package MauryDev.KoGaMa.ModelAPI@1.0.0
#addin nuget:?package=MauryDev.KoGaMa.ModelAPI&version=1.0.0
#tool nuget:?package=MauryDev.KoGaMa.ModelAPI&version=1.0.0
KoGaMa Model API
A lightweight .NET Standard 2.0 library designed for handling, manipulating, and serializing 3D model data for KoGaMa. This API provides the data structures necessary to represent voxel-like cubes, their materials, and their vertex positions.
🚀 Features
- Cube Representation: Detailed modeling of cubes including positions, face materials, and corner offsets.
- Coordinate Mapping: A specialized
PositionConverterthat maps byte values toVector3coordinates based on a predefined grid. - Serialization Interface: A generic
ISerializerinterface to implement custom binary or JSON saving/loading logic. - Lightweight: Targets
.NET Standard 2.0for maximum compatibility across different .NET platforms (Core, Framework, Unity).
🛠 Technical Overview
Core Components
ModelInfo: The root container for a model, containing a list of allCubeobjects.Cube: Represents a single block. It contains:Position: AnIntVector(short-based 3D coordinate).Materials: An array of 6 bytes representing the material of each face.Corners: An array of 8 bytes representing the offset of each corner vertex.
PositionConverter: Handles the conversion between a singlebyteand aVector3. It uses a step-based lookup table (-0.5f, -0.25f, 0f, 0.25f, 0.5f) to determine exact vertex placements.IntVector: A memory-efficient 3D vector usingshortvalues instead offloatorint.
📦 Installation
This project targets .NET Standard 2.0. You can include it in your project by adding a reference to the compiled DLL or including the source files.
Dependencies:
System.Numerics.Vectors(v4.6.1+)
💻 Usage Example
Creating a Model
using MauryDev.KoGaMa.ModelAPI.Model;
using MauryDev.KoGaMa.ModelAPI.Models;
using System.Collections.Generic;
var model = new ModelInfo();
var cube = new Cube
{
Position = new IntVector(0, 0, 0),
Materials = new byte[] { 1, 1, 1, 1, 1, 1 } // Example material IDs
};
model.Cubes.Add(cube);
Converting Corner Bytes to Vectors
The Cube class provides a convenient CornersVector property that uses the PositionConverter internally:
var cube = new Cube();
// These vectors represent the 8 corners of the cube relative to its position
System.Numerics.Vector3[] vertices = cube.CornersVector;
Implementing a Serializer
You can create your own serialization logic by implementing the ISerializer interface:
public class MyModelSerializer : ISerializer
{
public void Serialize(Stream stream, ModelInfo model)
{
// Implement binary writing logic here
}
public ModelInfo Deserialize(Stream stream)
{
// Implement binary reading logic here
return new ModelInfo();
}
}
📐 Coordinate System
The PositionConverter uses a 5 * 5 * 5 grid system. A byte value is decoded into X, Y, and Z coordinates as follows:
- X:
index / 25 - Y:
(index % 25) / 5 - Z:
index % 5
Each index maps to one of the following floats: {-0.5, -0.25, 0, 0.25, 0.5}.
Author
- MauryDev
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Numerics.Vectors (>= 4.6.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MauryDev.KoGaMa.ModelAPI:
| Package | Downloads |
|---|---|
|
MauryDev.KoGaMa.AvatarAPI
avatar api kogama core |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 37 | 6/17/2026 |