Enhance patch definition - allow for triangles, trapezoids

This commit is contained in:
Mike Primm 2018-09-02 11:38:17 -05:00
parent d6f43206d1
commit 28bb9eea87
10 changed files with 150 additions and 29 deletions

View file

@ -32,9 +32,40 @@ public interface PatchBlockModel extends BlockModel {
* @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.
*
* 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 at u=umin (use 0.0 by default)
* @param vminatumax - lower bound for visibility along V vector at u=umax (use 0.0 by default)
* @param vmax - upper bound for visibility along V vector at u=umin (use 1.0 by default)
* @param vmaxatumax - upper bound for visibility along V vector at u=umax (use 1.0 by default)
* @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
*/
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 vminatumax, double vmax, double vmaxatumax, SideVisible sidevis);
/**
* Add patch with given attributes.
*

View file

@ -30,6 +30,37 @@ public interface RenderPatchFactory {
* @param textureidx - texture index to be used for patch
*/
public RenderPatch getPatch(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, SideVisible sidevis, int textureidx);
/**
* Get/create 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 vector) and vmin to vmax
* (parallel to the V vector).
* vmaxatumax allows for a triangle or trapezoid, specifying the max v value at umax (with vmax treated as the max v at u=umin)
* vminatumax allows for a triangle or trapezoid, specifying the min v value at umax (with vmin treated as the min v at u=umin)
* The surface can be visible via one side (SideVisible.TOP, SideVisible.BOTTOM) or both sides (SideVisible.BOTH).
* The surface also needs to define the index of the texture to be used for shading the surface.
*
* @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 at u=umin (use 0.0 by default)
* @param vminatumax - lower bound for visibility along V vector at u=umax (use 0.0 by default)
* @param vmax - upper bound for visibility along V vector at u=umin (use 1.0 by default)
* @param vmaxatumax - upper bound for visibility along V vector at u=umax (use 1.0 by default)
* @param sidevis - Controls which sides of the surface are visible (U cross V defines normal - TOP is from that side, BOTTOM is opposite side)
* @param textureidx - texture index to be used for patch
*/
public RenderPatch getPatch(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 vminatumax, double vmax, double vmaxatumax, SideVisible sidevis, int textureidx);
/**
* Get/create patch with given attributes.
*
@ -52,6 +83,7 @@ public interface RenderPatchFactory {
* @param sidevis - Controls which sides of the surface are visible (U cross V defines normal - TOP is from that side, BOTTOM is opposite side)
* @param textureidx - texture index to be used for patch
*/
@Deprecated
public RenderPatch getPatch(double x0, double y0, double z0, double xu, double yu, double zu, double xv, double yv, double zv, double uplusvmax, SideVisible sidevis, int textureidx);
/**
* Get/create patch with given attributes.