本文整理汇总了Java中com.jogamp.opengl.math.geom.AABBox类的典型用法代码示例。如果您正苦于以下问题:Java AABBox类的具体用法?Java AABBox怎么用?Java AABBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AABBox类属于com.jogamp.opengl.math.geom包,在下文中一共展示了AABBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDebugOutline
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
protected OutlineShape createDebugOutline(final OutlineShape shape, final AABBox box) {
final float tw = box.getWidth();
final float th = box.getHeight();
final float minX = box.getMinX();
final float minY = box.getMinY();
final float z = box.getMinZ() + 0.025f;
// CCW!
shape.addVertex(minX, minY, z, true);
shape.addVertex(minX+tw, minY, z, true);
shape.addVertex(minX+tw, minY + th, z, true);
shape.addVertex(minX, minY + th, z, true);
shape.closeLastOutline(true);
return shape;
}
示例2: renderString
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
void renderString(final GLDrawable drawable, final GL2ES2 gl, final RegionRenderer renderer, final Font font, final TextRegionUtil textRenderUtil, final String text, final int column, int row, final int z0, final int[] sampleCount) {
final int height = drawable.getSurfaceHeight();
int dx = 0;
int dy = height;
if(0>row) {
row = lastRow + 1;
}
final AABBox textBox = font.getMetricBounds(text, fontSize);
dx += font.getAdvanceWidth('X', fontSize) * column;
dy -= (int)textBox.getHeight() * ( row + 1 );
final PMVMatrix pmv = renderer.getMatrix();
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmv.glLoadIdentity();
pmv.glTranslatef(dx, dy, z0);
textRenderUtil.drawString3D(gl, renderer, font, fontSize, text, null, sampleCount);
lastRow = row;
}
示例3: renderString
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
void renderString(final GLDrawable drawable, final GL2ES2 gl, final RegionRenderer renderer, final TextRegionUtil textRenderUtil, final String text, final int column, int row, final int z0, final int[] sampleCount) {
final int height = drawable.getSurfaceHeight();
int dx = 0;
int dy = height;
if(0>row) {
row = lastRow + 1;
}
final AABBox textBox = font.getMetricBounds(text, fontSize);
dx += font.getAdvanceWidth('X', fontSize) * column;
dy -= (int)textBox.getHeight() * ( row + 1 );
final PMVMatrix pmv = renderer.getMatrix();
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmv.glLoadIdentity();
pmv.glTranslatef(dx, dy, z0);
textRenderUtil.drawString3D(gl, renderer, font, fontSize, text, null, sampleCount);
lastRow = row;
}
示例4: getStringHeight
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
@Override
public float getStringHeight(CharSequence string, float pixelSize) {
int height = 0;
for (int i = 0; i < string.length(); i++) {
char character = string.charAt(i);
if (character != ' ') {
Glyph glyph;
try {
glyph = getGlyph(character);
AABBox bbox = glyph.getBBox(pixelSize);
height = (int) Math.ceil(Math.max(bbox.getHeight(), height));
} catch (FontException e) {
logger.error(e.getMessage());
}
}
}
return height;
}
示例5: addShapeToRegion
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
public final AABBox addShapeToRegion(final float pixelSize, final Region region, final AffineTransform tLeft) {
box.reset();
this.region = region;
this.tLeft = tLeft;
TextRegionUtil.processString(shapeVisitor, null, font, pixelSize, text, tempT1, tempT2);
this.region = null;
this.tLeft = null;
return box;
}
示例6: pickShapeImpl
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private UIShape pickShapeImpl(final int glWinX, final int glWinY, final float[] objPos) {
final float winZ0 = 0f;
final float winZ1 = 0.3f;
/**
final FloatBuffer winZRB = Buffers.newDirectFloatBuffer(1);
gl.glReadPixels( x, y, 1, 1, GL2ES2.GL_DEPTH_COMPONENT, GL.GL_FLOAT, winZRB);
winZ1 = winZRB.get(0); // dir
*/
final PMVMatrix pmv = renderer.getMatrix();
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
final Ray ray = new Ray();
final Object[] shapesS = shapes.toArray();
Arrays.sort(shapesS, (Comparator)shapeZAscComparator);
for(int i=shapesS.length-1; i>=0; i--) {
final UIShape uiShape = (UIShape)shapesS[i];
if( uiShape.isEnabled() ) {
pmv.glPushMatrix();
transformShape(pmv, uiShape);
final boolean ok = pmv.gluUnProjectRay(glWinX, glWinY, winZ0, winZ1, viewport, 0, ray);
pmv.glPopMatrix();
if( ok ) {
final AABBox sbox = uiShape.getBounds();
if( sbox.intersectsRay(ray) ) {
// System.err.printf("Pick.0: shape %d, [%d, %d, %f/%f] -> %s%n", i, glWinX, glWinY, winZ0, winZ1, ray);
if( null == sbox.getRayIntersection(objPos, ray, FloatUtil.EPSILON, true, dpyTmp1V3, dpyTmp2V3, dpyTmp3V3) ) {
throw new InternalError("Ray "+ray+", box "+sbox);
}
// System.err.printf("Pick.1: shape %d @ [%f, %f, %f], within %s%n", i, objPos[0], objPos[1], objPos[2], uiShape.getBounds());
return uiShape;
}
}
}
}
return null;
}
示例7: GPURendererListenerBase01
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
public GPURendererListenerBase01(final RegionRenderer renderer, final int renderModes, final boolean debug, final boolean trace) {
this.renderer = renderer;
this.renderModes = renderModes;
this.debug = debug;
this.trace = trace;
this.screenshot = new GLReadBufferUtil(false, false);
nearPlane1Box = new AABBox();
}
示例8: getStringBounds
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
@Override
public AABBox getStringBounds(CharSequence string, float pixelSize) {
if (string == null) {
return new AABBox();
}
final Metrics tmpMetrics = getMetrics();
final float lineGap = tmpMetrics.getLineGap(pixelSize);
final float ascent = tmpMetrics.getAscent(pixelSize);
final float descent = tmpMetrics.getDescent(pixelSize);
final float advanceY = lineGap - descent + ascent;
float totalHeight = 0;
float totalWidth = 0;
float curLineWidth = 0;
for (int i = 0; i < string.length(); i++) {
char character = string.charAt(i);
if (character == '\n') {
totalWidth = Math.max(curLineWidth, totalWidth);
curLineWidth = 0;
totalHeight -= advanceY;
continue;
}
Glyph glyph;
try {
glyph = getGlyph(character);
curLineWidth += glyph.getAdvance(pixelSize, true);
} catch (FontException e) {
logger.error(e.getMessage());
}
}
if (curLineWidth > 0) {
totalHeight -= advanceY;
totalWidth = Math.max(curLineWidth, totalWidth);
}
return new AABBox(0, 0, 0, totalWidth, totalHeight, 0);
}
示例9: TypecastGlyph
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
protected TypecastGlyph(Font font, char symbol, short id, AABBox bbox, int advance, Path2D path) {
this.font = font;
this.symbol = symbol;
this.advance = advance;
this.id = id;
this.advance = advance;
this.metrics = new Metrics(this.font, bbox, advance);
this.path = path;
this.pathSized = null;
this.numberSized = 0.0f;
}
示例10: getBBox
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
@Override
public AABBox getBBox(float pixelSize) {
final float size = getScale(pixelSize);
AABBox newBox = getBBox().clone();
newBox.scale(size);
return newBox;
}
示例11: TypecastHMetrics
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
public TypecastHMetrics(TypecastFont fontImpl) {
this.fontImpl = fontImpl;
headTable = this.fontImpl.getFont().getHeadTable();
hheaTable = this.fontImpl.getFont().getHheaTable();
// vheaTable = this.fontImpl.font.getVheaTable();
unitsPerEM_Inv = 1.0f / (headTable.getUnitsPerEm());
int maxWidth = headTable.getXMax() - headTable.getXMin();
int maxHeight = headTable.getYMax() - headTable.getYMin();
float lowx = headTable.getXMin();
float lowy = -(headTable.getYMin() + maxHeight);
float highx = lowx + maxWidth;
float highy = lowy + maxHeight;
bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert
}
示例12: OutlineShape
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
/**
* Create a new Outline based Shape
*/
public OutlineShape(Vertex.Factory<? extends Vertex> factory) {
this.vertexFactory = factory;
this.outlines = new ArrayList<Outline>(3);
this.outlines.add(new Outline());
this.outlineState = VerticesState.UNDEFINED;
this.bbox = new AABBox();
this.dirtyBits = 0;
}
示例13: UIShape
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
public UIShape(final Factory<? extends Vertex> factory, final int renderModes) {
this.vertexFactory = factory;
this.renderModes = renderModes;
this.box = new AABBox();
}
示例14: Label0
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
public Label0(final Font font, final String text, final float[] rgbaColor) {
this.font = font;
this.text = text;
this.rgbaColor = rgbaColor;
this.box = new AABBox();
}
示例15: addShapeToRegion
import com.jogamp.opengl.math.geom.AABBox; //导入依赖的package包/类
@Override
protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) {
final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory());
if(corner == 0.0f) {
createSharpOutline(shape, DEFAULT_2PASS_LABEL_ZOFFSET);
} else {
createCurvedOutline(shape, DEFAULT_2PASS_LABEL_ZOFFSET);
}
shape.setIsQuadraticNurbs();
shape.setSharpness(shapesSharpness);
region.addOutlineShape(shape, null, rgbaColor);
box.resize(shape.getBounds());
// Precompute text-box size .. guessing pixelSize
final float lPixelSize0 = 10f;
final float lw = width * ( 1f - spacingX ) ;
final float lh = height * ( 1f - spacingY ) ;
final AABBox lbox0 = label.font.getMetricBounds(label.text, lPixelSize0);
final float lsx = lw / lbox0.getWidth();
final float lsy = lh / lbox0.getHeight();
final float lPixelSize1 = lsx < lsy ? lPixelSize0 * lsx : lPixelSize0 * lsy;
if( DRAW_DEBUG_BOX ) {
System.err.println("RIButton: spacing "+spacingX+", "+spacingY);
System.err.println("RIButton: bbox "+box);
System.err.println("RIButton: lbox "+lbox0+", "+label.text);
System.err.println("RIButton: net-text "+lw+" x "+lh);
System.err.println("RIButton: lsx "+lsx+", lsy "+lsy+": pixelSize "+lPixelSize0+" -> "+lPixelSize1);
}
// Setting pixelSize based on actual text-box size
final AABBox lbox1 = label.font.getPointsBounds(null, label.text, lPixelSize1, tempT1, tempT2);
// Center text .. (share same center w/ button)
final float[] lctr = lbox1.getCenter();
final float[] ctr = box.getCenter();
final float[] ltx = new float[] { ctr[0] - lctr[0], ctr[1] - lctr[1], 0f };
final AABBox lbox2 = label.addShapeToRegion(lPixelSize1, region, tempT1.setToTranslation(ltx[0], ltx[1]));
if( DRAW_DEBUG_BOX ) {
System.err.printf("RIButton.0: lbox1 %s%n", lbox1);
System.err.printf("RIButton.0: lbox2 %s%n", lbox2);
}
setRotationOrigin( ctr[0], ctr[1], ctr[2]);
if( DRAW_DEBUG_BOX ) {
System.err.println("XXX.UIShape.RIButton: Added Shape: "+shape+", "+box);
}
}