⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polygonattributes.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * Sets the face culling for this     * appearance component object.     * @param cullFace the face to be culled, one of:     * CULL_NONE, CULL_FRONT, or CULL_BACK     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setCullFace(int cullFace) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_CULL_FACE_WRITE))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes2"));        if (cullFace < CULL_NONE || cullFace > CULL_FRONT)          throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes3"));  	if (isLive()) 	    ((PolygonAttributesRetained)this.retained).setCullFace(cullFace);	else	    ((PolygonAttributesRetained)this.retained).initCullFace(cullFace);    }    /**     * Gets the face culling for this     * appearance component object.     * @return the face to be culled     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int getCullFace() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_CULL_FACE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes4"));        return ((PolygonAttributesRetained)this.retained).getCullFace();    }    /**     * Sets the back face normal flip flag to the specified value.     * This flag indicates whether vertex normals of back facing polygons     * should be flipped (negated) prior to lighting.  When this flag     * is set to true and back face culling is disabled, polygons are     * rendered as if the polygon had two sides with opposing normals.     * This feature is disabled by default.     * @param backFaceNormalFlip the back face normal flip flag     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setBackFaceNormalFlip(boolean backFaceNormalFlip) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_NORMAL_FLIP_WRITE))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes5"));	if (isLive())	    ((PolygonAttributesRetained)this.retained).setBackFaceNormalFlip(backFaceNormalFlip);	else 	    ((PolygonAttributesRetained)this.retained).initBackFaceNormalFlip(backFaceNormalFlip);    }    /**     * Gets the back face normal flip flag.     * @return the back face normal flip flag     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public boolean getBackFaceNormalFlip() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_NORMAL_FLIP_READ))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes6"));        return ((PolygonAttributesRetained)this.retained).getBackFaceNormalFlip();    }    /**     * Sets the polygon rasterization mode for this     * appearance component object.     * @param polygonMode the polygon rasterization mode to be used; one of     * POLYGON_FILL, POLYGON_LINE, or POLYGON_POINT     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setPolygonMode(int polygonMode) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_MODE_WRITE))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes7"));        if (polygonMode < POLYGON_POINT || polygonMode > POLYGON_FILL)          throw new IllegalArgumentException(J3dI18N.getString("PolygonAttributes8"));  	if (isLive())	    ((PolygonAttributesRetained)this.retained).setPolygonMode(polygonMode);	else 	    ((PolygonAttributesRetained)this.retained).initPolygonMode(polygonMode);    }    /**     * Gets the polygon rasterization mode for this     * appearance component object.     * @return the polygon rasterization mode     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int getPolygonMode() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_MODE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes9"));        return ((PolygonAttributesRetained)this.retained).getPolygonMode();    }    /**     * Sets the constant polygon offset to the specified value.     * This screen space     * offset is added to the final, device coordinate Z value of polygon     * primitives.     * @param polygonOffset the constant polygon offset     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setPolygonOffset(float polygonOffset) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_WRITE))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes10"));	if (isLive())	    ((PolygonAttributesRetained)this.retained).setPolygonOffset(polygonOffset);	else	    ((PolygonAttributesRetained)this.retained).initPolygonOffset(polygonOffset);    }    /**     * Gets the constant polygon offset.     * @return the constant polygon offset     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public float getPolygonOffset() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_READ))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes11"));        return ((PolygonAttributesRetained)this.retained).getPolygonOffset();    }    /**     * Sets the polygon offset factor to the specified value.     * This factor is multiplied by the slope of the polygon, and     * then added to the final, device coordinate Z value of polygon     * primitives.     * @param polygonOffsetFactor the polygon offset factor     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.2     */    public void setPolygonOffsetFactor(float polygonOffsetFactor) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_WRITE))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes10"));	if (isLive())	    ((PolygonAttributesRetained)this.retained).		setPolygonOffsetFactor(polygonOffsetFactor);	else	    ((PolygonAttributesRetained)this.retained).		initPolygonOffsetFactor(polygonOffsetFactor);    }    /**     * Gets the polygon offset factor.     * @return the polygon offset factor.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.2     */    public float getPolygonOffsetFactor() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_READ))              throw new CapabilityNotSetException(J3dI18N.getString("PolygonAttributes11"));	return ((PolygonAttributesRetained)this.retained).getPolygonOffsetFactor();    }    /**     * Creates a retained mode PolygonAttributesRetained object that this     * PolygonAttributes component object will point to.     */    void createRetained() {	this.retained = new PolygonAttributesRetained();	this.retained.setSource(this);    }   /**    * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate)      */    public NodeComponent cloneNodeComponent() {        PolygonAttributes pga = new PolygonAttributes();        pga.duplicateNodeComponent(this);        return pga;    }    /**     * Copies all node information from <code>originalNodeComponent</code> into     * the current node.  This method is called from the     * <code>duplicateNode</code> method. This routine does     * the actual duplication of all "local data" (any data defined in     * this object).      *     * @param originalNodeComponent the original node to duplicate.     * @param forceDuplicate when set to <code>true</code>, causes the     *  <code>duplicateOnCloneTree</code> flag to be ignored.  When     *  <code>false</code>, the value of each node's     *  <code>duplicateOnCloneTree</code> variable determines whether     *  NodeComponent data is duplicated or copied.     *     * @see Node#cloneTree     * @see NodeComponent#setDuplicateOnCloneTree     */    void duplicateAttributes(NodeComponent originalNodeComponent, 			     boolean forceDuplicate) { 	super.duplicateAttributes(originalNodeComponent, forceDuplicate);      	PolygonAttributesRetained attr = (PolygonAttributesRetained)	    originalNodeComponent.retained;	PolygonAttributesRetained rt = (PolygonAttributesRetained) retained;	rt.initCullFace(attr.getCullFace());	rt.initBackFaceNormalFlip(attr.getBackFaceNormalFlip());	rt.initPolygonMode(attr.getPolygonMode());	rt.initPolygonOffset(attr.getPolygonOffset());	rt.initPolygonOffsetFactor(attr.getPolygonOffsetFactor());    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -