Package edu.cmu.cs.stage3.alice.core

Examples of edu.cmu.cs.stage3.alice.core.Model


            Transformable onWhatValue = onWhat.getTransformableValue();
            boolean success;
            if( onWhatValue!=null ) {
              edu.cmu.cs.stage3.alice.scenegraph.renderer.PickInfo pickInfo = RenderTarget.pick( mouseEvent );
              if( pickInfo.getCount()>0 ) {
                Model model = (Model)( pickInfo.getVisualAt( 0 ).getBonus() );
                success = onWhatValue == model || onWhatValue.isAncestorOf( model );
              } else {
                success = false;
              }
            } else {
View Full Code Here


        private ModelVisualization m_subject;
        private Model m_value;
    public void prologue( double t ) {
            m_subject = subject.getModelVisualizationValue();
            m_value = item.getModelValue();
            Model prev = m_subject.getItem();
            if( prev != null && prev != m_value ) {
                prev.visualization.set( null );
            }
            if( m_value != null ) {
View Full Code Here

  public Object getValue() {
    edu.cmu.cs.stage3.alice.scenegraph.renderer.PickInfo pickInfo = RenderTarget.pick( m_mouseEvent );
    if( pickInfo != null && pickInfo.getCount()>0 ) {
      Object o = pickInfo.getVisualAt( 0 ).getBonus();
      if( o instanceof Model  ) {
        Model part = (Model)o;
        if( ascend.booleanValue() ) {
          return ascend( part );
        } else {
          return part;
        }
View Full Code Here

    } else if( sgContainer instanceof edu.cmu.cs.stage3.alice.scenegraph.Transformable ) {
      edu.cmu.cs.stage3.alice.scenegraph.Transformable sgTransformable = (edu.cmu.cs.stage3.alice.scenegraph.Transformable)sgContainer;
      edu.cmu.cs.stage3.alice.scenegraph.Light sgLight = getFirstLightChild( sgTransformable );
      edu.cmu.cs.stage3.alice.scenegraph.Camera sgCamera = getFirstCameraChild( sgTransformable );
      edu.cmu.cs.stage3.alice.scenegraph.Visual sgVisual = getFirstVisualChild( sgTransformable );
      Model model = null;
      if( sgLight != null ) {
        Light light = null;
        if( sgLight instanceof edu.cmu.cs.stage3.alice.scenegraph.AmbientLight ) {
          AmbientLight ambientLight = new AmbientLight();
          light = ambientLight;
        } else if( sgLight instanceof edu.cmu.cs.stage3.alice.scenegraph.DirectionalLight ) {
          DirectionalLight directionalLight = new DirectionalLight();
          light = directionalLight;
        } else if( sgLight instanceof edu.cmu.cs.stage3.alice.scenegraph.PointLight ) {
          PointLight pointLight = null;
          if( sgLight instanceof edu.cmu.cs.stage3.alice.scenegraph.SpotLight ) {
            SpotLight spotLight = new SpotLight();
            pointLight = spotLight;
          } else {
            pointLight = new PointLight();
          }
          light = pointLight;
        }
        model = light;
        sgLight.setBonus( model );
      } else if( sgCamera != null ) {
        Camera camera = null;
        if( sgCamera instanceof edu.cmu.cs.stage3.alice.scenegraph.SymmetricPerspectiveCamera ) {
          SymmetricPerspectiveCamera symmetricPerspectiveCamera = new SymmetricPerspectiveCamera();
          camera = symmetricPerspectiveCamera;
        } else if( sgCamera instanceof edu.cmu.cs.stage3.alice.scenegraph.PerspectiveCamera ) {
          PerspectiveCamera perspectiveCamera = new PerspectiveCamera();
          camera = perspectiveCamera;
        } else if( sgCamera instanceof edu.cmu.cs.stage3.alice.scenegraph.OrthographicCamera ) {
          OrthographicCamera orthographicCamera = new OrthographicCamera();
          camera = orthographicCamera;
        } else if( sgCamera instanceof edu.cmu.cs.stage3.alice.scenegraph.ProjectionCamera ) {
          ProjectionCamera projectionCamera = new ProjectionCamera();
          camera = projectionCamera;
        }
        model = camera;
        sgCamera.setBonus( model );
      } else {
        model = new Model();
      }
      if( sgVisual != null ) {
        sgVisual.setBonus( model );
        edu.cmu.cs.stage3.alice.scenegraph.Appearance sgAppearance = sgVisual.getFrontFacingAppearance();
        edu.cmu.cs.stage3.alice.scenegraph.Geometry sgGeometry = sgVisual.getGeometry();
        if( sgAppearance != null ) {
          edu.cmu.cs.stage3.alice.scenegraph.TextureMap sgTextureMap = sgAppearance.getDiffuseColorMap();
          if( sgTextureMap != null ) {
            TextureMap diffuseColorMap = new TextureMap();
            diffuseColorMap.setParent( model );
            diffuseColorMap.image.set( sgTextureMap.getImage() );
            diffuseColorMap.format.set( new Integer( sgTextureMap.getFormat() ) );
            model.diffuseColorMap.set( diffuseColorMap );
            model.textureMaps.add( diffuseColorMap );
          }
          model.color.set( sgAppearance.getDiffuseColor() );
          model.opacity.set( new Double( sgAppearance.getOpacity() ) );
        }
        if( sgGeometry instanceof edu.cmu.cs.stage3.alice.scenegraph.IndexedTriangleArray ) {
          edu.cmu.cs.stage3.alice.scenegraph.IndexedTriangleArray sgITA = (edu.cmu.cs.stage3.alice.scenegraph.IndexedTriangleArray)sgGeometry;
          IndexedTriangleArray ita = new IndexedTriangleArray();
          ita.setParent( model );
          ita.vertices.set( sgITA.getVertices() );
          ita.indices.set( sgITA.getIndices() );
          model.geometry.set( ita );
          model.geometries.add( ita );
        }
      }
      model.setLocalTransformationRightNow( sgTransformable.getLocalTransformation() );
      element = model;
    }
    for( int i=0; i<sgContainer.getChildCount(); i++ ) {
      edu.cmu.cs.stage3.alice.scenegraph.Component sgChild = sgContainer.getChildAt( i );
      if( sgChild instanceof edu.cmu.cs.stage3.alice.scenegraph.Transformable ) {
        Model child = (Model)internalConvert( (edu.cmu.cs.stage3.alice.scenegraph.Transformable)sgChild, i );
        child.setParent( element );
        child.vehicle.set( element );
        if( child.name.getStringValue() == null ) {
          child.name.set( "yet to be named part " + i );
        }
        if( element instanceof World ) {
View Full Code Here

        Transformable onWhatValue = onWhat.getTransformableValue();
        boolean success;
        if( onWhatValue!=null ) {
          edu.cmu.cs.stage3.alice.scenegraph.renderer.PickInfo pickInfo = RenderTarget.pick( mouseEvent );
          if( pickInfo.getCount()>0 ) {
            Model model = (Model)( pickInfo.getVisualAt( 0 ).getBonus() );
            success = onWhatValue == model || onWhatValue.isAncestorOf( model );
          } else {
            success = false;
          }
        } else {
View Full Code Here

       
        double moveAmount = 0.0;
       
        edu.cmu.cs.stage3.alice.core.Element[] legs = m_subject.search(new edu.cmu.cs.stage3.alice.core.criterion.ElementNameContainsCriterion("UpperLeg"));
        if (legs.length > 0) {
          Model upperLeg = (Model)legs[0];
          moveAmount = upperLeg.getBoundingBox(upperLeg).getHeight();
        }
        /*if (BetterStandUpAnimation.this.moveAmount != null) {
          moveAmount = BetterStandUpAnimation.this.moveAmount.doubleValue();
        }*/
        if (scootForward.booleanValue() == true) {
View Full Code Here

    }

    public Model buildBone(ASFBone parent, boolean length_geometry) {
        if (parent!=null) {
            base_position = parent.endPoint;
            model = new Model();
            model.isFirstClass.set(false);
            parent.model.addChild(model);
            parent.model.parts.add(model);
            //model.addToParent(parent.model);
            model.vehicle.set(parent.model);
        } else {
            model = new Model();
            model.isFirstClass.set(true);
            model.vehicle.set(scene);
        }
        this.parent = parent;

        model.setOrientationRightNow(base_axis,scene);
        model.setPositionRightNow(base_position,(ReferenceFrame)scene);

        base_axis = model.getOrientationAsAxes();
        base_position = model.getPosition();

        IndexedTriangleArray geom = buildBoneGeometry(.04,.04);
        model.addChild(geom);
        model.geometry.set(geom);
        model.name.set(name);

        if (parent!=null) {
            endPoint = MathUtilities.multiply(direction,length/direction.length());
            endPoint.add(parent.endPoint);
        } else
            endPoint = new javax.vecmath.Vector3d(0,0,0);

        if (length_geometry && length!=0.0 && parent!=null) {
            //model.isShowing.set(false,edu.cmu.cs.stage3.util.HowMuch.INSTANCE);

            Model unit_cube = new Model();
            geom = buildBoneGeometry(.04,length);//buildUnitCube();
            unit_cube.addChild(geom);
            unit_cube.geometry.set(geom);
            unit_cube.isFirstClass.set(false);
            unit_cube.name.set(model.name.getStringValue().concat("_bone"));
            model.addChild(unit_cube);
            model.parts.add(unit_cube);
            //unit_cube.addToParent(model);
            unit_cube.vehicle.set(model);
            if (direction.x==0.0 && direction.z==0.0)
                unit_cube.setOrientationRightNow(direction,new javax.vecmath.Vector3d(0,0,-1),(ReferenceFrame)scene);
            else
                unit_cube.setOrientationRightNow(direction,new javax.vecmath.Vector3d(0,1,0),(ReferenceFrame)scene);
        }

        ASFBone child;
        ListIterator li;
        li = children.listIterator();

        while(li.hasNext()) {
            child = (ASFBone)li.next();

            Model child_piece = child.buildBone(this);
        }
        return model;
    }
View Full Code Here

        li = children.listIterator();

        while(li.hasNext()) {
            child = (ASFBone)li.next();

            Model part = (edu.cmu.cs.stage3.alice.core.Model)mod.getChildNamed(child.name);
            /*Element[] parts = mod.search(new ElementNamedCriterion(child.name));
            if (parts.length==1) {
                part = (Model)parts[0];
            } else {
            */
 
View Full Code Here

      modelWrapper.registerItemChooserWithAlt(this);
    }
  }

  private Model reloadModel(String modelString) {
    Model part = null;
    try {
      part = (Model) Model.load(PersonBuilder.class.getResource(modelString), new Model());
    } catch (java.io.IOException ioe) {
      ioe.printStackTrace();
    } catch (edu.cmu.cs.stage3.alice.core.UnresolvablePropertyReferencesException upre) {
      upre.printStackTrace();
    }
View Full Code Here

          modelWrapper.addTexture(currentInfo.texture, currentInfo.level);
          if (currentInfo.altModelName != null) {
            modelWrapper.switchToAltModel(currentInfo.altModelName);
          }
        } else if (currentInfo.id.equals("setModel")) {
          Model modelCopy = (Model) currentInfo.modelFactory.manufactureCopy(null);
          modelWrapper.setModel(modelCopy, currentInfo.parentString);
        } else if (currentInfo.id.equals("addModelAndTexture")) {
          // add texture
          modelWrapper.addTexture(currentInfo.texture, currentInfo.level);

          // add model
          Model modelCopy = (Model) currentInfo.modelFactory.manufactureCopy(null);
          edu.cmu.cs.stage3.math.Vector3 position = new edu.cmu.cs.stage3.math.Vector3(currentInfo.x, currentInfo.y, currentInfo.z);
          modelWrapper.addModel(modelCopy, currentInfo.parentString, position);

          // switch to alternate model if necessary
          if (currentInfo.altModelName != null) {
            modelWrapper.switchToAltModel(currentInfo.altModelName);
          }
        } else if (currentInfo.id.equals("setMultipleModelsAndTexture")) {
          // swap models
          Model modelCopy = (Model) currentInfo.modelFactory.manufactureCopy(null);
          modelWrapper.setModel(modelCopy, currentInfo.parentString);

          modelCopy = (Model) currentInfo.altModelFactory.manufactureCopy(null);
          modelWrapper.setModel(modelCopy, currentInfo.altParentString);
View Full Code Here

TOP

Related Classes of edu.cmu.cs.stage3.alice.core.Model

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.