Reverted previous change. Use geometry.center() instead.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10696 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Zer..om 12 years ago
parent 81d7a145a7
commit e58d47c28d
  1. 45
      engine/src/core/com/jme3/scene/shape/Quad.java

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009-2012 jMonkeyEngine * Copyright (c) 2009-2010 jMonkeyEngine
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -29,6 +29,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.jme3.scene.shape; package com.jme3.scene.shape;
import com.jme3.scene.Mesh; import com.jme3.scene.Mesh;
@ -77,21 +78,6 @@ public class Quad extends Mesh {
updateGeometry(width, height, flipCoords); updateGeometry(width, height, flipCoords);
} }
/**
* Create a quad with the given width and height. The quad
* is always created in the XY plane.
*
* @param width The X extent or width
* @param height The Y extent or width
* @param flipCoords If true, the texture coordinates will be flipped
* along the Y axis.
* @param originAtCenter If true then the origin of the quad will be at the center
* of the quad, rather than at one corner.
*/
public Quad(float width, float height, boolean flipCoords, boolean originAtCenter){
updateGeometry(width, height, flipCoords, originAtCenter);
}
public float getHeight() { public float getHeight() {
return height; return height;
} }
@ -103,29 +89,16 @@ public class Quad extends Mesh {
public void updateGeometry(float width, float height){ public void updateGeometry(float width, float height){
updateGeometry(width, height, false); updateGeometry(width, height, false);
} }
public void updateGeometry(float width, float height, boolean flipCoords) { public void updateGeometry(float width, float height, boolean flipCoords) {
updateGeometry(width, height, flipCoords, false);
}
public void updateGeometry(float width, float height, boolean flipCoords, boolean originAtCenter) {
this.width = width; this.width = width;
this.height = height; this.height = height;
if (originAtCenter) { setBuffer(Type.Position, 3, new float[]{0, 0, 0,
float halfWidth = width*0.5f; width, 0, 0,
float halfHeight = height*0.5f; width, height, 0,
setBuffer(Type.Position, 3, new float[]{-halfWidth, -halfHeight, 0, 0, height, 0
halfWidth, -halfHeight, 0, });
halfWidth, halfHeight, 0,
-halfWidth, halfHeight, 0
});
} else {
setBuffer(Type.Position, 3, new float[]{0, 0, 0,
width, 0, 0,
width, height, 0,
0, height, 0
});
}
if (flipCoords){ if (flipCoords){
setBuffer(Type.TexCoord, 2, new float[]{0, 1, setBuffer(Type.TexCoord, 2, new float[]{0, 1,

Loading…
Cancel
Save