📄 interpolator.java
字号:
/* * $RCSfile: Interpolator.java,v $ * * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * * Use is subject to license terms. * * $Revision: 1.5 $ * $Date: 2007/02/09 17:18:06 $ * $State: Exp $ */package javax.media.j3d;import java.util.Vector;/** * Interpolator is an abstract class that extends Behavior to provide * common methods used by various interpolation subclasses. These * include methods to convert a time value into an alpha value (A * value in the range 0 to 1) and a method to initialize the behavior. * Subclasses provide the methods that convert alpha values into * values within that subclass' output range. */public abstract class Interpolator extends Behavior { // This interpolator's alpha generator Alpha alpha; /** * Default WakeupCondition for all interpolators. The * wakeupOn method of Behavior, which takes a WakeupCondition as * the method parameter, will need to be called at the end * of the processStimulus method of any class that subclasses * Interpolator; this can be done with the following method call: * wakeupOn(defaultWakeupCriterion). */ protected WakeupCriterion defaultWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(0); /** * Constructs an Interpolator node with a null alpha value. */ public Interpolator() { } /** * Constructs an Interpolator node with the specified alpha value. * @param alpha the alpha object used by this interpolator. * If it is null, then this interpolator will not run. */ public Interpolator(Alpha alpha){ this.alpha = alpha; } /** * Retrieves this interpolator's alpha object. * @return this interpolator's alpha object */ public Alpha getAlpha() { return this.alpha; } /** * Set this interpolator's alpha to the specified alpha object. * @param alpha the new alpha object. If set to null, * then this interpolator will stop running. */ public void setAlpha(Alpha alpha) { this.alpha = alpha; VirtualUniverse.mc.sendRunMessage(J3dThread.RENDER_THREAD); } /** * This is the default Interpolator behavior initialization routine. * It schedules the behavior to awaken at the next frame. */ public void initialize() { // Reset alpha //alpha.setStartTime(J3dClock.currentTimeMillis()); // Insert wakeup condition into queue wakeupOn(defaultWakeupCriterion); } /** * Copies all Interpolator 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); Interpolator it = (Interpolator) originalNode; Alpha a = it.getAlpha(); if (a != null) { setAlpha(a.cloneAlpha()); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -