Skip to content

Commit

Permalink
Refactor Texture3D -> TextureDefault3D
Browse files Browse the repository at this point in the history
As we are adding an abstraction layer
  • Loading branch information
JoopAue committed Mar 24, 2016
1 parent f42243f commit 810b58a
Show file tree
Hide file tree
Showing 6 changed files with 376 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@
/**
* @author Maarten Steur
*/
public class Texture3D extends Texture {
public class TextureDefault3D extends Texture {

private WrapMode wrapR = WrapMode.EdgeClamp;

/**
* Creates a new two-dimensional texture with default attributes.
*/
public Texture3D() {
public TextureDefault3D() {
super();
}

/**
* Creates a new three-dimensional texture using the given image.
* @param img The image to use.
*/
public Texture3D(Image img) {
public TextureDefault3D(Image img) {
super();
setImage(img);
if (img.getFormat().isDepthFormat()) {
Expand All @@ -76,7 +76,7 @@ public Texture3D(Image img) {
* @param depth
* @param format
*/
public Texture3D(int width, int height, int depth, Image.Format format) {
public TextureDefault3D(int width, int height, int depth, Image.Format format) {
this(new Image(format, width, height, depth, null, ColorSpace.Linear));
}

Expand All @@ -91,14 +91,14 @@ public Texture3D(int width, int height, int depth, Image.Format format) {
* @param format
* @param numSamples
*/
public Texture3D(int width, int height, int depth, int numSamples, Image.Format format) {
public TextureDefault3D(int width, int height, int depth, int numSamples, Image.Format format) {
this(new Image(format, width, height, depth, null, ColorSpace.Linear));
getImage().setMultiSamples(numSamples);
}

@Override
public Texture createSimpleClone() {
Texture3D clone = new Texture3D();
TextureDefault3D clone = new TextureDefault3D();
createSimpleClone(clone);
return clone;
}
Expand Down Expand Up @@ -166,10 +166,10 @@ public Type getType() {

@Override
public boolean equals(Object other) {
if (!(other instanceof Texture3D)) {
if (!(other instanceof TextureDefault3D)) {
return false;
}
Texture3D that = (Texture3D) other;
TextureDefault3D that = (TextureDefault3D) other;
if (this.getWrap(WrapAxis.R) != that.getWrap(WrapAxis.R)) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion jme3-core/src/main/java/com/jme3/texture/TextureProcessor.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Object postProcess(AssetKey key, Object obj) {
}
tex = new TextureCubeMap();
} else if (texKey.getTextureTypeHint() == Texture.Type.ThreeDimensional) {
tex = new Texture3D();
tex = new TextureDefault3D();
} else {
tex = new Texture2D();
}
Expand Down
14 changes: 7 additions & 7 deletions jme3-core/src/main/resources/com/jme3/system/version.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# THIS IS AN AUTO-GENERATED FILE..
# DO NOT MODIFY!
build.date=2016-03-17
git.revision=5378
build.date=2016-03-21
git.revision=5387
git.branch=test-texture
git.hash=d6a803edc45d61157efaa837fb354bfeb47405fb
git.hash.short=d6a803e
git.tag=v3.1-alpha1-220-gd6a803e
name.full=jMonkeyEngine 3.1-test-texture-5378
version.full=3.1-test-texture-5378
git.hash=c5b83a57ec6ffca5369b77a4e381d7061a400c4f
git.hash.short=c5b83a5
git.tag=v3.1-alpha1-229-gc5b83a5
name.full=jMonkeyEngine 3.1-test-texture-5387
version.full=3.1-test-texture-5387
version.number=3.1.0
version.tag=SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
import static org.mockito.Mockito.verify;


public class Texture3DTest {
public class TextureDefault3DTest {

private Texture3D tex;
private TextureDefault3D tex;

@Before
public void setUp(){
tex = new Texture3D();
tex = new TextureDefault3D();
}

/**
Expand Down Expand Up @@ -71,8 +71,8 @@ Test equals(Object)

@Test
public void testEqualsSameAxises() {
Texture3D tex1 = new Texture3D();
Texture3D tex2 = new Texture3D();
TextureDefault3D tex1 = new TextureDefault3D();
TextureDefault3D tex2 = new TextureDefault3D();

tex1.setWrap(Texture.WrapMode.EdgeClamp);
tex2.setWrap(Texture.WrapMode.EdgeClamp);
Expand All @@ -83,8 +83,8 @@ public void testEqualsSameAxises() {

@Test
public void testEqualsDiffAxises() {
Texture3D tex1 = new Texture3D();
Texture3D tex2 = new Texture3D();
TextureDefault3D tex1 = new TextureDefault3D();
TextureDefault3D tex2 = new TextureDefault3D();

tex1.setWrap(Texture.WrapAxis.R, Texture.WrapMode.Repeat);
tex2.setWrap(Texture.WrapAxis.R, Texture.WrapMode.MirroredRepeat);
Expand Down
4 changes: 2 additions & 2 deletions jme3-examples/src/main/java/jme3test/texture/TestTexture3D.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import com.jme3.texture.Image;
import com.jme3.texture.Image.Format;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture3D;
import com.jme3.texture.TextureDefault3D;
import com.jme3.texture.image.ColorSpace;
import com.jme3.util.BufferUtils;
import java.io.IOException;
Expand Down Expand Up @@ -126,6 +126,6 @@ private Texture getTexture() throws IOException {
}
bb.rewind();
data.add(bb);
return new Texture3D(new Image(Format.RGB8, 10, 10, 10, data, null, ColorSpace.Linear));
return new TextureDefault3D(new Image(Format.RGB8, 10, 10, 10, data, null, ColorSpace.Linear));
}
}
Loading

0 comments on commit 810b58a

Please sign in to comment.