Add more vanilla model friendly modellist type for model file, use for

comparator
This commit is contained in:
Mike Primm 2022-01-23 21:44:26 -06:00
parent 9247b7ec2f
commit 4452777585
11 changed files with 540 additions and 110 deletions

View file

@ -151,6 +151,22 @@ public interface ModModelDefinition {
* @return block model record
*/
public PatchBlockModel addRotatedPatchModel(String blockname, PatchBlockModel model, int xrot, int yrot, int zrot);
/**
* Add model block model: default assumes all metadata values are matching
* @param blockname - block name
* @return block model record
*/
public ModelBlockModel addModelBlockModel(String blockname);
/**
* Add rotated model block model, based on existing model : default assumes all metadata values are matching
* @param blockname - block name
* @param model - existing model to be rotated
* @param xrot - x rotation in degrees (0, 90, 180, 270)
* @param yrot - y rotation in degrees (0, 90, 180, 270)
* @param zrot - z rotation in degrees (0, 90, 180, 270)
* @return block model record
*/
public ModelBlockModel addRotatedModelBlockModel(String blockname, ModelBlockModel model, int xrot, int yrot, int zrot);
/**
* Final call for model definition: publishes definiiton to Dynmap to be used for the mod
* @return true if successful, false if error

View file

@ -0,0 +1,32 @@
package org.dynmap.modsupport;
// Model for more direct translation of MC models
// All coordinates are 0-16 range per block, and 0-16 range for UV
public interface ModelBlockModel extends BlockModel {
public interface ModelBlock {
/**
* Factory method for adding a side to a model block started using addModelBlock.
*
* @param face - which face (determines use of xyz-min vs xyz-max
* @param uv - bounds on UV (umin, vmin, umax, vmax): if null, default based on face range
* @param textureid - texture ID
*/
public void addBlockSide(BlockSide side, double[] uv, int textureid);
}
/**
* Factory method to build a block of patches relative to a typical element in a MC model file.
* Specifically, all coordinates are relative to 0-16 range for
* side of a cube, and relative to 0-16 range for U,V within a texture:
*
* from, to in model drive 'from', 'to' inputs
*
* face, uv of face, and texture in model drives face, uv, textureid (added using addBlockSide)
*
* @param from - vector of lower left corner of box (0-16 range for coordinates - min x, y, z)
* @param to - vector of upper right corner of box (0-16 range for coordinates max x, y, z)
* @return model block to add faces to
*/
public ModelBlock addModelBlock(double[] from, double[] to);
}

View file

@ -6,36 +6,6 @@ import org.dynmap.renderer.RenderPatchFactory.SideVisible;
* Patch block model
*/
public interface PatchBlockModel extends BlockModel {
/**
* Add patch with given attributes.
*
* Definition is a 2D parallelogram surface, with origin <x0,y0,z0> within the block, and defined by two edge vectors -
* one with and end point of <xu,yu,zu>, and a second with an end point of <xv,yv,zv>. The patch is
* defined within the unit vector range umin to umax (parallel to the U vecotr) and vmin to vmax
* (parallel to the V vector).
* The surface can be visible via one side (SideVisible.TOP, SideVisible.BOTTOM) or both sides (SideVisible.BOTH).
*
* @param x0 - X coordinate of origin of patch
* @param y0 - Y coordinate of origin of patch
* @param z0 - Z coordinate of origin of patch
* @param xu - X coordinate of end of U vector
* @param yu - Y coordinate of end of U vector
* @param zu - Z coordinate of end of U vector
* @param xv - X coordinate of end of V vector
* @param yv - Y coordinate of end of V vector
* @param zv - Z coordinate of end of V vector
* @param umin - lower bound for visibility along U vector (use 0.0 by default)
* @param umax - upper bound for visibility along U vector (use 1.0 by default)
* @param vmin - lower bound for visibility along V vector (use 0.0 by default)
* @param vmax - upper bound for visibility along V vector (use 1.0 by default)
* @param uplusvmax - upper bound for visibility for U+V (use 100.0 by default: <=1.0 for triangle)
* @param sidevis - Controls which sides of the surface are visible (U cross V defines normal - TOP is from that side, BOTTOM is opposite side)
* @return patch ID
*/
@Deprecated
public String addPatch(double x0, double y0, double z0, double xu,
double yu, double zu, double xv, double yv, double zv, double umin,
double umax, double vmin, double vmax, double uplusvmax, SideVisible sidevis);
/**
* Add patch with given attributes.
*