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

📄 texcoordgeneration.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     */    public TexCoordGeneration(int genMode, int format, Vector4f planeS, 			      Vector4f planeT, Vector4f planeR) {        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);        ((TexCoordGenerationRetained)this.retained).initGenMode(genMode);	((TexCoordGenerationRetained)this.retained).initFormat(format);	((TexCoordGenerationRetained)this.retained).initPlaneS(planeS);	((TexCoordGenerationRetained)this.retained).initPlaneT(planeT);	((TexCoordGenerationRetained)this.retained).initPlaneR(planeR);    }    /**     * Constructs a TexCoordGeneration object with the specified genMode,     * format, and the S, T, R, and Q coordinate plane equations.     * @param genMode texture generation mode, one of: OBJECT_LINEAR,     * EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP     * @param format texture format, one of: TEXTURE_COORDINATE_2,     * TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4     * @param planeS plane equation for the S coordinate     * @param planeT plane equation for the T coordinate     * @param planeR plane equation for the R coordinate     * @param planeQ plane equation for the Q coordinate     *     * @see Canvas3D#queryProperties     *     * @since Java 3D 1.3     */    public TexCoordGeneration(int genMode, int format, Vector4f planeS, 			      Vector4f planeT, Vector4f planeR,			      Vector4f planeQ) {        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);        ((TexCoordGenerationRetained)this.retained).initGenMode(genMode);	((TexCoordGenerationRetained)this.retained).initFormat(format);	((TexCoordGenerationRetained)this.retained).initPlaneS(planeS);	((TexCoordGenerationRetained)this.retained).initPlaneT(planeT);	((TexCoordGenerationRetained)this.retained).initPlaneR(planeR);	((TexCoordGenerationRetained)this.retained).initPlaneQ(planeQ);    }    /**     * Enables or disables texture coordinate generation for this     * appearance component object.     * @param state true or false to enable or disable texture coordinate     * generation     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setEnable(boolean state) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_ENABLE_WRITE))              throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration0"));	if (isLive())	    ((TexCoordGenerationRetained)this.retained).setEnable(state);	else	    ((TexCoordGenerationRetained)this.retained).initEnable(state);    }    /**     * Retrieves the state of the texCoordGeneration enable flag.     * @return true if texture coordinate generation is enabled,     * false if texture coordinate generation is disabled     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public boolean getEnable() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_ENABLE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration1"));	return ((TexCoordGenerationRetained)this.retained).getEnable();    }    /**     * Sets the TexCoordGeneration format to the specified value.     * @param format texture format, one of: TEXTURE_COORDINATE_2,     * TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4     * @exception RestrictedAccessException if the method is called     * when this object is part of live or compiled scene graph.     */    public void setFormat(int format) {        checkForLiveOrCompiled();	((TexCoordGenerationRetained)this.retained).initFormat(format);    }    /**     * Retrieves the current TexCoordGeneration format.     * @return the texture format     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int getFormat() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_FORMAT_READ))              throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration2"));	return ((TexCoordGenerationRetained)this.retained).getFormat();    }    /**     * Sets the TexCoordGeneration generation mode to the specified value.     * @param genMode texture generation mode, one of: OBJECT_LINEAR,     * EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP.     * @exception RestrictedAccessException if the method is called     * when this object is part of live or compiled scene graph.     *     * @exception IllegalArgumentException if <code>genMode</code> is     * a value other than <code>OBJECT_LINEAR</code>, <code>EYE_LINEAR</code>,     * <code>SPHERE_MAP</code>, <code>NORMAL_MAP</code>, or      * <code>REFLECTION_MAP</code>.     *     * @see Canvas3D#queryProperties     */    public void setGenMode(int genMode) {        checkForLiveOrCompiled();	if ((genMode < OBJECT_LINEAR) || (genMode > REFLECTION_MAP)) {	    throw new IllegalArgumentException(		J3dI18N.getString("TexCoordGeneration5"));	}	((TexCoordGenerationRetained)this.retained).initGenMode(genMode);    }    /**     * Retrieves the current TexCoordGeneration generation mode.     * @return the texture generation mode     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int getGenMode() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_MODE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration3"));	return ((TexCoordGenerationRetained)this.retained).getGenMode();    }    /**     * Sets the S coordinate plane equation.  This plane equation     * is used to generate the S coordinate in OBJECT_LINEAR and EYE_LINEAR     * texture generation modes.     * @param planeS plane equation for the S coordinate     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     */    public void setPlaneS(Vector4f planeS) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PLANE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration6"));	if (isLive())	    ((TexCoordGenerationRetained)this.retained).setPlaneS(planeS);	else	    ((TexCoordGenerationRetained)this.retained).initPlaneS(planeS);    }    /**     * Retrieves a copy of the plane equation used to     * generate the S coordinate.     * @param planeS the S coordinate plane equation     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void getPlaneS(Vector4f planeS) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PLANE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration4"));	((TexCoordGenerationRetained)this.retained).getPlaneS(planeS);    }    /**     * Sets the T coordinate plane equation.  This plane equation     * is used to generate the T coordinate in OBJECT_LINEAR and EYE_LINEAR     * texture generation modes.     * @param planeT plane equation for the T coordinate     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     */    public void setPlaneT(Vector4f planeT) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PLANE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration6"));	if (isLive())	    ((TexCoordGenerationRetained)this.retained).setPlaneT(planeT);	else	    ((TexCoordGenerationRetained)this.retained).initPlaneT(planeT);    }    /**     * Retrieves a copy of the plane equation used to     * generate the T coordinate.     * @param planeT the T coordinate plane equation     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void getPlaneT(Vector4f planeT) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PLANE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration4"));	((TexCoordGenerationRetained)this.retained).getPlaneT(planeT);    }    /**     * Sets the R coordinate plane equation.  This plane equation     * is used to generate the R coordinate in OBJECT_LINEAR and EYE_LINEAR     * texture generation modes.     * @param planeR plane equation for the R coordinate     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     */    public void setPlaneR(Vector4f planeR) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PLANE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration6"));	if (isLive())	    ((TexCoordGenerationRetained)this.retained).setPlaneR(planeR);	else	    ((TexCoordGenerationRetained)this.retained).initPlaneR(planeR);    }    /**     * Retrieves a copy of the plane equation used to     * generate the R coordinate.     * @param planeR the R coordinate plane equation     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void getPlaneR(Vector4f planeR) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PLANE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration4"));	((TexCoordGenerationRetained)this.retained).getPlaneR(planeR);    }    /**     * Sets the Q coordinate plane equation.  This plane equation     * is used to generate the Q coordinate in OBJECT_LINEAR and EYE_LINEAR     * texture generation modes.     * @param planeQ plane equation for the Q coordinate     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void setPlaneQ(Vector4f planeQ) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PLANE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration6"));	if (isLive())	    ((TexCoordGenerationRetained)this.retained).setPlaneQ(planeQ);	else	    ((TexCoordGenerationRetained)this.retained).initPlaneQ(planeQ);    }    /**     * Retrieves a copy of the plane equation used to     * generate the Q coordinate.     * @param planeQ the Q coordinate plane equation     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void getPlaneQ(Vector4f planeQ) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_PLANE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("TexCoordGeneration4"));	((TexCoordGenerationRetained)this.retained).getPlaneQ(planeQ);    }    /**     * Creates a retained mode TexCoordGenerationRetained object that this     * TexCoordGeneration component object will point to.     */    void createRetained() {	this.retained = new TexCoordGenerationRetained();	this.retained.setSource(this);    }    /**     * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate)       */    public NodeComponent cloneNodeComponent() {        TexCoordGeneration tga = new TexCoordGeneration();        tga.duplicateNodeComponent(this);        return tga;    }    /**     * 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);      	TexCoordGenerationRetained tex = (TexCoordGenerationRetained) 	    originalNodeComponent.retained;	TexCoordGenerationRetained rt = (TexCoordGenerationRetained) retained;	Vector4f v = new Vector4f();	rt.initGenMode(tex.getGenMode());	tex.getPlaneS(v);	rt.initPlaneS(v);	tex.getPlaneT(v);	rt.initPlaneT(v);	tex.getPlaneR(v);	rt.initPlaneR(v);      	tex.getPlaneQ(v);	rt.initPlaneQ(v);      	rt.initFormat(tex.getFormat());	rt.initEnable(tex.getEnable());    }}

⌨️ 快捷键说明

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