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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MauryDev.KoGaMa.ModelAPI" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MauryDev.KoGaMa.ModelAPI" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MauryDev.KoGaMa.ModelAPI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MauryDev.KoGaMa.ModelAPI --version 1.0.0
                    
#r "nuget: MauryDev.KoGaMa.ModelAPI, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MauryDev.KoGaMa.ModelAPI@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MauryDev.KoGaMa.ModelAPI&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MauryDev.KoGaMa.ModelAPI&version=1.0.0
                    
Install as a Cake Tool

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 PositionConverter that maps byte values to Vector3 coordinates based on a predefined grid.
  • Serialization Interface: A generic ISerializer interface to implement custom binary or JSON saving/loading logic.
  • Lightweight: Targets .NET Standard 2.0 for maximum compatibility across different .NET platforms (Core, Framework, Unity).

🛠 Technical Overview

Core Components

  • ModelInfo: The root container for a model, containing a list of all Cube objects.
  • Cube: Represents a single block. It contains:
    • Position: An IntVector (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 single byte and a Vector3. 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 using short values instead of float or int.

📦 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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