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

📄 conesound.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     * The arrays must be large enough to hold all of the     * forward distances and backward distances attenuation values.     * The individual array elements must be allocated by the     * caller. The Point2f x,y values are defined as follows:     * x is the distance, y is the gain.     * @param frontAttenuation arrays containing forward distances      * attenuation pairs     * @param backAttenuation arrays containing backward distances      * attenuation pairs     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */     public void getDistanceGain(Point2f[] frontAttenuation,                                      Point2f[] backAttenuation) {         if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_DISTANCE_GAIN_READ))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound2"));          ((ConeSoundRetained)this.retained).getDistanceGain(                   frontAttenuation, backAttenuation);    }    /**     * Gets this sound's elliptical distance gain attenuation values in      * separate arrays. The arrays must be large enough to hold all     * of the values.     * @param frontDistance array of float distances along the sound axis     * @param frontGain array of non-negative scale factors associated with      * front distances     * @param backDistance array of float negative distances along the sound      * axis     * @param backGain array of non-negative scale factors associated with      * back distances     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */     public void getDistanceGain(float[] frontDistance, float[] frontGain,                                      float[] backDistance, float[] backGain) {         if (isLiveOrCompiled())        if(!this.getCapability(ALLOW_DISTANCE_GAIN_READ))            throw new CapabilityNotSetException(J3dI18N.getString("ConeSound10"));              ((ConeSoundRetained)this.retained).getDistanceGain(                 frontDistance, frontGain, backDistance, backGain);    }    /**     * Sets this sound's direction from the vector provided.     * @param direction the new direction     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setDirection(Vector3f direction) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_DIRECTION_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound3"));           ((ConeSoundRetained)this.retained).setDirection(direction);    }    /**     * Sets this sound's direction from the three values provided.     * @param x the new x direction     * @param y the new y direction     * @param z the new z direction     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setDirection(float x, float y, float z) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_DIRECTION_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound3"));        ((ConeSoundRetained)this.retained).setDirection(x,y,z);    }    /**     * Retrieves this sound's direction and places it in the     * vector provided.     * @param direction axis of cones; 'direction' of sound     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void getDirection(Vector3f direction) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_DIRECTION_READ))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound5"));       ((ConeSoundRetained)this.retained).getDirection(direction);    }    /**     * Sets this sound's angular gain attenuation (not including filter).     * In this form of setAngularAttenuation, only the angular distances      * and angular gain scale factors pairs are given. The filter values for      * these tuples are implicitly set to Sound.NO_FILTER.      * @param attenuation array containing angular distance and gain     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setAngularAttenuation(Point2f[] attenuation) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_ANGULAR_ATTENUATION_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound6"));        ((ConeSoundRetained)this.retained).setAngularAttenuation(attenuation);    }    /**     * In the second form of setAngularAttenuation, an array of all three values      * is supplied.     * @param attenuation array containing angular distance, gain, and filter     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setAngularAttenuation(Point3f[] attenuation) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_ANGULAR_ATTENUATION_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound6"));        ((ConeSoundRetained)this.retained).setAngularAttenuation(attenuation);    }    /**     * Sets angular attenuation including gain and filter using separate arrays.     * The third form of setAngularAttenuation accepts three separate arrays for     * these angular attenuation values. These arrays should be of the same     * length.  If the angularGain or filtering array length is greater than     * angularDistance array length, the array elements beyond the length of     * the angularDistance array are ignored. If the angularGain or filtering     * array is shorter than the angularDistance array, the last value of the     * short array is repeated to fill an array of length equal to      * angularDistance array.     * @param distance array containing angular distance     * @param gain array containing angular gain attenuation     * @param filter array containing angular low-pass frequency cutoff values     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setAngularAttenuation(float[] distance, float[] gain,                                         float[] filter) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_ANGULAR_ATTENUATION_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound6"));        ((ConeSoundRetained)this.retained).setAngularAttenuation(distance,                      gain, filter);    }    /**     * Retrieves angular attenuation array length.     * All arrays are forced to same size.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */      public int getAngularAttenuationLength() {        if (isLiveOrCompiled())             if(!this.getCapability(ALLOW_ANGULAR_ATTENUATION_READ))                 throw new CapabilityNotSetException(J3dI18N.getString("ConeSound9"));         return (((ConeSoundRetained)this.retained).getAngularAttenuationLength());    }    /**     * Copies the array of attenuation values from this sound, including      * gain and filter, into the specified array. The array must be     * large enough to hold all of the points. The individual array     * elements must be allocated by the caller. The Point3f x,y,z values     * are defined as follows: x is the angular distance, y is     * the angular gain attenuation, and z is the frequency     * cutoff.     * @param attenuation the array to receive the attenuation values      * applied to gain when listener is between cones     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void getAngularAttenuation(Point3f[] attenuation) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_ANGULAR_ATTENUATION_READ))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound9"));       ((ConeSoundRetained)this.retained).getAngularAttenuation(attenuation);    }    /**     * Copies the array of attenuation values from this sound,     * including gain and filter, into the separate arrays.     * The arrays must be large enough to hold all of the values.     * @param distance array containing angular distance     * @param gain array containing angular gain attenuation     * @param filter array containing angular low-pass frequency cutoff values     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void getAngularAttenuation(float[] distance, float[] gain,                                         float[] filter) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_ANGULAR_ATTENUATION_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("ConeSound9"));        ((ConeSoundRetained)this.retained).getAngularAttenuation(distance,                      gain, filter);    }    /**     * Creates a new instance of the node.  This routine is called     * by <code>cloneTree</code> to duplicate the current node.     * @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 Node#cloneNode     * @see Node#duplicateNode     * @see NodeComponent#setDuplicateOnCloneTree     */    public Node cloneNode(boolean forceDuplicate) {        ConeSound c = new ConeSound();        c.duplicateNode(this, forceDuplicate);        return c;    }    /**     * Copies all node information from <code>originalNode</code> into     * the current node.  This method is called from the     * <code>cloneNode</code> method which is, in turn, called by the     * <code>cloneTree</code> method.     * <P>     * For any <code>NodeComponent</code> objects     * contained by the object being duplicated, each <code>NodeComponent</code>     * object's <code>duplicateOnCloneTree</code> value is used to determine     * whether the <code>NodeComponent</code> should be duplicated in the new node     * or if just a reference to the current node should be placed in the     * new node.  This flag can be overridden by setting the     * <code>forceDuplicate</code> parameter in the <code>cloneTree</code>     * method to <code>true</code>.     *     * <br>     * NOTE: Applications should <i>not</i> call this method directly.     * It should only be called by the cloneNode method.     *     * @param originalNode 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.     * @exception ClassCastException if originalNode is not an instance of      *  <code>ConeSound</code>     *     * @see Node#cloneTree     * @see Node#cloneNode     * @see NodeComponent#setDuplicateOnCloneTree     */    public void duplicateNode(Node originalNode, boolean forceDuplicate) {	checkDuplicateNode(originalNode, forceDuplicate);    }   /**     * Copies all ConeSound information from     * <code>originalNode</code> into     * the current node.  This method is called from the     * <code>cloneNode</code> method which is, in turn, called by the     * <code>cloneTree</code> method.<P>      *     * @param originalNode 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.     *     * @exception RestrictedAccessException if this object is part of a live     *  or compiled scenegraph.     *     * @see Node#duplicateNode     * @see Node#cloneTree     * @see NodeComponent#setDuplicateOnCloneTree     */    void duplicateAttributes(Node originalNode, boolean forceDuplicate) {	super.duplicateAttributes(originalNode, forceDuplicate);	ConeSoundRetained orgRetained = (ConeSoundRetained)originalNode.retained;	ConeSoundRetained thisRetained = (ConeSoundRetained)this.retained;	// front distance gain & attenuation is set in super      	// set back distance gain only	int len = orgRetained.getDistanceGainLength();	float distance[] = new float[len];	float gain[] = new float[len];	orgRetained.getDistanceGain(null, null,distance, gain);	thisRetained.setBackDistanceGain(distance, gain);		Vector3f v = new Vector3f();	orgRetained.getDirection(v);	thisRetained.setDirection(v);		len = orgRetained.getAngularAttenuationLength();	distance = gain = null;	float angle[] = new float[len];	float angularGain[] = new float[len];	float frequencyCutoff[] = new float[len];	orgRetained.getAngularAttenuation(angle, angularGain,				    frequencyCutoff);	thisRetained.setAngularAttenuation(angle, angularGain, frequencyCutoff);    }}

⌨️ 快捷键说明

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