コード例 #1
0
 @Override
 public void read(JMEImporter im) throws IOException {
   super.read(im);
   Savable[] temp = null;
   InputCapsule ic = im.getCapsule(this);
   // Read in texture map locations.
   this.color = ic.readString("ColorMap", null);
   this.normal = ic.readString("NormalMap", null);
   this.specular = ic.readString("SpecularMap", null);
   // Read in primitives.
   temp = ic.readSavableArray("Vertices", null);
   this.vertices = new IVertex[temp.length];
   for (int i = 0; i < temp.length; i++) {
     this.vertices[i] = (IVertex) temp[i];
   }
   temp = ic.readSavableArray("Triangles", null);
   this.triangles = new ITriangle[temp.length];
   for (int i = 0; i < temp.length; i++) {
     this.triangles[i] = (ITriangle) temp[i];
   }
   temp = ic.readSavableArray("Weights", null);
   this.weights = new IWeight[temp.length];
   for (int i = 0; i < temp.length; i++) {
     this.weights[i] = (IWeight) temp[i];
   }
   // Read in settings.
   this.anisotropic = ic.readInt("Anisotropic", 0);
   this.miniFilter = MinificationFilter.valueOf(ic.readString("MinFilter", null));
   this.magFilter = MagnificationFilter.valueOf(ic.readString("MagFilter", null));
   this.orientedBounding = ic.readBoolean("OrientedBounding", false);
 }
コード例 #2
0
  public void read(JMEImporter e) throws IOException {
    super.read(e);
    InputCapsule capsule = e.getCapsule(this);

    value1 = capsule.readInt("value1", 0);
    value2 = capsule.readInt("value2", 0);
  }
コード例 #3
0
 public void read(JMEImporter e) throws IOException {
   super.read(e);
   InputCapsule capsule = e.getCapsule(this);
   float len = capsule.readFloat("mdlength", 1f);
   float rad = capsule.readFloat("mdradius", 0.2f);
   updateGeometry(len, rad);
 }
コード例 #4
0
 public void read(JMEImporter e) throws IOException {
   InputCapsule capsule = e.getCapsule(this);
   index = capsule.readInt("index", 0);
   mass = capsule.readFloat("mass", 1);
   invMass = 1f / mass;
   position = (Vector3f) capsule.readSavable("position", Vector3f.ZERO.clone());
   acceleration = (Vector3f) capsule.readSavable("acceleration", Vector3f.ZERO.clone());
 }
コード例 #5
0
ファイル: Triangle.java プロジェクト: 5teven/md5importer
 @Override
 public void read(JMEImporter im) throws IOException {
   InputCapsule ic = im.getCapsule(this);
   this.index = ic.readInt("Index", -1);
   Savable[] temp = ic.readSavableArray("Vertices", null);
   this.vertices = new IVertex[temp.length];
   for (int i = 0; i < this.vertices.length; i++) this.vertices[i] = (IVertex) temp[i];
 }
コード例 #6
0
ファイル: TextureCubeMap.java プロジェクト: jmecn/learnJME3
 @Override
 public void read(JMEImporter e) throws IOException {
   super.read(e);
   InputCapsule capsule = e.getCapsule(this);
   wrapS = capsule.readEnum("wrapS", WrapMode.class, WrapMode.EdgeClamp);
   wrapT = capsule.readEnum("wrapT", WrapMode.class, WrapMode.EdgeClamp);
   wrapR = capsule.readEnum("wrapR", WrapMode.class, WrapMode.EdgeClamp);
 }
コード例 #7
0
ファイル: TextureState.java プロジェクト: jmecn/learnJME3
 @SuppressWarnings("unchecked")
 public void read(JMEImporter e) throws IOException {
   super.read(e);
   InputCapsule capsule = e.getCapsule(this);
   texture = capsule.readSavableArrayList("texture", new ArrayList<Texture>(1));
   offset = capsule.readInt("offset", 0);
   correctionType =
       capsule.readEnum("correctionType", CorrectionType.class, CorrectionType.Perspective);
   resetFirstLast();
 }
コード例 #8
0
  @SuppressWarnings("unchecked")
  public void read(JMEImporter e) throws IOException {
    super.read(e);
    InputCapsule capsule = e.getCapsule(this);

    numObjects = capsule.readInt("numObjects", 0);

    Savable[] savs = capsule.readSavableArray("toChange", new Spatial[0]);
    if (savs == null) {
      toChange = null;
    } else {
      toChange = new Spatial[savs.length];
      for (int x = 0; x < savs.length; x++) {
        toChange[x] = (Spatial) savs[x];
      }
    }

    savs = capsule.readSavableArray("pivots", new TransformQuaternion[0]);
    if (savs == null) {
      pivots = null;
    } else {
      pivots = new TransformQuaternion[savs.length];
      for (int x = 0; x < savs.length; x++) {
        pivots[x] = (TransformQuaternion) savs[x];
      }
    }

    parentIndexes = capsule.readIntArray("parentIndexes", new int[0]);
    keyframes = capsule.readSavableArrayList("keyframes", new ArrayList());
    haveChanged = capsule.readBooleanArray("haveChanged", new boolean[0]);

    beginPointTime = (PointInTime) capsule.readSavable("beginPointTime", null);
    endPointTime = (PointInTime) capsule.readSavable("endPointTime", null);
  }
コード例 #9
0
 public void read(JMEImporter e) throws IOException {
   InputCapsule capsule = e.getCapsule(this);
   target = (TriangleBatch) capsule.readSavable("target", null);
   if (target != null && target.parentGeom == null) {
     if (motherMesh == null) {
       motherMesh = new TriMesh("mother");
       motherMesh.clearBatches();
     }
     motherMesh.addBatch(target);
   }
   super.read(e);
 }
コード例 #10
0
    public void read(JMEImporter e) throws IOException {
      InputCapsule capsule = e.getCapsule(this);
      usedRot = capsule.readBitSet("usedRot", null);
      usedTrans = capsule.readBitSet("usedTrans", null);
      usedScale = capsule.readBitSet("usedScale", null);
      time = capsule.readFloat("time", 0);

      Savable[] savs = capsule.readSavableArray("look", null);
      if (savs == null) {
        look = null;
      } else {
        look = new TransformQuaternion[savs.length];
        for (int x = 0; x < savs.length; x++) {
          look[x] = (TransformQuaternion) savs[x];
        }
      }
    }
 @Override
 public void read(JMEImporter e) throws IOException {
   super.read(e);
   InputCapsule capsule = e.getCapsule(this);
   translationDelta = (Vector3f) capsule.readSavable("translationDelta", null);
   rotationDelta = capsule.readFloat("rotationDelta", 0);
   textureRotationAxis = (Vector3f) capsule.readSavable("textureRotationAxis", null);
   xRepeat = capsule.readFloat("xRepeat", 1);
   yRepeat = capsule.readFloat("yRepeat", 1);
   zRepeat = capsule.readFloat("zRepeat", 1);
   currentTranslation = (Vector3f) capsule.readSavable("currentTranslation", null);
   currentRotation = (Quaternion) capsule.readSavable("currentRotation", null);
   currentRotationAngle = capsule.readFloat("currentRotationAngle", 0);
   Savable[] savs = capsule.readSavableArray("textures", null);
   if (savs != null) {
     textures = new Texture[savs.length];
     for (int i = 0; i < savs.length; i++) {
       textures[i] = (Texture) savs[i];
     }
   }
 }
コード例 #12
0
  public void read(JMEImporter e) throws IOException {
    super.read(e);
    InputCapsule capsule = e.getCapsule(this);

    mover = (Spatial) capsule.readSavable("mover", null);
    curve = (Curve) capsule.readSavable("curve", null);
    up = (Vector3f) capsule.readSavable("up", null);
    orientationPrecision = capsule.readFloat("orientationPrecision", 0.1f);
    cycleForward = capsule.readBoolean("cycleForward", true);
    autoRotation = capsule.readBoolean("autoRotation", false);
  }
コード例 #13
0
  @SuppressWarnings("unchecked")
  public void read(JMEImporter e) throws IOException {
    super.read(e);
    InputCapsule cap = e.getCapsule(this);

    skins = (Node) cap.readSavable("skins", null);
    Bone readSkeleton = (Bone) cap.readSavable("skeleton", null);
    connectionPoints = cap.readSavableArrayList("connectionPoints", null);
    cache = cap.readSavableArrayListArray2D("cache", null);
    Savable sav = cap.readSavable("geometryRegions", null);
    if (sav != null) geometryRegions = (StringStringMap) sav;

    if (readSkeleton != null) {
      setSkeleton(readSkeleton);
      regenInfluenceOffsets();
      skeleton.addBoneListener(this);
    }

    updateWorldBound();
  }
コード例 #14
0
 public void read(JMEImporter e) throws IOException {
   super.read(e);
   InputCapsule capsule = e.getCapsule(this);
   patch = (BezierPatch) capsule.readSavable("patch", null);
 }
コード例 #15
0
  /** <b>This method foces interpolation mode, regardless of input</b> */
  @SuppressWarnings("unchecked")
  public void read(JMEImporter e) throws IOException {
    InputCapsule cap = e.getCapsule(this);
    name = cap.readString("name", null);
    keyframeTime = cap.readFloatArray("keyframeTime", null);
    interpolationType = cap.readIntArray("interpolationType", null);
    boneTransforms = cap.readSavableArrayList("boneTransforms", null);
    currentTime = cap.readFloat("currentTime", 0);
    currentFrame = cap.readInt("currentFrame", 1);
    prevFrame = cap.readInt("prevFrame", 0);
    endFrame = cap.readInt("endFrame", 0);
    startFrame = cap.readInt("startFrame", 0);
    interpolationRate = cap.readFloat("interpolationRate", DEFAULT_RATE);
    lastTime = cap.readFloat("lastTime", 0);
    cycleMode = cap.readInt("cycleMode", 1);
    interpolate = cap.readBoolean("interpolate", true);
    children = cap.readSavableArrayList("children", null);

    int[] frames = cap.readIntArray("eventFrames", null);

    if (frames != null) {
      for (int i = 0; i < frames.length; i++) {
        ArrayList<Savable> events = cap.readSavableArrayList("event" + frames[i], null);
        for (int j = 0; j < events.size(); j++) {
          AnimationEventManager.getInstance()
              .addAnimationEvent(this, frames[i], (AnimationEvent) events.get(i));
        }
      }
    }

    // Update the method Javadoc when non-interpolation is supported again.
    interpolationType = new int[keyframeTime.length];
    for (int i = 0; i < keyframeTime.length; i++) {
      interpolationType[i] = BoneAnimation.LINEAR;
    }
  }
コード例 #16
0
 public void read(JMEImporter e) throws IOException {
   super.read(e);
   InputCapsule capsule = e.getCapsule(this);
   function = capsule.readInt("function", CF_LESS);
   writable = capsule.readBoolean("writable", true);
 }
コード例 #17
0
  public void read(JMEImporter e) throws IOException {
    detachAllChildren();
    super.read(e);
    InputCapsule capsule = e.getCapsule(this);
    emitType = capsule.readEnum("emitType", EmitType.class, EmitType.Point);
    particleType = capsule.readEnum("particleType", ParticleType.class, ParticleType.Quad);
    psLine = (Line) capsule.readSavable("psLine", null);
    psRect = (Rectangle) capsule.readSavable("psRect", null);
    psRing = (Ring) capsule.readSavable("psRing", null);
    psGeom = (Geometry) capsule.readSavable("psGeom", null);
    startSize = capsule.readFloat("startSize", DEFAULT_START_SIZE);
    endSize = capsule.readFloat("endSize", DEFAULT_END_SIZE);
    startColor = (ColorRGBA) capsule.readSavable("startColor", DEFAULT_START_COLOR.clone());
    endColor = (ColorRGBA) capsule.readSavable("endColor", DEFAULT_END_COLOR.clone());
    startSpin = capsule.readFloat("startSpin", 0);
    endSpin = capsule.readFloat("endSpin", 0);
    startMass = capsule.readFloat("startMass", 0);
    endMass = capsule.readFloat("endMass", 0);
    startTexIndex = capsule.readInt("startTexIndex", 0);
    texQuantity = capsule.readInt("texQuantity", 1);
    initialVelocity = capsule.readFloat("initialVelocity", 1);
    minimumLifeTime = capsule.readFloat("minimumLifeTime", DEFAULT_MIN_LIFE);
    maximumLifeTime = capsule.readFloat("maximumLifeTime", DEFAULT_MAX_LIFE);
    minimumAngle = capsule.readFloat("minimumAngle", 0);
    maximumAngle = capsule.readFloat("maximumAngle", DEFAULT_MAX_ANGLE);
    emissionDirection =
        (Vector3f) capsule.readSavable("emissionDirection", Vector3f.UNIT_Y.clone());
    worldEmit = (Vector3f) capsule.readSavable("worldEmit", Vector3f.ZERO.clone());
    upVector = (Vector3f) capsule.readSavable("upVector", Vector3f.UNIT_Y.clone());
    leftVector = (Vector3f) capsule.readSavable("leftVector", new Vector3f(-1, 0, 0));
    numParticles = capsule.readInt("numParticles", 0);
    rotateWithScene = capsule.readBoolean("rotateWithScene", false);
    geometryCoordinates = capsule.readFloatBuffer("geometryCoordinates", null);
    appearanceColors = capsule.readFloatBuffer("appearanceColors", null);

    releaseRate = capsule.readInt("releaseRate", numParticles);
    particleOrientation = capsule.readFloat("particleOrientation", 0);
    originCenter = (Vector3f) capsule.readSavable("originCenter", new Vector3f());
    originOffset = (Vector3f) capsule.readSavable("originOffset", new Vector3f());
    controller = (ParticleController) capsule.readSavable("controller", null);
    cameraFacing = capsule.readBoolean("cameraFacing", true);
    velocityAligned = capsule.readBoolean("velocityAligned", false);
    particlesInWorldCoords = capsule.readBoolean("particlesInWorldCoords", true);
    ramp = (ParticleAppearanceRamp) capsule.readSavable("ramp", new ParticleAppearanceRamp());
    texAnimation = (TexAnimation) capsule.readSavable("texAnimation", new TexAnimation());

    invScale = new Vector3f();
    upXemit = new Vector3f();
    absUpVector = new Vector3f();
    abUpMinUp = new Vector3f();
    rotMatrix = new Matrix3f();
    initializeParticles(numParticles);
  }
コード例 #18
0
ファイル: Line.java プロジェクト: jmecn/learnJME3
 public void read(JMEImporter e) throws IOException {
   InputCapsule capsule = e.getCapsule(this);
   origin = (Vector3f) capsule.readSavable("origin", Vector3f.ZERO.clone());
   direction = (Vector3f) capsule.readSavable("direction", Vector3f.ZERO.clone());
 }