mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Support interpolator types for object scale ups
This commit is contained in:
parent
dbdf8a97ae
commit
ff4a00d103
@ -774,7 +774,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
}
|
||||
}
|
||||
|
||||
public IrisObject scaled(double scale) {
|
||||
public IrisObject scaled(double scale, IrisObjectPlacementScaleInterpolator interpolation) {
|
||||
Vector sm1 = new Vector(scale - 1, scale - 1, scale - 1);
|
||||
scale = Math.max(0.001, Math.min(50, scale));
|
||||
if (scale < 1) {
|
||||
@ -814,7 +814,12 @@ public class IrisObject extends IrisRegistrant {
|
||||
}
|
||||
|
||||
if (scale > 1) {
|
||||
// oo.trihermite((int) Math.round(scale));
|
||||
switch(interpolation)
|
||||
{
|
||||
case TRILINEAR -> oo.trilinear((int) Math.round(scale));
|
||||
case TRICUBIC -> oo.tricubic((int) Math.round(scale));
|
||||
case TRIHERMITE -> oo.trihermite((int) Math.round(scale));
|
||||
}
|
||||
}
|
||||
|
||||
return oo;
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
|
||||
@Desc("Use 3D Interpolation on scaled objects if they are larger than the origin.")
|
||||
public enum IrisObjectPlacementScaleInterpolator
|
||||
{
|
||||
@DontObfuscate
|
||||
@Desc("Don't interpolate, big cubes")
|
||||
NONE,
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Uses linear interpolation in 3 dimensions, generally pretty good, but slow")
|
||||
TRILINEAR,
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Uses cubic spline interpolation in 3 dimensions, even better, but extreme slowdowns")
|
||||
TRICUBIC,
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Uses hermite spline interpolation in 3 dimensions, even better, but extreme slowdowns")
|
||||
TRIHERMITE
|
||||
}
|
@ -31,6 +31,10 @@ public class IrisObjectScale {
|
||||
@Desc("The maximum height for placement (top of object)")
|
||||
private double maximumScale = 1;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("If this object is scaled up beyond its origin size, specify a 3D interpolator")
|
||||
private IrisObjectPlacementScaleInterpolator interpolation = IrisObjectPlacementScaleInterpolator.NONE;
|
||||
|
||||
private final transient ConcurrentLinkedHashMap<IrisObject, KList<IrisObject>> cache
|
||||
= new ConcurrentLinkedHashMap.Builder<IrisObject, KList<IrisObject>>()
|
||||
.initialCapacity(64)
|
||||
@ -68,7 +72,7 @@ public class IrisObjectScale {
|
||||
|
||||
KList<IrisObject> c = new KList<>();
|
||||
for (double i = minimumScale; i < maximumScale; i += (maximumScale - minimumScale) / (double) (Math.min(variations, 32))) {
|
||||
c.add(origin.scaled(i));
|
||||
c.add(origin.scaled(i, getInterpolation()));
|
||||
}
|
||||
|
||||
return c;
|
||||
|
Loading…
x
Reference in New Issue
Block a user