当前位置: 首页>>代码示例>>Java>>正文


Java AABBox.getWidth方法代码示例

本文整理汇总了Java中com.jogamp.opengl.math.geom.AABBox.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java AABBox.getWidth方法的具体用法?Java AABBox.getWidth怎么用?Java AABBox.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.opengl.math.geom.AABBox的用法示例。


在下文中一共展示了AABBox.getWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:18,代码来源:UIShape.java

示例2: 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);
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:49,代码来源:LabelButton.java


注:本文中的com.jogamp.opengl.math.geom.AABBox.getWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。