Java Code Examples for com.jme3.util.clone.Cloner#clone()
The following examples show how to use
com.jme3.util.clone.Cloner#clone() .
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: Spatial.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
/** * @return Similar to Spatial.clone() except will create a deep clone of all * geometries' meshes. Normally this method shouldn't be used. Instead, use * Spatial.clone() * * @see Spatial#clone() */ public Spatial deepClone() { // Setup the cloner for the type of cloning we want to do. Cloner cloner = new Cloner(); // First, we definitely do not want to clone our own parent cloner.setClonedValue(parent, null); Spatial clone = cloner.clone(this); // Because we've nulled the parent out we need to make sure // the transforms and stuff get refreshed. clone.setTransformRefresh(); clone.setLightListRefresh(); clone.setMatParamOverrideRefresh(); return clone; }
Example 2
Source File: TerrainQuad.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Called internally by com.jme3.util.clone.Cloner. Do not call directly. */ @Override public void cloneFields( Cloner cloner, Object original ) { super.cloneFields(cloner, original); this.stepScale = cloner.clone(stepScale); this.offset = cloner.clone(offset); // This was not cloned before... I think that's a mistake. this.affectedAreaBBox = cloner.clone(affectedAreaBBox); // Otherwise, picker would be cloned by reference and thus "this" would be wrong this.picker = new BresenhamTerrainPicker(this); // neighbourFinder is also not cloned. Maybe that's ok. }
Example 3
Source File: Spatial.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * Called internally by com.jme3.util.clone.Cloner. Do not call directly. */ @Override public void cloneFields( Cloner cloner, Object original ) { // Clone all of the fields that need fix-ups and/or potential // sharing. this.parent = cloner.clone(parent); this.worldBound = cloner.clone(worldBound); this.worldLights = cloner.clone(worldLights); this.localLights = cloner.clone(localLights); this.worldTransform = cloner.clone(worldTransform); this.localTransform = cloner.clone(localTransform); this.worldOverrides = cloner.clone(worldOverrides); this.localOverrides = cloner.clone(localOverrides); this.controls = cloner.clone(controls); // Cloner doesn't handle maps on its own just yet. // Note: this is more advanced cloning than the old clone() method // did because it just shallow cloned the map. In this case, we want // to avoid all of the nasty cloneForSpatial() fixup style code that // used to inject stuff into the clone's user data. By using cloner // to clone the user data we get this automatically. if( userData != null ) { userData = (HashMap<String, Savable>)userData.clone(); for( Map.Entry<String, Savable> e : userData.entrySet() ) { Savable value = e.getValue(); if( value instanceof Cloneable ) { // Note: all JmeCloneable objects are also Cloneable so this // catches both cases. e.setValue(cloner.clone(value)); } } } }
Example 4
Source File: SkeletonControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void cloneFields( Cloner cloner, Object original ) { super.cloneFields(cloner, original); this.skeleton = cloner.clone(skeleton); // If the targets were cloned then this will clone them. If the targets // were shared then this will share them. this.targets = cloner.clone(targets); this.numberOfBonesParam = cloner.clone(numberOfBonesParam); this.boneMatricesParam = cloner.clone(boneMatricesParam); }
Example 5
Source File: TorsoLink.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Callback from {@link com.jme3.util.clone.Cloner} to convert this * shallow-cloned link into a deep-cloned one, using the specified cloner * and original to resolve copied fields. * * @param cloner the cloner that's cloning this link (not null) * @param original the instance from which this link was shallow-cloned * (unused) */ @Override public void cloneFields(Cloner cloner, Object original) { super.cloneFields(cloner, original); managedBones = cloner.clone(managedBones); endModelTransform = cloner.clone(endModelTransform); meshToModel = cloner.clone(meshToModel); prevBoneTransforms = cloner.clone(prevBoneTransforms); startBoneTransforms = cloner.clone(startBoneTransforms); startModelTransform = cloner.clone(startModelTransform); }
Example 6
Source File: Joint.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void cloneFields(Cloner cloner, Object original) { this.children = cloner.clone(children); this.parent = cloner.clone(parent); this.attachedNode = cloner.clone(attachedNode); this.targetGeometry = cloner.clone(targetGeometry); this.localTransform = cloner.clone(localTransform); this.inverseModelBindMatrix = cloner.clone(inverseModelBindMatrix); }
Example 7
Source File: PointLightShadowRenderer.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void cloneFields(final Cloner cloner, final Object original) { light = cloner.clone(light); init((int) shadowMapSize); frustums = null; super.cloneFields(cloner, original); }
Example 8
Source File: ChaseCamera.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void cloneFields( Cloner cloner, Object original ) { this.target = cloner.clone(target); computePosition(); prevPos = new Vector3f(target.getWorldTranslation()); cam.setLocation(pos); }
Example 9
Source File: AnimClip.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void cloneFields(Cloner cloner, Object original) { AnimTrack[] newTracks = new AnimTrack[tracks.length]; for (int i = 0; i < tracks.length; i++) { newTracks[i] = (cloner.clone(tracks[i])); } this.tracks = newTracks; }
Example 10
Source File: IntMap.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void cloneFields( Cloner cloner, Object original ) { this.value = cloner.clone(value); this.next = cloner.clone(next); }
Example 11
Source File: CharacterControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void cloneFields( Cloner cloner, Object original ) { this.spatial = cloner.clone(spatial); }
Example 12
Source File: LightList.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void cloneFields( Cloner cloner, Object original ) { this.owner = cloner.clone(owner); this.list = cloner.clone(list); this.distToOwner = cloner.clone(distToOwner); }
Example 13
Source File: AbstractControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void cloneFields( Cloner cloner, Object original ) { this.spatial = cloner.clone(spatial); }
Example 14
Source File: ParticleEmitter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void cloneFields( Cloner cloner, Object original ) { this.parentEmitter = cloner.clone(parentEmitter); }
Example 15
Source File: EmitterMeshVertexShape.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Called internally by com.jme3.util.clone.Cloner. Do not call directly. */ @Override public void cloneFields( Cloner cloner, Object original ) { this.vertices = cloner.clone(vertices); this.normals = cloner.clone(normals); }
Example 16
Source File: BatchNode.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void cloneFields(Cloner cloner, Object original) { this.geometry = cloner.clone(geometry); }
Example 17
Source File: MotionEvent.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void cloneFields( Cloner cloner, Object original ) { this.spatial = cloner.clone(spatial); }
Example 18
Source File: AbstractShadowFilter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void cloneFields(final Cloner cloner, final Object original) { material = cloner.clone(material); shadowRenderer = cloner.clone(shadowRenderer); shadowRenderer.setPostShadowMaterial(material); }
Example 19
Source File: GhostControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Callback from {@link com.jme3.util.clone.Cloner} to convert this * shallow-cloned control into a deep-cloned one, using the specified cloner * and original to resolve copied fields. * * @param cloner the cloner that's cloning this control (not null) * @param original the control from which this control was shallow-cloned * (unused) */ @Override public void cloneFields( Cloner cloner, Object original ) { this.spatial = cloner.clone(spatial); }
Example 20
Source File: Action.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Callback from {@link com.jme3.util.clone.Cloner} to convert this * shallow-cloned action into a deep-cloned one, using the specified cloner * and original to resolve copied fields. * * @param cloner the cloner that's cloning this action (not null) * @param original the action from which this action was shallow-cloned * (unused) */ @Override public void cloneFields(Cloner cloner, Object original) { actions = cloner.clone(actions); mask = cloner.clone(mask); }