Package com.ardor3d.scenegraph

Examples of com.ardor3d.scenegraph.Spatial


        public void valueChanged(final TreeSelectionEvent e) {
            if (e.getNewLeadSelectionPath() == null || e.getNewLeadSelectionPath().getLastPathComponent() == null) {
                return;
            }

            final Spatial spatial = (Spatial) e.getNewLeadSelectionPath().getLastPathComponent();

            final StringBuilder str = new StringBuilder();

            str.append(spatial.getName());
            str.append(" - ");
            str.append(spatial.getClass().getName()).append('\n');

            if (spatial instanceof Mesh) {
                final Mesh mesh = (Mesh) spatial;
                str.append("Primitives: ");
                str.append(mesh.getMeshData().getTotalPrimitiveCount()).append('\n');
                str.append("Index mode: ");
                str.append(mesh.getMeshData().getIndexMode(0)).append('\n');
            }

            str.append(spatial.getTransform()).append('\n');
            if (spatial.getWorldBound() != null) {
                str.append(spatial.getWorldBound()).append('\n');
            }

            str.append('\n');
            final SceneHints sceneHints = spatial.getSceneHints();
            str.append("Cull hint: ");
            str.append(sceneHints.getCullHint()).append('\n');
            str.append("Bucket: ");
            str.append(sceneHints.getRenderBucketType()).append('\n');
View Full Code Here


            primeModel.setRenderState(cullState);

            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    // Add copy of model
                    final Spatial copy = primeModel.makeCopy(true);
                    copy.setTranslation(-i * 50, 0, -50 - (j * 50));
                    skNode.attachChild(copy);
                }
            }
        } catch (final Exception ex) {
            ex.printStackTrace();
View Full Code Here

        // process any instance geometries
        for (final Element instance_geometry : dNode.getChildren("instance_geometry")) {
            _colladaMaterialUtils.bindMaterials(instance_geometry.getChild("bind_material"));

            final Spatial mesh = _colladaMeshUtils.getGeometryMesh(instance_geometry);
            if (mesh != null) {
                node.attachChild(mesh);
            }

            _colladaMaterialUtils.unbindMaterials(instance_geometry.getChild("bind_material"));
View Full Code Here

                    + " (line number is referring morph)", morph);
        }

        final Element geometry = skinNode;

        final Spatial baseMesh = _colladaMeshUtils.buildMesh(geometry);

        // TODO: support morph animations someday.
        if (logger.isLoggable(Level.WARNING)) {
            logger.warning("Morph target animation not yet supported.");
        }
View Full Code Here

    @Override
    public ParticleSystem makeCopy(final boolean shareGeometricData) {
        synchronized (this) {
            // Do not call make copy on the "generated" particle geometry.
            final Spatial geom = getParticleGeometry();
            detachChild(geom);
            final ParticleSystem copy = (ParticleSystem) super.makeCopy(shareGeometricData);
            // Reattach
            attachChild(geom);
            return copy;
View Full Code Here

    @Override
    public void write(final OutputCapsule capsule) throws IOException {
        synchronized (this) {
            // Do not save the "generated" particle geometry.
            final Spatial geom = getParticleGeometry();
            detachChild(geom);
            super.write(capsule);
            // Reattach
            attachChild(geom);
        }
View Full Code Here

    private void updateReceiverBounds() {
        hasValidBounds = false;
        boolean firstRun = true;

        for (int i = 0, cSize = _boundsReceiver.size(); i < cSize; i++) {
            final Spatial child = _boundsReceiver.get(i);
            if (child != null && child.getWorldBound() != null && boundIsValid(child.getWorldBound())) {
                if (firstRun) {
                    _receiverBounds.setCenter(child.getWorldBound().getCenter());
                    _receiverBounds.setXExtent(0);
                    _receiverBounds.setYExtent(0);
                    _receiverBounds.setZExtent(0);
                    firstRun = false;
                }
                _receiverBounds.mergeLocal(child.getWorldBound());
                hasValidBounds = true;
            }
        }

        for (int i = 0, cSize = _spatials.size(); i < cSize; i++) {
            final Spatial child = _spatials.get(i);
            if (child != null && child.getWorldBound() != null && boundIsValid(child.getWorldBound())) {
                if (firstRun) {
                    _receiverBounds.setCenter(child.getWorldBound().getCenter());
                    _receiverBounds.setXExtent(0);
                    _receiverBounds.setYExtent(0);
                    _receiverBounds.setZExtent(0);
                    firstRun = false;
                }
                _receiverBounds.mergeLocal(child.getWorldBound());
                hasValidBounds = true;
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.ardor3d.scenegraph.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.