Example usage for javax.media.j3d Appearance ALLOW_POINT_ATTRIBUTES_WRITE

List of usage examples for javax.media.j3d Appearance ALLOW_POINT_ATTRIBUTES_WRITE

Introduction

In this page you can find the example usage for javax.media.j3d Appearance ALLOW_POINT_ATTRIBUTES_WRITE.

Prototype

int ALLOW_POINT_ATTRIBUTES_WRITE

To view the source code for javax.media.j3d Appearance ALLOW_POINT_ATTRIBUTES_WRITE.

Click Source Link

Document

Specifies that this Appearance object allows writing its point component information.

Usage

From source file:BehaviorTest.java

public WakeupCondition restart(Shape3D shape3D, int nElapsedTime, int nNumFrames, ExplosionListener listener) {
    System.out.println("Will explode after: " + nElapsedTime / 1000 + " secs.");

    m_Shape3D = shape3D;//from   w ww.  ja v  a  2  s  .c o  m
    m_nElapsedTime = nElapsedTime;
    m_nNumFrames = nNumFrames;
    m_nFrameNumber = 0;

    // create the WakeupCriterion for the behavior
    m_InitialWakeupCondition = new WakeupOnElapsedTime(m_nElapsedTime);

    m_Listener = listener;

    // save the GeometryArray that we are modifying
    m_GeometryArray = (GeometryArray) m_Shape3D.getGeometry();

    if (m_Shape3D.isLive() == false && m_Shape3D.isCompiled() == false) {
        // set the capability bits that the behavior requires
        m_Shape3D.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
        m_Shape3D.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

        m_Shape3D.getAppearance().setCapability(Appearance.ALLOW_POINT_ATTRIBUTES_WRITE);
        m_Shape3D.getAppearance().setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);
        m_Shape3D.getAppearance().setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE);
        m_Shape3D.getAppearance().setCapability(Appearance.ALLOW_TEXTURE_WRITE);

        m_GeometryArray.setCapability(GeometryArray.ALLOW_COORDINATE_READ);
        m_GeometryArray.setCapability(GeometryArray.ALLOW_COORDINATE_WRITE);
        m_GeometryArray.setCapability(GeometryArray.ALLOW_COUNT_READ);
    }

    // make a copy of the object's original appearance
    m_Appearance = new Appearance();
    m_Appearance = (Appearance) m_Shape3D.getAppearance().cloneNodeComponent(true);

    // allocate an array for the model coordinates
    m_CoordinateArray = new float[3 * m_GeometryArray.getVertexCount()];

    // make a copy of the models original coordinates
    m_OriginalCoordinateArray = new float[3 * m_GeometryArray.getVertexCount()];
    m_GeometryArray.getCoordinates(0, m_OriginalCoordinateArray);

    // start (or restart) the behavior
    setEnable(true);

    return m_InitialWakeupCondition;
}

From source file:AppearanceTest.java

protected void setAppearanceCapability() {
    m_Appearance.setCapability(Appearance.ALLOW_POINT_ATTRIBUTES_WRITE);
}