コード例 #1
0
  private Texture loadTexture2D(final String path, final Texture.MinificationFilter minFilter) {
    if (_dataCache.containsTexture(path)) {
      return _dataCache.getTexture(path);
    }

    final Texture texture;
    if (_textureLocator == null) {
      texture =
          TextureManager.load(
              path,
              minFilter,
              _compressTextures
                  ? TextureStoreFormat.GuessCompressedFormat
                  : TextureStoreFormat.GuessNoCompressedFormat,
              true);
    } else {
      final ResourceSource source = _textureLocator.locateResource(path);
      texture =
          TextureManager.load(
              source,
              minFilter,
              _compressTextures
                  ? TextureStoreFormat.GuessCompressedFormat
                  : TextureStoreFormat.GuessNoCompressedFormat,
              true);
    }
    _dataCache.addTexture(path, texture);

    return texture;
  }
コード例 #2
0
ファイル: InteractExample.java プロジェクト: gouessej/Ardor3D
  private void addObjects() {
    final Box box1 = new Box("box", Vector3.ZERO, 5, 15, 5);
    box1.setTranslation(0, box1.getYExtent(), 0);
    TextureState ts = new TextureState();
    ts.setTexture(
        TextureManager.load("images/skybox/1.jpg", Texture.MinificationFilter.Trilinear, true));
    box1.setRenderState(ts);
    box1.getSceneHints().setPickingHint(PickingHint.Pickable, true);
    box1.setModelBound(new BoundingBox());

    final Node base = new Node();
    base.setTranslation(0, 0, 0);
    base.attachChild(box1);
    _root.attachChild(base);

    final Sphere sphere = new Sphere("sphere", Vector3.ZERO, 16, 16, 8);
    ts = new TextureState();
    ts.setTexture(
        TextureManager.load(
            "images/water/dudvmap.png", Texture.MinificationFilter.Trilinear, true));
    sphere.setRenderState(ts);
    sphere.getSceneHints().setPickingHint(PickingHint.Pickable, true);
    sphere.setModelBound(new BoundingSphere());

    final Node joint = new Node();
    joint.setTranslation(0, sphere.getRadius() + 2 * box1.getYExtent(), 0);
    joint.attachChild(sphere);
    base.attachChild(joint);

    final Box box2 = new Box("box", Vector3.ZERO, 5, 15, 5);
    box2.setTranslation(0, box2.getYExtent(), 0);
    ts = new TextureState();
    ts.setTexture(
        TextureManager.load("images/skybox/3.jpg", Texture.MinificationFilter.Trilinear, true));
    box2.setRenderState(ts);
    box2.getSceneHints().setPickingHint(PickingHint.Pickable, true);
    box2.setModelBound(new BoundingBox());

    final Node arm = new Node();
    arm.setTranslation(0, sphere.getRadius(), 0);
    arm.attachChild(box2);
    joint.attachChild(arm);

    // auto select the joint
    _root.updateGeometricState(0);
    manager.setSpatialTarget(joint);
  }
コード例 #3
0
  @Override
  protected void initExample() {
    _canvas.setTitle("Degenerate vs MultiStrip Example");

    t = BasicText.createDefaultTextLabel("Text", "[SPACE] MultiStrip Mesh");
    t.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
    t.getSceneHints().setLightCombineMode(LightCombineMode.Off);
    t.setTranslation(new Vector3(0, 20, 0));
    _root.attachChild(t);

    final TextureState ts = new TextureState();
    ts.setEnabled(true);
    ts.setTexture(
        TextureManager.load(
            "images/ardor3d_white_256.jpg",
            Texture.MinificationFilter.Trilinear,
            TextureStoreFormat.GuessCompressedFormat,
            true));

    final double maxSize = Math.max(xSize, ySize);
    final double requiredDistance =
        (maxSize / 2)
            / Math.tan(
                _canvas.getCanvasRenderer().getCamera().getFovY() * MathUtils.DEG_TO_RAD * 0.5);

    final Mesh multiStripMesh = createMultiStripMesh();
    multiStripMesh.setRenderState(ts);
    multiStripMesh.updateModelBound();
    multiStripMesh.setTranslation(-xSize * 0.5, -ySize * 0.5, -requiredDistance);
    _root.attachChild(multiStripMesh);

    final Mesh degenerateStripMesh = createDegenerateStripMesh();
    degenerateStripMesh.setRenderState(ts);
    degenerateStripMesh.updateModelBound();
    degenerateStripMesh.setTranslation(-xSize * 0.5, -ySize * 0.5, -requiredDistance);
    _root.attachChild(degenerateStripMesh);

    degenerateStripMesh.getSceneHints().setCullHint(CullHint.Always);

    _logicalLayer.registerTrigger(
        new InputTrigger(
            new KeyPressedCondition(Key.SPACE),
            new TriggerAction() {
              public void perform(
                  final Canvas source, final TwoInputStates inputStates, final double tpf) {
                showDegenerateMesh = !showDegenerateMesh;
                if (showDegenerateMesh) {
                  t.setText("[SPACE] Degenerate Mesh");
                  multiStripMesh.getSceneHints().setCullHint(CullHint.Always);
                  degenerateStripMesh.getSceneHints().setCullHint(CullHint.Inherit);
                } else {
                  t.setText("[SPACE] MultiStrip Mesh");
                  multiStripMesh.getSceneHints().setCullHint(CullHint.Inherit);
                  degenerateStripMesh.getSceneHints().setCullHint(CullHint.Always);
                }
              }
            }));
  }
コード例 #4
0
ファイル: InteractExample.java プロジェクト: gouessej/Ardor3D
 private void addFloor() {
   final Box floor = new Box("floor", Vector3.ZERO, 100, 5, 100);
   floor.setTranslation(0, -5, 0);
   final TextureState ts = new TextureState();
   ts.setTexture(
       TextureManager.load("models/obj/pitcher.jpg", Texture.MinificationFilter.Trilinear, true));
   floor.setRenderState(ts);
   floor.getSceneHints().setPickingHint(PickingHint.Pickable, false);
   floor.setModelBound(new BoundingBox());
   _root.attachChild(floor);
 }
コード例 #5
0
  @Override
  protected void initWindow() {
    _canvas.setTitle("Shapes Example");

    wrapCount = 5;
    addMesh(new Arrow("Arrow", 3, 1));
    addMesh(new AxisRods("AxisRods", true, 3, 0.5));
    addMesh(new Box("Box", new Vector3(), 3, 3, 3));
    addMesh(new Capsule("Capsule", 5, 5, 5, 2, 5));
    addMesh(new Cone("Cone", 8, 8, 2, 4));
    addMesh(new Cylinder("Cylinder", 8, 8, 2, 4));
    addMesh(new Disk("Disk", 8, 8, 3));
    addMesh(new Dodecahedron("Dodecahedron", 3));
    addMesh(new Dome("Dome", 8, 8, 3));
    addMesh(new Hexagon("Hexagon", 3));
    addMesh(new Icosahedron("Icosahedron", 3));
    addMesh(new MultiFaceBox("MultiFaceBox", new Vector3(), 3, 3, 3));
    addMesh(new Octahedron("Octahedron", 3));
    addMesh(new PQTorus("PQTorus", 5, 4, 1.5, .5, 128, 8));
    addMesh(new Pyramid("Pyramid", 2, 4));
    addMesh(new Quad("Quad", 3, 3));
    addMesh(new RoundedBox("RoundedBox", new Vector3(3, 3, 3)));
    addMesh(new Sphere("Sphere", 16, 16, 3));
    addMesh(new GeoSphere("GeoSphere", true, 3, 3, TextureMode.Original));
    addMesh(new StripBox("StripBox", new Vector3(), 3, 3, 3));
    addMesh(new Teapot("Teapot"));
    addMesh(new Torus("Torus", 16, 8, 1.0, 2.5));
    addMesh(new Tube("Tube", 2, 3, 4));
    addMesh(createLines());

    final TextureState ts = new TextureState();
    ts.setTexture(
        TextureManager.load(
            "images/ardor3d_white_256.jpg",
            Texture.MinificationFilter.Trilinear,
            Format.Guess,
            true));
    _root.setRenderState(ts);

    final BlendState bs = new BlendState();
    bs.setBlendEnabled(true);
    _root.setRenderState(bs);

    // Set up a reusable pick results
    _pickResults = new PrimitivePickResults();
    _pickResults.setCheckDistance(true);

    // Set up our pick label
    _text = BasicText.createDefaultTextLabel("", "pick");
    _text.setTranslation(10, 10, 0);
    _text.getSceneHints().setCullHint(CullHint.Always);
    _root.attachChild(_text);
  }
コード例 #6
0
ファイル: BasicText.java プロジェクト: stepheneb/ardor3dv1
 /**
  * Creates the texture state if not created before.
  *
  * @return texture state for the default font
  */
 public static TextureState getDefaultFontTextureState() {
   if (defaultFontTextureState == null) {
     defaultFontTextureState = new TextureState();
     final URL defaultUrl = BasicText.class.getClassLoader().getResource(DEFAULT_FONT);
     if (defaultUrl == null) {
       logger.warning("Default font not found: " + DEFAULT_FONT);
     }
     defaultFontTextureState.setTexture(
         TextureManager.load(
             defaultUrl,
             Texture.MinificationFilter.Trilinear,
             Image.Format.GuessNoCompression,
             true));
     defaultFontTextureState.setEnabled(true);
   }
   return defaultFontTextureState;
 }
コード例 #7
0
ファイル: WaterNode.java プロジェクト: gouessej/Ardor3D
  /** Create setup to use as fallback if fancy water is not supported. */
  private void createFallbackData() {
    fallbackTextureState = new TextureState();
    fallbackTextureState.setEnabled(true);

    fallbackTexture =
        TextureManager.load(
            fallbackMapTextureString,
            Texture.MinificationFilter.Trilinear,
            TextureStoreFormat.GuessCompressedFormat,
            true);
    fallbackTextureState.setTexture(fallbackTexture, 0);
    fallbackTexture.setWrap(Texture.WrapMode.Repeat);

    fallbackTextureStateMatrix = new Matrix4();

    as1 = new BlendState();
    as1.setBlendEnabled(true);
    as1.setTestEnabled(true);
    as1.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
    as1.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
    as1.setEnabled(true);
  }
コード例 #8
0
  private void update() {

    int width = Math.max(canvas.getWidth(), 10);
    int height = Math.max(canvas.getHeight(), 10);
    backgroundQuad.resize(width, height);
    backgroundQuad.setTranslation(width / 2.0, height / 2.0, 0.0);

    BufferedImage gradientImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = (Graphics2D) gradientImage.getGraphics();

    GradientPaint gp = new GradientPaint(0, 0, colorButtom, 0, height, colorTop);
    g2d.setPaint(gp);
    g2d.fillRect(0, 0, width, height);

    g2d.dispose();

    final TextureState ts = new TextureState();
    ts.setTexture(
        TextureManager.loadFromImage(
            AWTImageLoader.makeArdor3dImage(gradientImage, false),
            Texture.MinificationFilter.Trilinear));

    backgroundQuad.setRenderState(ts);
  }
コード例 #9
0
  @Override
  protected void initExample() {
    _canvas.setTitle("Shapes Example");

    wrapCount = 5;
    addMesh(new Arrow("Arrow", 3, 1));
    addMesh(new AxisRods("AxisRods", true, 3, 0.5));
    addMesh(new Box("Box", new Vector3(), 3, 3, 3));
    addMesh(new Capsule("Capsule", 5, 5, 5, 2, 5));
    addMesh(new Cone("Cone", 8, 8, 2, 4));
    addMesh(new Cylinder("Cylinder", 8, 8, 2, 4));
    addMesh(new Disk("Disk", 8, 8, 3));
    addMesh(new Dodecahedron("Dodecahedron", 3));
    addMesh(new Dome("Dome", 8, 8, 3));
    addMesh(new Hexagon("Hexagon", 3));
    addMesh(new Icosahedron("Icosahedron", 3));
    addMesh(new MultiFaceBox("MultiFaceBox", new Vector3(), 3, 3, 3));
    addMesh(new Octahedron("Octahedron", 3));
    addMesh(new PQTorus("PQTorus", 5, 4, 1.5, .5, 128, 8));
    addMesh(new Pyramid("Pyramid", 2, 4));
    addMesh(new Quad("Quad", 3, 3));
    addMesh(new RoundedBox("RoundedBox", new Vector3(3, 3, 3)));
    addMesh(new Sphere("Sphere", 16, 16, 3));
    addMesh(new GeoSphere("GeoSphere", true, 3, 3, TextureMode.Original));
    addMesh(new StripBox("StripBox", new Vector3(), 3, 3, 3));
    addMesh(new Teapot("Teapot"));
    addMesh(new Torus("Torus", 16, 8, 1.0, 2.5));
    addMesh(new Tube("Tube", 2, 3, 4));
    addMesh(createLines());

    final TextureState ts = new TextureState();
    ts.setTexture(
        TextureManager.load(
            "images/ardor3d_white_256.jpg",
            Texture.MinificationFilter.Trilinear,
            TextureStoreFormat.GuessCompressedFormat,
            true));
    _root.setRenderState(ts);

    final BlendState bs = new BlendState();
    bs.setBlendEnabled(true);
    _root.setRenderState(bs);

    // Set up a reusable pick results
    _pickResults = new BoundingPickResults();
    _pickResults.setCheckDistance(true);

    // Set up our pick label
    _text = BasicText.createDefaultTextLabel("", "pick");
    _text.setTranslation(10, 10, 0);
    _text.getSceneHints().setCullHint(CullHint.Always);
    _root.attachChild(_text);

    // Set up picked pulse
    _pickedControl =
        new SpatialController<Spatial>() {
          ColorRGBA curr = new ColorRGBA();
          float val = 0;
          boolean add = true;

          public void update(final double time, final Spatial caller) {
            val += time * (add ? 1 : -1);
            if (val < 0) {
              val = -val;
              add = true;
            } else if (val > 1) {
              val = 1 - (val - (int) val);
              add = false;
            }

            curr.set(val, val, val, 1.0f);

            final MaterialState ms = (MaterialState) caller.getLocalRenderState(StateType.Material);
            ms.setAmbient(curr);
          }
        };
  }
コード例 #10
0
ファイル: WaterNode.java プロジェクト: gouessej/Ardor3D
  /** Load water textures. */
  protected void setupTextures() {
    textureReflect = new Texture2D();
    textureReflect.setWrap(Texture.WrapMode.EdgeClamp);
    textureReflect.setMagnificationFilter(Texture.MagnificationFilter.Bilinear);
    Matrix4 matrix = new Matrix4();
    matrix.setM00(-1.0);
    matrix.setM30(1.0);
    textureReflect.setTextureMatrix(matrix);
    tRenderer.setupTexture(textureReflect);

    normalmapTexture =
        TextureManager.load(
            normalMapTextureString,
            Texture.MinificationFilter.Trilinear,
            TextureStoreFormat.GuessCompressedFormat,
            true);
    textureState.setTexture(normalmapTexture, 0);
    normalmapTexture.setWrap(Texture.WrapMode.Repeat);

    textureReflectBlur = new Texture2D();
    textureReflectBlur.setWrap(Texture.WrapMode.EdgeClamp);
    textureReflectBlur.setMagnificationFilter(Texture.MagnificationFilter.Bilinear);
    textureReflectBlur.setTextureMatrix(matrix);
    tRenderer.setupTexture(textureReflectBlur);

    textureState.setTexture(textureReflectBlur, 1);

    dudvTexture =
        TextureManager.load(
            dudvMapTextureString,
            Texture.MinificationFilter.Trilinear,
            TextureStoreFormat.GuessNoCompressedFormat,
            true);
    matrix = new Matrix4();
    matrix.setM00(0.8);
    matrix.setM11(0.8);
    dudvTexture.setTextureMatrix(matrix);
    textureState.setTexture(dudvTexture, 2);
    dudvTexture.setWrap(Texture.WrapMode.Repeat);

    if (useRefraction) {
      textureRefract = new Texture2D();
      textureRefract.setWrap(Texture.WrapMode.EdgeClamp);
      textureRefract.setMagnificationFilter(Texture.MagnificationFilter.Bilinear);
      tRenderer.setupTexture(textureRefract);

      textureDepth = new Texture2D();
      textureDepth.setWrap(Texture.WrapMode.EdgeClamp);
      textureDepth.setMagnificationFilter(Texture.MagnificationFilter.NearestNeighbor);
      textureDepth.setTextureStoreFormat(TextureStoreFormat.Depth24);
      tRenderer.setupTexture(textureDepth);

      textureState.setTexture(textureRefract, 3);
      textureState.setTexture(textureDepth, 4);
    }

    if (useProjectedShader) {
      foamTexture =
          TextureManager.load(
              foamMapTextureString,
              Texture.MinificationFilter.Trilinear,
              TextureStoreFormat.GuessCompressedFormat,
              true);
      if (useRefraction) {
        textureState.setTexture(foamTexture, 5);
      } else {
        textureState.setTexture(foamTexture, 3);
      }
      foamTexture.setWrap(Texture.WrapMode.Repeat);
    }

    reloadShader();
  }
コード例 #11
0
ファイル: InteractExample.java プロジェクト: gouessej/Ardor3D
  private void addControls() {
    // create our manager
    manager = new InteractManager();
    manager.setupInput(_canvas, _physicalLayer, _logicalLayer);

    // add some widgets.
    rotateWidget = new RotateWidget().withXAxis().withYAxis().withZAxis();
    rotateWidget.setTexture(
        (Texture2D)
            TextureManager.load("images/tick.png", Texture.MinificationFilter.Trilinear, true));
    manager.addWidget(rotateWidget);

    scaleWidget = new SimpleScaleWidget().withArrow(Vector3.UNIT_Y);
    manager.addWidget(scaleWidget);

    moveWidget = new MoveWidget().withXAxis().withYAxis().withZAxis();
    manager.addWidget(moveWidget);

    // set the default as current
    manager.setActiveWidget(rotateWidget);

    // add triggers to change which widget is active
    manager
        .getLogicalLayer()
        .registerTrigger(
            new InputTrigger(
                new KeyHeldCondition(Key.LSHIFT),
                new TriggerAction() {
                  @Override
                  public void perform(
                      final Canvas source, final TwoInputStates inputStates, final double tpf) {
                    manager.setActiveWidget(scaleWidget);
                  }
                }));
    manager
        .getLogicalLayer()
        .registerTrigger(
            new InputTrigger(
                new KeyReleasedCondition(Key.LSHIFT),
                new TriggerAction() {
                  @Override
                  public void perform(
                      final Canvas source, final TwoInputStates inputStates, final double tpf) {
                    manager.setActiveWidget(rotateWidget);
                  }
                }));
    manager
        .getLogicalLayer()
        .registerTrigger(
            new InputTrigger(
                new KeyHeldCondition(Key.LCONTROL),
                new TriggerAction() {
                  @Override
                  public void perform(
                      final Canvas source, final TwoInputStates inputStates, final double tpf) {
                    manager.setActiveWidget(moveWidget);
                  }
                }));
    manager
        .getLogicalLayer()
        .registerTrigger(
            new InputTrigger(
                new KeyReleasedCondition(Key.LCONTROL),
                new TriggerAction() {
                  @Override
                  public void perform(
                      final Canvas source, final TwoInputStates inputStates, final double tpf) {
                    manager.setActiveWidget(rotateWidget);
                  }
                }));

    // add toggle for matrix mode on widgets.
    manager
        .getLogicalLayer()
        .registerTrigger(
            new InputTrigger(
                new KeyPressedCondition(Key.R),
                new TriggerAction() {
                  @Override
                  public void perform(
                      final Canvas source, final TwoInputStates inputStates, final double tpf) {
                    rotateWidget.setInteractMatrix(
                        rotateWidget.getInteractMatrix() == InteractMatrix.World
                            ? InteractMatrix.Local
                            : InteractMatrix.World);
                    rotateWidget.targetDataUpdated(manager);
                    moveWidget.setInteractMatrix(rotateWidget.getInteractMatrix());
                    moveWidget.targetDataUpdated(manager);
                  }
                }));

    // add triggers to change which widget is active
    manager
        .getLogicalLayer()
        .registerTrigger(
            new InputTrigger(
                new KeyPressedCondition(Key.SPACE),
                new TriggerAction() {
                  @Override
                  public void perform(
                      final Canvas source, final TwoInputStates inputStates, final double tpf) {
                    manager.getSpatialTarget().setRotation(Matrix3.IDENTITY);
                    manager.fireTargetDataUpdated();
                  }
                }));

    // add some filters
    manager.addFilter(new MinMaxScaleFilter(1.0, 10.0));
    manager.addFilter(new AllowScaleFilter(false, true, false));
    manager.addFilter(new PlaneBoundaryFilter(new Plane(Vector3.UNIT_Y, 0)));
  }
コード例 #12
0
  @Override
  protected void initExample() {
    _canvas.setTitle("Various size imposters - Example");

    _canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 60, 80));
    _canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(), Vector3.UNIT_Y);

    final BasicText keyText =
        BasicText.createDefaultTextLabel("Text", "[SPACE] Switch imposters off");
    keyText.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
    keyText.getSceneHints().setLightCombineMode(LightCombineMode.Off);
    keyText.setTranslation(new Vector3(0, 20, 0));
    _root.attachChild(keyText);

    final Box box = new Box("Box", new Vector3(), 150, 1, 150);
    box.setModelBound(new BoundingBox());
    box.setTranslation(new Vector3(0, -10, 0));
    _root.attachChild(box);

    final QuadImposterNode imposter0 =
        new QuadImposterNode(
            "Imposter1", 256, 256, _settings.getDepthBits(), _settings.getSamples(), _timer);
    imposter0.setRedrawRate(0.0); // No timed update
    imposter0.setCameraAngleThreshold(1.0 * MathUtils.DEG_TO_RAD);
    imposter0.setCameraDistanceThreshold(0.1);
    _root.attachChild(imposter0);

    final Node scene1 = createModel();
    scene1.setTranslation(0, 0, 0);
    imposter0.attachChild(scene1);

    final QuadImposterNode imposter1 =
        new QuadImposterNode(
            "Imposter1", 128, 128, _settings.getDepthBits(), _settings.getSamples(), _timer);
    imposter1.setRedrawRate(0.0); // No timed update
    imposter1.setCameraAngleThreshold(1.0 * MathUtils.DEG_TO_RAD);
    imposter1.setCameraDistanceThreshold(0.1);
    _root.attachChild(imposter1);

    final Node scene2 = createModel();
    scene2.setTranslation(-15, 0, -25);
    imposter1.attachChild(scene2);

    final QuadImposterNode imposter2 =
        new QuadImposterNode(
            "Imposter2", 64, 64, _settings.getDepthBits(), _settings.getSamples(), _timer);
    imposter2.setRedrawRate(0.0); // No timed update
    imposter2.setCameraAngleThreshold(1.0 * MathUtils.DEG_TO_RAD);
    imposter2.setCameraDistanceThreshold(0.1);
    _root.attachChild(imposter2);

    final Node scene3 = createModel();
    scene3.setTranslation(15, 0, -25);
    imposter2.attachChild(scene3);

    _logicalLayer.registerTrigger(
        new InputTrigger(
            new KeyPressedCondition(Key.SPACE),
            new TriggerAction() {
              public void perform(
                  final Canvas source, final TwoInputStates inputStates, final double tpf) {
                showImposter = !showImposter;
                if (showImposter) {
                  _root.detachChild(scene1);
                  _root.detachChild(scene2);
                  _root.detachChild(scene3);
                  imposter0.attachChild(scene1);
                  imposter1.attachChild(scene2);
                  imposter2.attachChild(scene3);
                  _root.attachChild(imposter0);
                  _root.attachChild(imposter1);
                  _root.attachChild(imposter2);

                  keyText.setText("[SPACE] Switch imposters off");
                } else {
                  _root.detachChild(imposter0);
                  _root.detachChild(imposter1);
                  _root.detachChild(imposter2);
                  _root.attachChild(scene1);
                  _root.attachChild(scene2);
                  _root.attachChild(scene3);

                  keyText.setText("[SPACE] Switch imposters on");
                }
              }
            }));

    final TextureState ts = new TextureState();
    ts.setEnabled(true);
    ts.setTexture(
        TextureManager.load(
            "images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));

    final MaterialState ms = new MaterialState();
    ms.setColorMaterial(ColorMaterial.Diffuse);
    _root.setRenderState(ms);

    _root.setRenderState(ts);

    _root.acceptVisitor(new UpdateModelBoundVisitor(), false);
  }