/** * Creates the retained mode NodeComponentRetained object that this * NodeComponent object will point to. */ @Override void createRetained() { this.retained = new NodeComponentRetained(); this.retained.setSource(this); }
@Override synchronized void addAMirrorUser(Shape3DRetained shape) { super.addAMirrorUser(shape); ShaderAttributeRetained[] sAttrsRetained = new ShaderAttributeRetained[attrs.size()]; sAttrsRetained = attrs.values().toArray(sAttrsRetained); for(int i=0; i < sAttrsRetained.length; i++) { sAttrsRetained[i].addAMirrorUser(shape); } }
/** * An abstract method to validate the texture unit state component */ final void setTextureUnitStateComponent(NodeComponent comp, NodeComponentRetained thisComp, int messageOp) { if (source.isLive()) { if ((comp == null && thisComp == null) || (comp != null && comp.retained == thisComp)) return; if (thisComp != null) { thisComp.clearLive(refCount); thisComp.removeMirrorUsers(this); } if (comp != null) { ((NodeComponentRetained)comp.retained).setLive(inBackgroundGroup, refCount); // If texture unit is live, then copy all the users of this // texture unit state as users of this texture component ((NodeComponentRetained)comp.retained).copyMirrorUsers(this); } if (messageOp != -1) { sendMessage(messageOp, (comp == null ? null : ((NodeComponentRetained)comp.retained).mirror)); } } }
@Override void setLive(boolean backgroundGroup, int refCount) { // System.err.println("ShaderProgramRetained.setLive()"); if (shaders != null) { for (int i = 0; i < shaders.length; i++){ shaders[i].setLive(backgroundGroup, refCount); } } super.doSetLive(backgroundGroup, refCount); super.markAsLive(); }
@Override void clearLive(int refCount) { // System.err.println("SourceCodeShaderRetained.clearLive()"); super.clearLive(refCount); }
@Override protected Object clone() { ColoringAttributesRetained cr = (ColoringAttributesRetained)super.clone(); cr.color = new Color3f(color); // shadeModel is copied in super.clone() return cr; }
void setLive(boolean inBackgroundGroup, int refCount) { int oldRefCount = this.refCount; doSetLive(inBackgroundGroup, refCount); if (oldRefCount <= 0) { super.markAsLive(); } }
@Override synchronized void copyMirrorUsers(NodeComponentRetained node) { super.copyMirrorUsers(node); ShaderAttributeRetained[] sAttrsRetained = new ShaderAttributeRetained[attrs.size()]; sAttrsRetained = attrs.values().toArray(sAttrsRetained); for(int i=0; i < sAttrsRetained.length; i++) { sAttrsRetained[i].copyMirrorUsers(node); } }
@Override boolean getInImmCtx() { return (super.getInImmCtx() || ((texture != null) && (texture.getInImmCtx())) || ((texAttrs != null) && (texAttrs.getInImmCtx())) || ((texGen != null) && (texGen.getInImmCtx()))); }
void createMirrorObject() { // Overridden by appearance and other classes initMirrorObject(); mirror = null; }
/** * Returns this node's duplicateOnCloneTree value. The * <i>duplicateOnCloneTree</i> value is used to determine if NodeComponent * objects are to be duplicated or referenced during a * <code>cloneTree</code> operation. A value of <code>true</code> means * that this NodeComponent object should be duplicated, while a value * of <code>false</code> indicates that this NodeComponent object's * reference will be copied into the newly cloned object. This value * can be overriden via the <code>forceDuplicate</code> parameter of * the <code>cloneTree</code> method. * @return the value of this node's duplicateOnCloneTree * @see Node#cloneTree */ public boolean getDuplicateOnCloneTree() { return ((NodeComponentRetained)retained).getDuplicateOnCloneTree(); }
void doSetLive(boolean inBackgroundGroup, int refCount) { int oldRefCount = this.refCount; this.refCount += refCount; if (oldRefCount <= 0) { super.doSetLive(inBackgroundGroup); // Create and init a mirror object if not already there // The two procedures is combined since it is redunctant to // call initMirrorObject() if mirror == this (static object). createMirrorObject(); } }
@Override void setLive(boolean backgroundGroup, int refCount) { // System.err.println("ShaderAttributeSetRetained.setLive()"); ShaderAttributeRetained[] sAttrsRetained = new ShaderAttributeRetained[attrs.size()]; sAttrsRetained = attrs.values().toArray(sAttrsRetained); for(int i=0; i < sAttrsRetained.length; i++) { sAttrsRetained[i].setLive(backgroundGroup, refCount); } super.doSetLive(backgroundGroup, refCount); super.markAsLive(); }
@Override void clearLive(int refCount) { // System.err.println("ShaderAttributeSetRetained.clearLive()"); super.clearLive(refCount); ShaderAttributeRetained[] sAttrsRetained = new ShaderAttributeRetained[attrs.size()]; sAttrsRetained = attrs.values().toArray(sAttrsRetained); for(int i=0; i < sAttrsRetained.length; i++) { sAttrsRetained[i].clearLive(refCount); } }
@Override protected Object clone() { TextureUnitStateRetained tr = (TextureUnitStateRetained)super.clone(); // the cloned object is used for RenderBin only. // In most cases, it will duplicate all attributes in the RenderBin // so that updating a mirror object in one level will not affect the // entire structure of the RenderBin, but will affect only those bins // that got affected by the modified mirror object if (this.texAttrs != null) tr.texAttrs = (TextureAttributesRetained)this.texAttrs.clone(); if (this.texGen != null) tr.texGen = (TexCoordGenerationRetained)this.texGen.clone(); return tr; }
/** * This setLive routine calls the superclass's method when reference * count is 1 */ @Override void doSetLive(boolean inBackgroundGroup, int refCount) { super.doSetLive(inBackgroundGroup, refCount); this.update(); this.computeBoundingBox(); }
@Override synchronized void copyMirrorUsers(NodeComponentRetained node) { super.copyMirrorUsers(node); if (texture != null) texture.copyMirrorUsers(node); if (texAttrs != null) texAttrs.copyMirrorUsers(node); if (texGen != null) texGen.copyMirrorUsers(node); }
void validateImageIllegalSharing(ImageComponent image) { // Do illegal sharing check if(image != null) { ImageComponentRetained imageRetained = (ImageComponentRetained) image.retained; NodeComponentRetained ncRetained = (NodeComponentRetained)this.retained; if(imageRetained.getUsedByOffScreen()) { if(isLive()) { throw new IllegalSharingException(J3dI18N.getString("NodeComponent2")); } if(ncRetained.getInImmCtx()) { throw new IllegalSharingException(J3dI18N.getString("NodeComponent3")); } } } }
@Override void setLive(boolean backgroundGroup, int refCount) { if (texture != null) texture.setLive(backgroundGroup, refCount); if (texAttrs != null) texAttrs.setLive(backgroundGroup, refCount); if (texGen != null) texGen.setLive(backgroundGroup, refCount); // Increment the reference count and initialize the textureUnitState // mirror object super.doSetLive(backgroundGroup, refCount); super.markAsLive(); }
@Override void clearLive(int refCount) { // System.err.println("ShaderProgramRetained.clearLive()"); super.clearLive(refCount); if (shaders != null) { for (int i = 0; i < shaders.length; i++) { shaders[i].clearLive(refCount); } } }