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


Java BoundingSphere类代码示例

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


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

示例1: scaleBounds

import com.jme.bounding.BoundingSphere; //导入依赖的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: createTube

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
/**
* Creates the tube used for the rotation affordance, given its name, its
* outer and inner radius, its thickness, and its color. Returns the Node
* representing the geometry.
*/
private Node createTube(String name, float outerRadius, float innerRadius,
        float thickness, ColorRGBA color) {

    // Create the disc with the name, radii, and thickness given. Set
    // the color of the tube.
    Tube t = new Tube(name, outerRadius, innerRadius, thickness, 50, 50);
    t.setSolidColor(color);

    // Create the main node and set the material state on the node so the
    // color shows up. Attach the tube to the node.
    Node n = new Node();
    RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
    MaterialState matState3 = (MaterialState)
            rm.createRendererState(RenderState.StateType.Material);
    matState3.setDiffuse(color);
    n.setRenderState(matState3);
    n.attachChild(t);

    // Set the bound on the tube and update it
    t.setModelBound(new BoundingSphere());
    t.updateModelBound();
    return n;
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:29,代码来源:RotateAffordance.java

示例3: showBounds

import com.jme.bounding.BoundingSphere; //导入依赖的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 {
    boundsViewerEntity.showBounds(
	new BoundingSphere((Float) extentRadiusSpinner.getValue(), new Vector3f()));
} 
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:20,代码来源:AudioTreatmentComponentProperties.java

示例4: showBounds

import com.jme.bounding.BoundingSphere; //导入依赖的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: addProximityListener

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
private void addProximityListener(Treatment treatment) {
       // Fetch the proximity component, we will need this below. If it does
       // not exist (it should), then log an error
       removeProximityListener();
       ProximityComponentMO component = cellRef.get().getComponent(ProximityComponentMO.class);

       if (component == null) {
           logger.warning("The AudioTreatment Component does not have a " +
                   "Proximity Component for Cell ID " + cellID);
           return;
       }

       // We are making this component live, add a listener to the proximity component.
BoundingVolume[] bounds = new BoundingVolume[1];

       BoundingVolume bs = new BoundingSphere((float) (extent*1.1) , new Vector3f());
       
       bounds[0] = bs;

       AudioTreatmentProximityListener proximityListener = 
    new AudioTreatmentProximityListener(cellRef, treatment);

this.proximityListener = AppContext.getDataManager().createReference(proximityListener);

       component.addProximityListener(proximityListener, bounds);
   }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:27,代码来源:AudioTreatmentComponentMO.java

示例6: attachOuterOrb

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
private void attachOuterOrb(Entity entity) {
    final Sphere outerOrb = new Sphere("Outer Orb", 16, 16, OUTER_RADIUS);
    outerOrb.setModelBound(new BoundingSphere());
    outerOrb.updateModelBound();
    ColorRGBA orbColour = new ColorRGBA(0f, 0f, 1f, 0.2f);
    MaterialState matState = (MaterialState) ClientContextJME.getWorldManager().getRenderManager().createRendererState(StateType.Material);
    matState.setDiffuse(orbColour);
    outerOrb.setRenderState(matState);

    BlendState bs = (BlendState) ClientContextJME.getWorldManager().getRenderManager().createRendererState(StateType.Blend);
    bs.setEnabled(true);
    bs.setBlendEnabled(true);
    bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
    bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
    outerOrb.setRenderState(bs);

    CullState cs = (CullState) ClientContextJME.getWorldManager().getRenderManager().createRendererState(StateType.Cull);
    cs.setEnabled(true);
    cs.setCullFace(CullState.Face.Back);
    outerOrb.setRenderState(cs);

   	orbNode.attachChild(outerOrb);
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:24,代码来源:OrbCellRenderer.java

示例7: getSetupBounds

import com.jme.bounding.BoundingSphere; //导入依赖的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

示例8: encloses

import com.jme.bounding.BoundingSphere; //导入依赖的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

示例9: AxleControlPoint

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
public AxleControlPoint(AxlePosition type, boolean controlLeft) {
	super();
	this.controlLeft = controlLeft;
	this.type = type;
	controlSphere = new Sphere("ControlSphere", new Vector3f(), 6, 6, radius);
	controlSphere.setCullMode(SceneElement.CULL_ALWAYS);
	facadeSphere = new SharedMesh("ControlSphereFacade",baseSphere);
	facadeSphere.setIsCollidable(false);
	
	
	this.visualNode.getNode().attachChild(controlSphere);
	this.visualNode.getNode().attachChild(facadeSphere);
	//tie these together
	facadeSphere.setLocalRotation(controlSphere.getLocalRotation());
	facadeSphere.setLocalScale(controlSphere.getLocalScale());
	facadeSphere.setLocalTranslation(controlSphere.getLocalTranslation());
	this.visualNode.getSpatial().updateGeometricState(0, true);
	this.visualNode.getSpatial().updateRenderState();		
	this.visualNode.getSpatial().setModelBound(new BoundingSphere());
	this.visualNode.getSpatial().updateModelBound();
	this.visualNode.getSpatial().updateWorldBound();
	
	orientation = new OrientationInfo();

}
 
开发者ID:sambayless,项目名称:golems,代码行数:26,代码来源:AxleControlPoint.java

示例10: CapsuleControlPoint

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
public CapsuleControlPoint(CapsulePosition type) {
	super();
	
	this.type = type;
	controlSphere = new Sphere("ControlSphere", new Vector3f(), 6, 6, radius);
	controlSphere.setCullMode(SceneElement.CULL_ALWAYS);
	facadeSphere = new SharedMesh("ControlSphereFacade",baseSphere);
	facadeSphere.setIsCollidable(false);
	
	
	this.visualNode.getNode().attachChild(controlSphere);
	this.visualNode.getNode().attachChild(facadeSphere);
	//tie these together
	facadeSphere.setLocalRotation(controlSphere.getLocalRotation());
	facadeSphere.setLocalScale(controlSphere.getLocalScale());
	facadeSphere.setLocalTranslation(controlSphere.getLocalTranslation());
	this.visualNode.getSpatial().updateGeometricState(0, true);
	this.visualNode.getSpatial().updateRenderState();		
	this.visualNode.getSpatial().setModelBound(new BoundingSphere());
	this.visualNode.getSpatial().updateModelBound();
	this.visualNode.getSpatial().updateWorldBound();
}
 
开发者ID:sambayless,项目名称:golems,代码行数:23,代码来源:CapsuleControlPoint.java

示例11: CylinderControlPoint

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
public CylinderControlPoint(CylinderPoint point) 
{
	super();
	this.point = point;
	controlSphere = new SharedMesh("ControlSphereCollision",baseCollisionSphere);
	controlSphere.setCullMode(SceneElement.CULL_ALWAYS);
	facadeSphere = new SharedMesh("ControlSphereFacade",baseSphere);
	facadeSphere.setIsCollidable(false);
	
	this.visualNode.getNode().attachChild(controlSphere);
	this.visualNode.getNode().attachChild(facadeSphere);
	//tie these together
	facadeSphere.setLocalRotation(controlSphere.getLocalRotation());
	facadeSphere.setLocalScale(controlSphere.getLocalScale());
	facadeSphere.setLocalTranslation(controlSphere.getLocalTranslation());
	this.visualNode.getSpatial().updateGeometricState(0, true);
	this.visualNode.getSpatial().updateRenderState();		
	this.visualNode.getSpatial().setModelBound(new BoundingSphere());
	this.visualNode.getSpatial().updateModelBound();
	this.visualNode.getSpatial().updateWorldBound();
	this.orientation = new OrientationInfo();

}
 
开发者ID:sambayless,项目名称:golems,代码行数:24,代码来源:CylinderControlPoint.java

示例12: AxleMVCControlPoint

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
public AxleMVCControlPoint(AxlePosition type) {
	super();
	
	this.type = type;
	controlSphere = new Sphere("ControlSphere", new Vector3f(), 6, 6, radius);
	controlSphere.setCullMode(SceneElement.CULL_ALWAYS);
	facadeSphere = new SharedMesh("ControlSphereFacade",baseSphere);
	facadeSphere.setIsCollidable(false);
	
	
	this.visualNode.getNode().attachChild(controlSphere);
	this.visualNode.getNode().attachChild(facadeSphere);
	//tie these together
	facadeSphere.setLocalRotation(controlSphere.getLocalRotation());
	facadeSphere.setLocalScale(controlSphere.getLocalScale());
	facadeSphere.setLocalTranslation(controlSphere.getLocalTranslation());
	this.visualNode.getSpatial().updateGeometricState(0, true);
	this.visualNode.getSpatial().updateRenderState();		
	this.visualNode.getSpatial().setModelBound(new BoundingSphere());
	this.visualNode.getSpatial().updateModelBound();
	this.visualNode.getSpatial().updateWorldBound();
}
 
开发者ID:sambayless,项目名称:golems,代码行数:23,代码来源:AxleMVCControlPoint.java

示例13: TubeControlPoint

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
public TubeControlPoint(TubePoint point) 
{
	super();
	this.point = point;
	controlSphere = new SharedMesh("ControlSphereCollision",baseCollisionSphere);
	controlSphere.setCullMode(SceneElement.CULL_ALWAYS);
	facadeSphere = new SharedMesh("ControlSphereFacade",baseSphere);
	facadeSphere.setIsCollidable(false);
	
	this.visualNode.getNode().attachChild(controlSphere);
	this.visualNode.getNode().attachChild(facadeSphere);
	//tie these together
	facadeSphere.setLocalRotation(controlSphere.getLocalRotation());
	facadeSphere.setLocalScale(controlSphere.getLocalScale());
	facadeSphere.setLocalTranslation(controlSphere.getLocalTranslation());
	this.visualNode.getSpatial().updateGeometricState(0, true);
	this.visualNode.getSpatial().updateRenderState();		
	this.visualNode.getSpatial().setModelBound(new BoundingSphere());
	this.visualNode.getSpatial().updateModelBound();
	this.visualNode.getSpatial().updateWorldBound();
	this.orientation = new OrientationInfo();

}
 
开发者ID:sambayless,项目名称:golems,代码行数:24,代码来源:TubeControlPoint.java

示例14: SphereControlPoint

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
public SphereControlPoint(SpherePoint point) 
{
	super();
	this.point = point;
	controlSphere = new SharedMesh("ControlSphereCollision",baseCollisionSphere);
	controlSphere.setCullMode(SceneElement.CULL_ALWAYS);
	facadeSphere = new SharedMesh("ControlSphereFacade",baseSphere);
	facadeSphere.setIsCollidable(false);
	
	this.visualNode.getNode().attachChild(controlSphere);
	this.visualNode.getNode().attachChild(facadeSphere);
	//tie these together
	facadeSphere.setLocalRotation(controlSphere.getLocalRotation());
	facadeSphere.setLocalScale(controlSphere.getLocalScale());
	facadeSphere.setLocalTranslation(controlSphere.getLocalTranslation());
	this.visualNode.getSpatial().updateGeometricState(0, true);
	this.visualNode.getSpatial().updateRenderState();		
	this.visualNode.getSpatial().setModelBound(new BoundingSphere());
	this.visualNode.getSpatial().updateModelBound();
	this.visualNode.getSpatial().updateWorldBound();
	this.orientation = new OrientationInfo();
}
 
开发者ID:sambayless,项目名称:golems,代码行数:23,代码来源:SphereControlPoint.java

示例15: CubeControlPoint

import com.jme.bounding.BoundingSphere; //导入依赖的package包/类
public CubeControlPoint(CubePoint point) 
{
	super();
	this.point = point;

	controlSphere = new SharedMesh("ControlSphereCollision",baseCollisionSphere);
	controlSphere.setCullMode(SceneElement.CULL_ALWAYS);
	facadeSphere = new SharedMesh("ControlSphereFacade",baseSphere);
	facadeSphere.setIsCollidable(false);
	
	this.visualNode.getNode().attachChild(controlSphere);
	this.visualNode.getNode().attachChild(facadeSphere);
	//tie these together
	facadeSphere.setLocalRotation(controlSphere.getLocalRotation());
	facadeSphere.setLocalScale(controlSphere.getLocalScale());
	facadeSphere.setLocalTranslation(controlSphere.getLocalTranslation());
	this.visualNode.getSpatial().updateGeometricState(0, true);
	this.visualNode.getSpatial().updateRenderState();		
	this.visualNode.getSpatial().setModelBound(new BoundingSphere());
	this.visualNode.getSpatial().updateModelBound();
	this.visualNode.getSpatial().updateWorldBound();
	
	orientation = new OrientationInfo();
}
 
开发者ID:sambayless,项目名称:golems,代码行数:25,代码来源:CubeControlPoint.java


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