public final class ObjectLoader
extends java.lang.Object
ObjectLoader class is used for loading Wavefront Object (.obj) models into Primitive instances.| Modifier and Type | Method and Description |
|---|---|
static java.util.List<Primitive> |
load(java.io.File file)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.io.File file,
float scale)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.io.File file,
float scale,
java.util.function.BiFunction<java.lang.String,java.lang.String,Surface> surfaceMapper)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.io.File file,
float scale,
java.util.function.BiFunction<java.lang.String,java.lang.String,Surface> surfaceMapper,
float translateX,
float translateY,
float translateZ)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.io.File file,
float scale,
Surface surface)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.lang.String filename)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.lang.String filename,
float scale)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.lang.String filename,
float scale,
java.util.function.BiFunction<java.lang.String,java.lang.String,Surface> surfaceMapper)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.lang.String filename,
float scale,
java.util.function.BiFunction<java.lang.String,java.lang.String,Surface> surfaceMapper,
float translateX,
float translateY,
float translateZ)
Loads a Wavefront Object (.obj) model.
|
static java.util.List<Primitive> |
load(java.lang.String filename,
float scale,
Surface surface)
Loads a Wavefront Object (.obj) model.
|
public static java.util.List<Primitive> load(java.io.File file)
Returns a List of Primitives that represents the loaded Wavefront Object model.
Calling this method is equivalent to load(file, 1.0F).
If file is null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
file - a File representing the file to load fromList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, file is nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.io.File file, float scale)
Returns a List of Primitives that represents the loaded Wavefront Object model.
Calling this method is equivalent to load(file, scale, (groupName, materialName) -> new Surface(new LambertianMaterial(), new ConstantTexture(Color.GRAY), new ConstantTexture(Color.BLACK), new ConstantTexture(Color.BLACK))).
If file is null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
file - a File representing the file to load fromscale - the scale to use on the Wavefront Object modelList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, file is nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.io.File file, float scale, java.util.function.BiFunction<java.lang.String,java.lang.String,Surface> surfaceMapper)
Returns a List of Primitives that represents the loaded Wavefront Object model.
Calling this method is equivalent to load(file, scale, surfaceMapper, 0.0F, 0.0F, 0.0F).
If either file or surfaceMapper are null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
file - a File representing the file to load fromscale - the scale to use on the Wavefront Object modelsurfaceMapper - a BiFunction that maps a group name or a material name into a specific Surface instanceList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, either file or surfaceMapper are nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.io.File file, float scale, java.util.function.BiFunction<java.lang.String,java.lang.String,Surface> surfaceMapper, float translateX, float translateY, float translateZ)
Returns a List of Primitives that represents the loaded Wavefront Object model.
If either file or surfaceMapper are null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
file - a File representing the file to load fromscale - the scale to use on the Wavefront Object modelsurfaceMapper - a BiFunction that maps a group name or a material name into a specific Surface instancetranslateX - use this to translate the Wavefront Object model in the X-directiontranslateY - use this to translate the Wavefront Object model in the Y-directiontranslateZ - use this to translate the Wavefront Object model in the Z-directionList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, either file or surfaceMapper are nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.io.File file, float scale, Surface surface)
Returns a List of Primitives that represents the loaded Wavefront Object model.
Calling this method is equivalent to load(file, scale, (groupName, materialName) -> surface).
If either file or surface are null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
file - a File representing the file to load fromscale - the scale to use on the Wavefront Object modelsurface - the Surface to use on the Wavefront Object modelList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, either file or surface are nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.lang.String filename)
Returns a List of Primitives that represents the loaded Wavefront Object model.
Calling this method is equivalent to load(filename, 1.0F).
If filename is null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
filename - a String representing the filename of the file to load fromList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, filename is nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.lang.String filename, float scale)
Returns a List of Primitives that represents the loaded Wavefront Object model.
Calling this method is equivalent to load(filename, scale, (groupName, materialName) -> new Surface(new LambertianMaterial(), new ConstantTexture(Color.GRAY), new ConstantTexture(Color.BLACK), new ConstantTexture(Color.BLACK))).
If filename is null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
filename - a String representing the filename of the file to load fromscale - the scale to use on the Wavefront Object modelList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, filename is nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.lang.String filename, float scale, java.util.function.BiFunction<java.lang.String,java.lang.String,Surface> surfaceMapper)
Returns a List of Primitives that represents the loaded Wavefront Object model.
Calling this method is equivalent to load(filename, scale, surfaceMapper, 0.0F, 0.0F, 0.0F).
If either filename or surfaceMapper are null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
filename - a String representing the filename of the file to load fromscale - the scale to use on the Wavefront Object modelsurfaceMapper - a BiFunction that maps a group name or a material name into a specific Surface instanceList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, either filename or surfaceMapper are nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.lang.String filename, float scale, java.util.function.BiFunction<java.lang.String,java.lang.String,Surface> surfaceMapper, float translateX, float translateY, float translateZ)
Returns a List of Primitives that represents the loaded Wavefront Object model.
If either filename or surfaceMapper are null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
filename - a String representing the filename of the file to load fromscale - the scale to use on the Wavefront Object modelsurfaceMapper - a BiFunction that maps a group name or a material name into a specific Surface instancetranslateX - use this to translate the Wavefront Object model in the X-directiontranslateY - use this to translate the Wavefront Object model in the Y-directiontranslateZ - use this to translate the Wavefront Object model in the Z-directionList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, either filename or surfaceMapper are nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurspublic static java.util.List<Primitive> load(java.lang.String filename, float scale, Surface surface)
Returns a List of Primitives that represents the loaded Wavefront Object model.
Calling this method is equivalent to load(filename, scale, (groupName, materialName) -> surface).
If either filename or surface are null, a NullPointerException will be thrown.
If an I/O error occurs, an UncheckedIOException will be thrown.
filename - a String representing the filename of the file to load fromscale - the scale to use on the Wavefront Object modelsurface - the Surface to use on the Wavefront Object modelList of Primitives that represents the loaded Wavefront Object modeljava.lang.NullPointerException - thrown if, and only if, either filename or surface are nulljava.io.UncheckedIOException - thrown if, and only if, an I/O error occurs