Package com.jme3.scene

Examples of com.jme3.scene.Spatial


     * @param holder must not be null, will be populated when returns
     */
    public void getAllTerrainPatches(List<TerrainPatch> holder) {
        if (children != null) {
            for (int i = children.size(); --i >= 0;) {
                Spatial child = children.get(i);
                if (child instanceof TerrainQuad) {
                    ((TerrainQuad) child).getAllTerrainPatches(holder);
                } else if (child instanceof TerrainPatch) {
                    holder.add((TerrainPatch)child);
                }
View Full Code Here


    }

    public void getAllTerrainPatchesWithTranslation(Map<TerrainPatch,Vector3f> holder, Vector3f translation) {
        if (children != null) {
            for (int i = children.size(); --i >= 0;) {
                Spatial child = children.get(i);
                if (child instanceof TerrainQuad) {
                    ((TerrainQuad) child).getAllTerrainPatchesWithTranslation(holder, translation.clone().add(child.getLocalTranslation()));
                } else if (child instanceof TerrainPatch) {
                    //if (holder.size() < 4)
                    holder.put((TerrainPatch)child, translation.clone().add(child.getLocalTranslation()));
                }
            }
        }
    }
View Full Code Here

     * its parent or if setParent(null) is called.
     */
    public void clearCaches() {
        if (children != null) {
            for (int i = children.size(); --i >= 0;) {
                Spatial child = children.get(i);
                if (child instanceof TerrainQuad) {
                    ((TerrainQuad) child).clearCaches();
                } else if (child instanceof TerrainPatch) {
                    ((TerrainPatch) child).clearCaches();
                }
View Full Code Here

        meshFile += ".xml";

        entityNode = new com.jme3.scene.Node(name);
        OgreMeshKey meshKey = new OgreMeshKey(meshFile, materialList);
        try {
            Spatial ogreMesh = assetManager.loadModel(meshKey);
            entityNode.attachChild(ogreMesh);
        } catch (AssetNotFoundException ex) {
            if (ex.getMessage().equals(meshFile)) {
                logger.log(Level.WARNING, "Cannot locate {0} for scene {1}", new Object[]{meshKey, key});
                // Attach placeholder asset.
                Spatial model = PlaceholderAssets.getPlaceholderModel(assetManager);
                model.setKey(key);
                entityNode.attachChild(model);
            } else {
                throw ex;
            }
        }
View Full Code Here

     * @param spatialOMA
     *            the OMA of the scene's node
     * @return <b>true</b> if the first given OMA points to a parent of the second one and <b>false</b> otherwise
     */
    public boolean isParent(Long supposedParentOMA, Long spatialOMA) {
        Spatial supposedParent = (Spatial) blenderContext.getLoadedFeature(supposedParentOMA, LoadedFeatureDataType.LOADED_FEATURE);
        Spatial spatial = (Spatial) blenderContext.getLoadedFeature(spatialOMA, LoadedFeatureDataType.LOADED_FEATURE);

        Spatial parent = spatial.getParent();
        while (parent != null) {
            if (parent.equals(supposedParent)) {
                return true;
            }
            parent = parent.getParent();
        }
        return false;
    }
View Full Code Here

        if(blenderContext.getBlenderKey().isFixUpAxis()) {
            // then make sure it is rotated in a proper way to fit the jme bone transformation conventions
            globalBoneMatrix.multLocal(BONE_ARMATURE_TRANSFORMATION_MATRIX);
        }

        Spatial armature = (Spatial) objectHelper.toObject(blenderContext.getFileBlock(armatureObjectOMA).getStructure(blenderContext), blenderContext);
        ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
        Matrix4f armatureWorldMatrix = constraintHelper.toMatrix(armature.getWorldTransform(), new Matrix4f());

        // and now compute the final bone matrix in world space
        globalBoneMatrix = armatureWorldMatrix.mult(globalBoneMatrix);

        // create the children
View Full Code Here

    Texture north = assetManager.loadTexture("skybox/milkyway/front.png");
    Texture south = assetManager.loadTexture("skybox/milkyway/back.png");
    Texture up = assetManager.loadTexture("skybox/milkyway/top.png");
    Texture down = assetManager.loadTexture("skybox/milkyway/bottom.png");

    Spatial skySpatial = SkyFactory.createSky(assetManager, west, east, north, south, up, down);

    return skySpatial;
  }
View Full Code Here

  public void addControlledObject(SpaceObject dataObject, boolean loadNow) {
  GlobalObjectStore.<IObjectController>getObject(IObjectController.class).addSpaceObject(createControlledObject(dataObject, loadNow), true);
  }

  public static Spatial createSimpleAsteroid(AssetManager assetManager) {
    Spatial asteroid = assetManager.loadModel("spaceobject/asteroid/dusty/Asteroid.mesh.xml");
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    asteroid.setMaterial(material);
    material.setTexture("ColorMap", assetManager.loadTexture("spaceobject/asteroid/dusty/asteroidtextur_512.jpg"));

    asteroid.setLocalTranslation(0f, 0f, 20f);

    return asteroid;
  }
View Full Code Here

/** Deprecated weil es aus der Sicht vom Cockpit nciht ben�tigt wird. Alles andere ist derzeit nicht implementiert. */
@Deprecated
public class Player extends Node {

  public Player(AssetManager assetManager) {
     Spatial hull = assetManager.loadModel("ship/glider/Hull.mesh.xml");
//    Spatial hull = assetManager.loadModel("ship/smallCarrier/Hull.mesh.xml");
     hull.scale(0.05f, 0.05f, 0.05f);

    Spatial kanzel = assetManager.loadModel("ship/glider/Kanzel.mesh.xml");
//    Spatial kanzel = assetManager.loadModel("ship/smallCarrier/Window.mesh.xml");
    kanzel.scale(0.05f, 0.05f, 0.05f);

//    Spatial cargo = assetManager.loadModel("ship/smallCarrier/Cargo.mesh.xml");
//    cargo.scale(0.05f, 0.05f, 0.05f);

//    Spatial wingGun = assetManager.loadModel("ship/smallCarrier/WingGun.mesh.xml");
View Full Code Here

    return 1/60f;
  }

  @Override
  public void simpleUpdate(float tpf, float time) {
    Spatial spatial = controlledSpaceObject.getSceneObject();

    // TODO: dirty flag
    // if(!controlledObject.spaceObject.isDirty())
    // return;

    spatial.setLocalRotation(controlledSpaceObject.dataObject.getRotation());
    spatial.setLocalTranslation(controlledSpaceObject.dataObject.getLocation());
   
    // TODO: Still needed: scale, transform, lodLevel, material / mesh updates

  }
View Full Code Here

TOP

Related Classes of com.jme3.scene.Spatial

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.