[Feature Request] Add Flip State Detection for IModel Interface
Description
I would like to request a new feature to detect the flip state of models along each axis. Currently, the VoxReader library does not provide a straightforward way to determine if an IModel is flipped on the X, Y, or Z axis, which is important information stored in MagicaVoxel files.
Problem
When working with MagicaVoxel models, the flip state along each axis is a crucial property for proper rendering and transformation. However, the current IModel interface lacks properties to access this information.
Proposed Solution
Add a new property to the IModel interface to represent the flip state:
public interface IModel
{
// Existing properties...
Vector3Bool IsFlipped { get; } // New property
}
// Supporting structure
public struct Vector3Bool
{
public bool X { get; set; }
public bool Y { get; set; }
public bool Z { get; set; }
public Vector3Bool(bool x, bool y, bool z)
{
X = x;
Y = y;
Z = z;
}
}
Additional Context
In MagicaVoxel, the flip state is represented in the model properties as shown in this screenshot:
Use Case
This feature would be essential for:
- Properly resolve flipped models in 3D applications
- Maintaining accurate transformation data when exporting to other formats
- Ensuring consistency with MagicaVoxel's behavior
Thank you for considering this feature request! Your library has been incredibly helpful for voxel-related development.
Thanks for the detailed feature request.
As far as I'm aware the flipped state is not stored directly in the .vox file, but in the "rotation matrix" on each model, so we can't just simply extract it like the other properties.
Additionally, retrieving the flipped state from the rotation matrix is not reliable, as with multiple flip and/or rotation operations the reference point for "which axis is flipped?" is lost.
As reading the flipped state directly is not a feature in MagicaVoxel itself, I'm curious on why you want to know this information. Can you tell me more about how you use the read data or did you maybe experience incorrect voxel positions (global or local)?