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


Java BoundingBox类代码示例

本文整理汇总了Java中com.jme.bounding.BoundingBox的典型用法代码示例。如果您正苦于以下问题:Java BoundingBox类的具体用法?Java BoundingBox怎么用?Java BoundingBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BoundingBox类属于com.jme.bounding包,在下文中一共展示了BoundingBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scaleBounds

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
protected float scaleBounds(BoundingVolume bounds) {
    float radius = 1f;
    
    if (bounds instanceof BoundingBox) {
        BoundingBox bb = (BoundingBox) bounds;
        radius = Math.max(bb.xExtent, Math.max(bb.yExtent, bb.zExtent));
    } else if (bounds instanceof BoundingSphere) {
        radius = ((BoundingSphere) bounds).getRadius();
    }
    
    if (radius > MAX_RADIUS) {
        return MAX_RADIUS / radius;
    } else {
        return 1f;
    }
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:17,代码来源:JmeColladaLoader.java

示例2: getDefaultCellServerState

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
public <T extends CellServerState> T getDefaultCellServerState(
           Properties props) {
       // Create a setup with some default values
       ConeOfSilenceCellServerState cellServerState =
               new ConeOfSilenceCellServerState();

cellServerState.setName("ConeOfSilence");

       // Give the hint for the bounding volume for initial Cell placement
       BoundingBox box = new BoundingBox(new Vector3f(), 2f, 0f, 2f);
    
BoundingVolumeHint hint = new BoundingVolumeHint(true, box);
cellServerState.setBoundingVolumeHint(hint);

       return (T) cellServerState;
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:17,代码来源:ConeOfSilenceCellFactory.java

示例3: useCellBoundsRadioButtonActionPerformed

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
private void useCellBoundsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useCellBoundsRadioButtonActionPerformed
    
    useCellBounds = useCellBoundsRadioButton.isSelected();

    extentRadiusSpinner.setEnabled(useCellBounds == false);

    BoundingVolume bounds = editor.getCell().getLocalBounds();

    if (useCellBounds == true) {
	if (bounds instanceof BoundingBox) {
	    distanceAttenuatedRadioButton.setSelected(false);
	    distanceAttenuatedRadioButton.setEnabled(false);
	    ambientRadioButton.setSelected(true);
	}
    } else {
	distanceAttenuatedRadioButton.setEnabled(true);
    }

    if (editor != null) {
        editor.setPanelDirty(AudioTreatmentComponentProperties.class, isDirty());

	showBounds();
    }
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:25,代码来源:AudioTreatmentComponentProperties.java

示例4: showBounds

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
private void showBounds() {
if (boundsViewerEntity != null) {
    boundsViewerEntity.dispose();
    boundsViewerEntity = null;
}

if (showBoundsCheckBox.isSelected() == false) {
    return;
}

boundsViewerEntity = new BoundsViewerEntity(editor.getCell());

if (useCellBoundsRadioButton.isSelected()) {
    boundsViewerEntity.showBounds(editor.getCell().getLocalBounds());
} else if (specifyRadiusRadioButton.isSelected()) {
    boundsViewerEntity.showBounds(new BoundingSphere(
	(Float) fullVolumeRadiusModel.getValue(), new Vector3f()));
} else {
    boundsViewerEntity.showBounds(new BoundingBox(new Vector3f(), 
	(Float) xExtentModel.getValue(), 
	(Float) yExtentModel.getValue(), 
	(Float) zExtentModel.getValue()));
}
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:25,代码来源:ConeOfSilenceComponentProperties.java

示例5: getSpatializer

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
private Spatializer getSpatializer(BoundingBox bounds) {
BoundingBox boundingBox = (BoundingBox) bounds;

Vector3f center = boundingBox.getCenter();
Vector3f extent = boundingBox.getExtent(null);

double lowerLeftX = center.getX() - extent.getX();
       double lowerLeftY = center.getY() - extent.getY();
double lowerLeftZ = center.getZ() - extent.getZ();

double upperRightX = center.getX() + extent.getX();
       double upperRightY = center.getY() + extent.getY();
double upperRightZ = center.getZ() + extent.getZ();

return new AmbientSpatializer(lowerLeftX, lowerLeftY, lowerLeftZ,
    upperRightX, upperRightY, upperRightZ);
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:18,代码来源:AudioTreatmentComponentMO.java

示例6: getDefaultCellServerState

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
public <T extends CellServerState> T getDefaultCellServerState(
           Properties props) {
       // Create a setup with some default values
       PhoneCellServerState cellServerState = new PhoneCellServerState();

cellServerState.setName(BUNDLE.getString("Virtual_Phone"));

       cellServerState.setPhoneInfo(new PhoneInfo(false, "100", "foo",
               "Unknown location", .2, .1, true, true));

       /*
        * Try rotating 45 degrees to see what that does.
        */
       //Vector3f axis = new Vector3f((float) 1, (float) 0, (float) 0);
       //cellServerState.setRotation(new Rotation(axis, (float) Math.PI / 4));

BoundingBox box = new BoundingBox(
    new Vector3f(0, 0, 0), 0.27053905F, 0.060000006F, 0.27053908F);

BoundingVolumeHint hint = new BoundingVolumeHint(true, box);
cellServerState.setBoundingVolumeHint(hint);

       Logger.getLogger(PhoneCellFactory.class.getName()).warning(
               "New Virtual Phone!!!!");
       return (T) cellServerState;
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:27,代码来源:PhoneCellFactory.java

示例7: initializeTexture

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
/**
    * Initialize texture attributes.
    */
   private void initializeTexture () {

if (getRenderState(RenderState.RS_TEXTURE) == null) {
    TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
    ts.setTexture(texture);
    setRenderState(ts);
    setModelBound(new BoundingBox());
    updateModelBound();
}

       FloatBuffer tbuf = BufferUtils.createVector2Buffer(4);
       setTextureCoords(new TexCoords(tbuf));
tbuf.put(0).put(0);
tbuf.put(0).put(1);
tbuf.put(1).put(1);
tbuf.put(1).put(0);
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:21,代码来源:TexturedQuad.java

示例8: createSpace

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
private Space createSpace(int x, int y, int z) {
    
    Vector3f center = new Vector3f(((x) * SPACE_SIZE*2),
                                   ((y) * SPACE_SIZE*2),
                                   ((z) * SPACE_SIZE*2));
    BoundingBox gridBounds = new BoundingBox(center, 
                                             SPACE_SIZE, 
                                             SPACE_SIZE, 
                                             SPACE_SIZE);

    String bindingName = getSpaceBindingName(x, y, z);
    Space space = new Space(gridBounds, bindingName);
    synchronized(spaces) {
        spaces.put(bindingName, space);
    }
    
    return space;
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:19,代码来源:SpaceManagerGridImpl.java

示例9: getSetupBounds

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
/**
 * Given the JME BoundingVolume object, returns the bounds used in the cell
 * setup information.
 * 
 * @param bounds The JME bounds object
 * @return The PositionComponentServerState.Bounds object
 */
public static PositionComponentServerState.Bounds getSetupBounds(BoundingVolume bounds) {
    PositionComponentServerState.Bounds cellBounds = new PositionComponentServerState.Bounds();
    if (bounds instanceof BoundingSphere) {
        cellBounds.type = BoundsType.SPHERE;
        cellBounds.x = ((BoundingSphere)bounds).getRadius();
        return cellBounds;
    }
    else if (bounds instanceof BoundingBox) {
        cellBounds.type = BoundsType.BOX;
        Vector3f extent = new Vector3f();
        ((BoundingBox)bounds).getExtent(extent);
        cellBounds.x = extent.x;
        cellBounds.y = extent.y;
        cellBounds.z = extent.z;
        return cellBounds;
    }
    
    /* This should never happen, but in case it does... */
    throw new RuntimeException("Unsupported bounds type " + bounds.getClass().getName());
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:28,代码来源:PositionServerStateHelper.java

示例10: encloses

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
public static boolean encloses(BoundingVolume parent, BoundingVolume child) {
            
    if (parent instanceof BoundingBox) {
        if (child instanceof BoundingBox) {
            return encloses((BoundingBox)parent, (BoundingBox)child);
        } else if (child instanceof BoundingSphere) {
            return encloses((BoundingBox)parent, (BoundingSphere)child);
        }
    } else if (parent instanceof BoundingSphere) {
        if (child instanceof BoundingBox) {
             return encloses((BoundingSphere)parent, (BoundingBox)child);
        } else if (child instanceof BoundingSphere) {
            return encloses((BoundingSphere)parent, (BoundingSphere)child);
        }
    }

    throw new UnsupportedOperationException("Unsupported bounds combination "+parent.getClass().getName()+" "+child.getClass().getName());
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:19,代码来源:Math3DUtils.java

示例11: getNode

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
protected Node getNode(float scale) {
    try {
        ByteArrayInputStream ModelInputStream = new ByteArrayInputStream(BO.toByteArray());
        modelw = (Node) BinaryImporter.getInstance().load(ModelInputStream);
        modelw.setName("Model shape");

    } catch (IOException exc) {
        log.severe("Error in Thing::getNode()");
    }
    if (scale > 0) {
        modelw.setLocalScale(scale);
    }
    modelw = myLocalTransformations(modelw);

    modelw.setRenderState(ts);
    Node shapeNode = new Node("Shape Node");
    shapeNode.attachChild(modelw);
    boundingBox = new BoundingBox();
    shapeNode.setModelBound(boundingBox);
    shapeNode.updateModelBound();
    shapeNode.updateWorldBound();
    return (shapeNode);
}
 
开发者ID:CST-Group,项目名称:ws3d,代码行数:24,代码来源:Thing.java

示例12: getDimensions

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
public Vector3f getDimensions()
{
	BoundingVolume bound = this.getSpatial().getWorldBound() ;
	if (bound instanceof BoundingBox)
	{
		BoundingBox box = (BoundingBox)bound;
		this.getSpatial().updateWorldVectors();
		return (new Vector3f(box.xExtent * 2f,box.yExtent * 2f,box.zExtent * 2f));
	}else if (bound instanceof BoundingSphere)
	{
		BoundingSphere sphere = (BoundingSphere)bound;
		this.getSpatial().updateWorldVectors();
		return (new Vector3f(sphere.radius*2f,sphere.radius*2f,sphere.radius*2f));
	}
	StateManager.getLogger().log(Level.WARNING, "Missing Bounding Volume");
	return new Vector3f(1,1,1);
}
 
开发者ID:sambayless,项目名称:golems,代码行数:18,代码来源:SpatialModel.java

示例13: getWorldBound

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
public BoundingVolume getWorldBound() {
	if (getSpatial().getWorldBound() == null)
	{
		getSpatial().updateModelBound();
		getSpatial().updateWorldBound();
		
		if (getSpatial().getWorldBound() == null)
		{
			getSpatial().setModelBound(new BoundingBox());
			getSpatial().updateModelBound();
			getSpatial().updateWorldBound();
			if(getSpatial().getWorldBound() == null)
			{
				StateManager.getLogger().warning("Spatial has null bound!");
				BoundingBox c = new BoundingBox();
				c.setCenter(new Vector3f(100,100,100));
				return c;
			}
		
		}
		
		
	}
	return getSpatial().getWorldBound();
}
 
开发者ID:sambayless,项目名称:golems,代码行数:26,代码来源:SpatialModel.java

示例14: buildSpatial

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
@Override
protected Spatial buildSpatial() {
	
	toothNode = new Node();
	setLeftBox(new Box("", new Vector3f(), 0.5f,0.5f,0.5f));
	setRightBox(new Box("", new Vector3f(), 0.5f,0.5f,0.5f));
	setTopBox(new Box("", new Vector3f(), 0.5f,0.5f,0.5f));
	
	toothNode.attachChild(getLeftBox());
	getLeftBox().updateRenderState();
	toothNode.attachChild(getRightBox());
	getRightBox().updateRenderState();
	toothNode.attachChild(getTopBox());
	getTopBox().updateRenderState();
	toothNode.setModelBound(new BoundingBox());
	toothNode.updateModelBound();
	toothNode.updateRenderState();
	return toothNode;
}
 
开发者ID:sambayless,项目名称:golems,代码行数:20,代码来源:GearTooth.java

示例15: buildSpatial

import com.jme.bounding.BoundingBox; //导入依赖的package包/类
@Override
protected Spatial buildSpatial() {
	Vector3f[] vertices = new Vector3f[2];
	vertices[0] = new Vector3f(0,0,0);
	vertices[1] = new Vector3f(1,0,0);
	
	Vector3f[] normals = new Vector3f[]{Vector3f.UNIT_Y,Vector3f.UNIT_Y};

	Vector2f[] textureCoords = new Vector2f[2];
	textureCoords[0] = new Vector2f(0,0);
	textureCoords[1] = new Vector2f(1,1);
	
	ColorRGBA[] colors = null;// new ColorRGBA[]{startColor,endColor};
	line = new Line("Grapple Beam",vertices,normals, colors,textureCoords);
	line.setLineWidth(4f);
	line.setCullMode(SceneElement.CULL_NEVER);
	line.updateRenderState();
	
	line.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
	line.setLightCombineMode(LightState.OFF);
	line.setTextureCombineMode(TextureState.REPLACE);
	line.setModelBound(new BoundingBox());
	return line;
}
 
开发者ID:sambayless,项目名称:golems,代码行数:25,代码来源:LineModel.java


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