com.jme3.export.InputCapsule Java Examples
The following examples show how to use
com.jme3.export.InputCapsule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TerrainGrid.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule c = im.getCapsule(this); name = c.readString("name", null); size = c.readInt("size", 0); patchSize = c.readInt("patchSize", 0); stepScale = (Vector3f) c.readSavable("stepScale", null); offset = (Vector2f) c.readSavable("offset", null); offsetAmount = c.readFloat("offsetAmount", 0); gridTileLoader = (TerrainGridTileLoader) c.readSavable("terrainQuadGrid", null); material = (Material) c.readSavable("material", null); initData(); if (gridTileLoader != null) { gridTileLoader.setPatchSize(this.patchSize); gridTileLoader.setQuadSize(this.quadSize); } }
Example #2
Source File: HingeJoint.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); this.axisA = (Vector3f) capsule.readSavable("axisA", new Vector3f()); this.axisB = (Vector3f) capsule.readSavable("axisB", new Vector3f()); this.angularOnly = capsule.readBoolean("angularOnly", false); float lowerLimit = capsule.readFloat("lowerLimit", 1e30f); float upperLimit = capsule.readFloat("upperLimit", -1e30f); this.biasFactor = capsule.readFloat("biasFactor", 0.3f); this.relaxationFactor = capsule.readFloat("relaxationFactor", 1f); this.limitSoftness = capsule.readFloat("limitSoftness", 0.9f); boolean enableAngularMotor = capsule.readBoolean("enableAngularMotor", false); float targetVelocity = capsule.readFloat("targetVelocity", 0.0f); float maxMotorImpulse = capsule.readFloat("maxMotorImpulse", 0.0f); createJoint(); enableMotor(enableAngularMotor, targetVelocity, maxMotorImpulse); setLimit(lowerLimit, upperLimit, limitSoftness, biasFactor, relaxationFactor); }
Example #3
Source File: EffectTrack.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
/** * Internal use only serialization * * @param im importer * @throws IOException Exception */ public void read(JmeImporter im) throws IOException { InputCapsule in = im.getCapsule(this); this.particlesPerSeconds = in.readFloat("particlesPerSeconds", 0); //reading the emitter even if the track will then reference its cloned counter part if it's loaded with the assetManager. //This also avoid null pointer exception if the model is not loaded via the AssetManager. emitter = (ParticleEmitter) in.readSavable("emitter", null); emitter.setParticlesPerSec(0); //if the emitter was saved with a KillParticleControl we remove it. // Control c = emitter.getControl(KillParticleControl.class); // if(c!=null){ // emitter.removeControl(c); // } //emitter.removeControl(KillParticleControl.class); length = in.readFloat("length", length); startOffset = in.readFloat("startOffset", 0); }
Example #4
Source File: PhysicsRigidBody.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void read(JmeImporter e) throws IOException { super.read(e); InputCapsule capsule = e.getCapsule(this); float mass = capsule.readFloat("mass", 1.0f); this.mass = mass; rebuildRigidBody(); setGravity((Vector3f) capsule.readSavable("gravity", Vector3f.ZERO.clone())); setFriction(capsule.readFloat("friction", 0.5f)); setKinematic(capsule.readBoolean("kinematic", false)); setRestitution(capsule.readFloat("restitution", 0)); setAngularFactor(capsule.readFloat("angularFactor", 1)); setDamping(capsule.readFloat("linearDamping", 0), capsule.readFloat("angularDamping", 0)); setSleepingThresholds(capsule.readFloat("linearSleepingThreshold", 0.8f), capsule.readFloat("angularSleepingThreshold", 1.0f)); setCcdMotionThreshold(capsule.readFloat("ccdMotionThreshold", 0)); setCcdSweptSphereRadius(capsule.readFloat("ccdSweptSphereRadius", 0)); setPhysicsLocation((Vector3f) capsule.readSavable("physicsLocation", new Vector3f())); setPhysicsRotation((Matrix3f) capsule.readSavable("physicsRotation", new Matrix3f())); joints = capsule.readSavableArrayList("joints", null); }
Example #5
Source File: DacLinks.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * De-serialize this control, for example when loading from a J3O file. * * @param im importer (not null) * @throws IOException from importer */ @Override @SuppressWarnings("unchecked") public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); boneLinkList = ic.readSavableArrayList("boneLinkList", null); for (BoneLink link : boneLinkList) { String name = link.boneName(); boneLinks.put(name, link); } skeleton = (Armature) ic.readSavable("skeleton", null); transformer = (Spatial) ic.readSavable("transformer", null); torsoLink = (TorsoLink) ic.readSavable("torsoLink", null); }
Example #6
Source File: Image.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void read(JmeImporter e) throws IOException { InputCapsule capsule = e.getCapsule(this); format = capsule.readEnum("format", Format.class, Format.RGBA8); width = capsule.readInt("width", 0); height = capsule.readInt("height", 0); depth = capsule.readInt("depth", 0); mipMapSizes = capsule.readIntArray("mipMapSizes", null); multiSamples = capsule.readInt("multiSamples", 1); data = capsule.readByteBufferArrayList("data", null); colorSpace = capsule.readEnum("colorSpace", ColorSpace.class, null); if (mipMapSizes != null) { needGeneratedMips = false; mipsWereGenerated = true; } }
Example #7
Source File: TerrainQuad.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void read(JmeImporter e) throws IOException { super.read(e); InputCapsule c = e.getCapsule(this); size = c.readInt("size", 0); stepScale = (Vector3f) c.readSavable("stepScale", null); offset = (Vector2f) c.readSavable("offset", new Vector2f(0,0)); offsetAmount = c.readFloat("offsetAmount", 0); quadrant = c.readInt("quadrant", 0); totalSize = c.readInt("totalSize", 0); //lodCalculator = (LodCalculator) c.readSavable("lodCalculator", createDefaultLodCalculator()); //lodCalculatorFactory = (LodCalculatorFactory) c.readSavable("lodCalculatorFactory", null); if ( !(getParent() instanceof TerrainQuad) ) { BoundingBox all = new BoundingBox(getWorldTranslation(), totalSize, totalSize, totalSize); affectedAreaBBox = all; updateNormals(); } }
Example #8
Source File: PhysicsCharacter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * De-serialize this character from the specified importer, for example when * loading from a J3O file. * * @param e importer (not null) * @throws IOException from importer */ @Override public void read(JmeImporter e) throws IOException { super.read(e); InputCapsule capsule = e.getCapsule(this); stepHeight = capsule.readFloat("stepHeight", 1.0f); buildObject(); setGravity(capsule.readFloat("gravity", 9.8f * 3)); setMaxSlope(capsule.readFloat("maxSlope", 1.0f)); setFallSpeed(capsule.readFloat("fallSpeed", 55.0f)); setJumpSpeed(capsule.readFloat("jumpSpeed", 10.0f)); setUpAxis(capsule.readInt("upAxis", 1)); setCcdMotionThreshold(capsule.readFloat("ccdMotionThreshold", 0)); setCcdSweptSphereRadius(capsule.readFloat("ccdSweptSphereRadius", 0)); setPhysicsLocation((Vector3f) capsule.readSavable("physicsLocation", new Vector3f())); }
Example #9
Source File: UserData.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); type = ic.readByte("type", (byte) 0); switch (type) { case 0: value = ic.readInt("intVal", 0); break; case 1: value = ic.readFloat("floatVal", 0f); break; case 2: value = ic.readBoolean("boolVal", false); break; case 3: value = ic.readString("strVal", null); break; case 4: value = ic.readLong("longVal", 0l); break; default: throw new UnsupportedOperationException(); } }
Example #10
Source File: MeshCollisionShape.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * De-serialize this shape, for example when loading from a J3O file. * * @param im importer (not null) * @throws IOException from importer */ @Override public void read(final JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); this.numVertices = capsule.readInt(MeshCollisionShape.NUM_VERTICES, 0); this.numTriangles = capsule.readInt(MeshCollisionShape.NUM_TRIANGLES, 0); this.vertexStride = capsule.readInt(MeshCollisionShape.VERTEX_STRIDE, 0); this.triangleIndexStride = capsule.readInt(MeshCollisionShape.TRIANGLE_INDEX_STRIDE, 0); this.triangleIndexBase = BufferUtils.createByteBuffer(capsule.readByteArray(MeshCollisionShape.TRIANGLE_INDEX_BASE, null)); this.vertexBase = BufferUtils.createByteBuffer(capsule.readByteArray(MeshCollisionShape.VERTEX_BASE, null)); byte[] nativeBvh = capsule.readByteArray(MeshCollisionShape.NATIVE_BVH, null); memoryOptimized=nativeBvh != null; createShape(nativeBvh); }
Example #11
Source File: BitmapCharacterSet.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); lineHeight = ic.readInt("lineHeight", 0); base = ic.readInt("base", 0); renderedSize = ic.readInt("renderedSize", 0); width = ic.readInt("width", 0); height = ic.readInt("height", 0); pageSize = ic.readInt("pageSize", 0); int[] styles = ic.readIntArray("styles", null); for (int style : styles) { characters.put(style, readCharset(ic, style)); } }
Example #12
Source File: NewtonianParticleInfluencer.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); normalVelocity = ic.readFloat("normalVelocity", 0.0f); surfaceTangentFactor = ic.readFloat("surfaceTangentFactor", 0.0f); surfaceTangentRotation = ic.readFloat("surfaceTangentRotation", 0.0f); }
Example #13
Source File: AudioTrack.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Internal use only serialization * * @param im importer * @throws IOException Exception */ public void read(JmeImporter im) throws IOException { InputCapsule in = im.getCapsule(this); audio = (AudioNode) in.readSavable("audio", null); length = in.readFloat("length", length); startOffset = in.readFloat("startOffset", 0); }
Example #14
Source File: ChaseCamera.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Read the camera * @param im * @throws IOException */ @Override public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); maxDistance = ic.readFloat("maxDistance", 40); minDistance = ic.readFloat("minDistance", 1); }
Example #15
Source File: GhostControl.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); enabled = ic.readBoolean("enabled", true); spatial = (Spatial) ic.readSavable("spatial", null); applyLocal = ic.readBoolean("applyLocalPhysics", false); setUserObject(spatial); }
Example #16
Source File: CameraEvent.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * used internally for serialization * * @param im * @throws IOException */ @Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); cameraName = ic.readString("cameraName", null); }
Example #17
Source File: AnimationTrack.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); modelName = ic.readString("modelName", ""); animationName = ic.readString("animationName", ""); }
Example #18
Source File: Point2PointJoint.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); createJoint(); InputCapsule cap=im.getCapsule(this); setDamping(cap.readFloat("damping", 1.0f)); setDamping(cap.readFloat("tau", 0.3f)); setDamping(cap.readFloat("impulseClamp", 0f)); }
Example #19
Source File: PhysicsVehicle.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override @SuppressWarnings("unchecked") public void read(JmeImporter im) throws IOException { InputCapsule capsule = im.getCapsule(this); tuning = new VehicleTuning(); tuning.frictionSlip = capsule.readFloat("frictionSlip", 10.5f); tuning.maxSuspensionTravelCm = capsule.readFloat("maxSuspensionTravelCm", 500f); tuning.maxSuspensionForce = capsule.readFloat("maxSuspensionForce", 6000f); tuning.suspensionCompression = capsule.readFloat("suspensionCompression", 0.83f); tuning.suspensionDamping = capsule.readFloat("suspensionDamping", 0.88f); tuning.suspensionStiffness = capsule.readFloat("suspensionStiffness", 5.88f); wheels = capsule.readSavableArrayList("wheelsList", new ArrayList<VehicleWheel>()); motionState.setVehicle(this); super.read(im); }
Example #20
Source File: BillboardControl.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter e) throws IOException { super.read(e); InputCapsule capsule = e.getCapsule(this); orient = (Matrix3f) capsule.readSavable("orient", null); look = (Vector3f) capsule.readSavable("look", null); left = (Vector3f) capsule.readSavable("left", null); alignment = capsule.readEnum("alignment", Alignment.class, Alignment.Screen); }
Example #21
Source File: AudioNode.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); // NOTE: In previous versions of jME3, audioKey was actually // written with the name "key". This has been changed // to "audio_key" in case Spatial's key will be written as "key". if (ic.getSavableVersion(AudioNode.class) == 0){ audioKey = (AudioKey) ic.readSavable("key", null); }else{ audioKey = (AudioKey) ic.readSavable("audio_key", null); } loop = ic.readBoolean("looping", false); volume = ic.readFloat("volume", 1); pitch = ic.readFloat("pitch", 1); timeOffset = ic.readFloat("time_offset", 0); dryFilter = (Filter) ic.readSavable("dry_filter", null); velocity = (Vector3f) ic.readSavable("velocity", null); reverbEnabled = ic.readBoolean("reverb_enabled", false); reverbFilter = (Filter) ic.readSavable("reverb_filter", null); maxDistance = ic.readFloat("max_distance", 20); refDistance = ic.readFloat("ref_distance", 10); directional = ic.readBoolean("directional", false); direction = (Vector3f) ic.readSavable("direction", null); innerAngle = ic.readFloat("inner_angle", 360); outerAngle = ic.readFloat("outer_angle", 360); positional = ic.readBoolean("positional", false); if (audioKey != null) { data = im.getAssetManager().loadAudio(audioKey); } }
Example #22
Source File: BoundingBox.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void read(JmeImporter e) throws IOException { super.read(e); InputCapsule capsule = e.getCapsule(this); xExtent = capsule.readFloat("xExtent", 0); yExtent = capsule.readFloat("yExtent", 0); zExtent = capsule.readFloat("zExtent", 0); }
Example #23
Source File: CharacterControl.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); enabled = ic.readBoolean("enabled", true); useViewDirection = ic.readBoolean("viewDirectionEnabled", true); viewDirection = (Vector3f) ic.readSavable("viewDirection", new Vector3f(Vector3f.UNIT_Z)); applyLocal = ic.readBoolean("applyLocalPhysics", false); spatial = (Spatial) ic.readSavable("spatial", null); setUserObject(spatial); }
Example #24
Source File: LodControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); trisPerPixel = ic.readFloat("trisPerPixel", 1f); distTolerance = ic.readFloat("distTolerance", 1f); numLevels = ic.readInt("numLevels", 0); numTris = ic.readIntArray("numTris", null); }
Example #25
Source File: Point2PointJoint.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); createJoint(); InputCapsule cap=im.getCapsule(this); setDamping(cap.readFloat("damping", 1.0f)); setDamping(cap.readFloat("tau", 0.3f)); setDamping(cap.readFloat("impulseClamp", 0f)); }
Example #26
Source File: SimplexCollisionShape.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); vector1 = (Vector3f) capsule.readSavable("simplexPoint1", null); vector2 = (Vector3f) capsule.readSavable("simplexPoint2", null); vector3 = (Vector3f) capsule.readSavable("simplexPoint3", null); vector4 = (Vector3f) capsule.readSavable("simplexPoint4", null); createShape(); }
Example #27
Source File: HullCollisionShape.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); // for backwards compatability Mesh mesh = (Mesh) capsule.readSavable("hullMesh", null); if (mesh != null) { this.points = getPoints(mesh); } else { this.points = capsule.readFloatArray("points", null); } createShape(this.points); }
Example #28
Source File: CharacterControl.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); enabled = ic.readBoolean("enabled", true); useViewDirection = ic.readBoolean("viewDirectionEnabled", true); viewDirection = (Vector3f) ic.readSavable("viewDirection", new Vector3f(Vector3f.UNIT_Z)); applyLocal = ic.readBoolean("applyLocalPhysics", false); spatial = (Spatial) ic.readSavable("spatial", null); setUserObject(spatial); }
Example #29
Source File: BetterCharacterControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * De-serialize this control, for example when loading from a J3O file. * * @param im importer (not null) * @throws IOException from importer */ @Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule in = im.getCapsule(this); this.radius = in.readFloat("radius", 1); this.height = in.readFloat("height", 2); this.mass = in.readFloat("mass", 80); this.physicsDamping = in.readFloat("physicsDamping", 0.9f); this.jumpForce.set((Vector3f) in.readSavable("jumpForce", new Vector3f(0, mass * 5, 0))); rigidBody = new PhysicsRigidBody(getShape(), mass); jumpForce.set(new Vector3f(0, mass * 5, 0)); rigidBody.setAngularFactor(0); }
Example #30
Source File: CompoundCollisionShape.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); children = capsule.readSavableArrayList("children", new ArrayList<ChildCollisionShape>()); cShape.setLocalScaling(Converter.convert(getScale())); cShape.setMargin(margin); loadChildren(); }