-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from ArtifactForms/working2
Working2
- Loading branch information
Showing
14 changed files
with
356 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package engine.resources; | ||
|
||
/** | ||
* Enum representing the various filter modes available for texture sampling. These filter modes | ||
* determine how textures are sampled and filtered when applied to 3D models or surfaces, affecting | ||
* the appearance of textures when viewed at different distances or angles. | ||
* | ||
* <p>The available filter modes are: | ||
* | ||
* <ul> | ||
* <li><strong>POINT:</strong> A basic, nearest-neighbor sampling method where the texture pixel | ||
* closest to the screen pixel is selected. | ||
* <li><strong>LINEAR:</strong> A linear interpolation method that smooths between the two nearest | ||
* texture pixels to create a blend. | ||
* <li><strong>BILINEAR:</strong> A more advanced version of linear interpolation that considers | ||
* the four nearest texture pixels, interpolating in both x and y directions. | ||
* <li><strong>TRILINEAR:</strong> An extension of bilinear filtering that interpolates between | ||
* multiple mipmap levels, providing smoother transitions between textures at different | ||
* distances from the viewer. | ||
* </ul> | ||
* | ||
* Each mode offers a different trade-off between performance and visual quality. | ||
* | ||
* @see <a href="https://www.opengl.org/wiki/Texture_Filtering">OpenGL Wiki on Texture Filtering</a> | ||
*/ | ||
public enum FilterMode { | ||
/** | ||
* Nearest-neighbor filtering, where the closest texel (texture pixel) is chosen. Produces a | ||
* blocky appearance when viewed from a distance. | ||
*/ | ||
POINT, | ||
|
||
/** | ||
* Linear interpolation between two nearest texels, offering smoother transitions compared to | ||
* POINT. | ||
*/ | ||
LINEAR, | ||
|
||
/** | ||
* Bilinear interpolation that considers the four nearest texels, interpolating in both x and y | ||
* directions. Provides smoother results than LINEAR. | ||
*/ | ||
BILINEAR, | ||
|
||
/** | ||
* Trilinear interpolation that blends between multiple mipmap levels in addition to performing | ||
* bilinear interpolation on each level. It smooths transitions between textures at varying | ||
* distances from the camera. | ||
*/ | ||
TRILINEAR | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package engine.resources; | ||
|
||
public class Texture2D implements Texture { | ||
|
||
private Texture texture; | ||
|
||
public Texture2D(int width, int height) { | ||
texture = TextureManager.getInstance().createTexture(width, height); | ||
} | ||
|
||
@Override | ||
public int getWidth() { | ||
return texture.getWidth(); | ||
} | ||
|
||
@Override | ||
public int getHeight() { | ||
return texture.getHeight(); | ||
} | ||
|
||
@Override | ||
public void bind(int unit) { | ||
texture.bind(unit); | ||
} | ||
|
||
@Override | ||
public void unbind() { | ||
texture.unbind(); | ||
} | ||
|
||
@Override | ||
public void delete() { | ||
texture.delete(); | ||
} | ||
|
||
@Override | ||
public void setPixels(int[] pixels) { | ||
texture.setPixels(pixels); | ||
} | ||
|
||
@Override | ||
public FilterMode getFilterMode() { | ||
return texture.getFilterMode(); | ||
} | ||
|
||
@Override | ||
public void setFilterMode(FilterMode filterMode) { | ||
texture.setFilterMode(filterMode); | ||
} | ||
|
||
@Override | ||
public Texture getBackendTexture() { | ||
return texture; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
package engine.resources; | ||
|
||
import java.awt.Image; | ||
|
||
public interface TextureLoader { | ||
|
||
Texture loadTexture(String filePath); | ||
|
||
Texture createTexture(Image image); | ||
|
||
Texture createTexture(int width, int height); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.