本文整理汇总了Java中com.jme3.math.FastMath.interpolateLinear方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.interpolateLinear方法的具体用法?Java FastMath.interpolateLinear怎么用?Java FastMath.interpolateLinear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.math.FastMath
的用法示例。
在下文中一共展示了FastMath.interpolateLinear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
import com.jme3.math.FastMath; //导入方法依赖的package包/类
@Override
public void onUpdate(float tpf) {
if (spatial != null) {
value += Math.min(tpf * speed / duration, 1.0f);
Vector3f pos = FastMath.interpolateLinear(value, startPosition, endPosition);
spatial.setLocalTranslation(pos);
}
}
示例2: onUpdate
import com.jme3.math.FastMath; //导入方法依赖的package包/类
@Override
public void onUpdate(float tpf) {
if (spatial != null) {
value += Math.min(tpf * speed / duration, 1.0f);
float[] rot = new float[3];
rot[0] = FastMath.interpolateLinear(value, startRotation[0], endRotation[0]);
rot[1] = FastMath.interpolateLinear(value, startRotation[1], endRotation[1]);
rot[2] = FastMath.interpolateLinear(value, startRotation[2], endRotation[2]);
spatial.setLocalRotation(new Quaternion().fromAngles(rot));
}
}
示例3: doScale
import com.jme3.math.FastMath; //导入方法依赖的package包/类
@Override
protected void doScale(Spatial ui, float factor) {
float scale = FastMath.interpolateLinear(factor, startScale, endScale);
TempVars tv = TempVars.get();
tv.vect1.set(originScale).multLocal(scale);
ui.setLocalScale(tv.vect1);
tv.release();
}
示例4: doScale
import com.jme3.math.FastMath; //导入方法依赖的package包/类
@Override
protected void doScale(Spatial spatial, float factor) {
float scale = FastMath.interpolateLinear(factor, startScale, endScale);
TempVars tv = TempVars.get();
tv.vect1.set(originScale).multLocal(scale);
spatial.setLocalScale(tv.vect1);
tv.release();
}
示例5: updateParticleState
import com.jme3.math.FastMath; //导入方法依赖的package包/类
private void updateParticleState(float tpf) {
// Force world transform to update
this.getWorldTransform();
TempVars vars = TempVars.get();
Vector3f min = vars.vect1.set(Vector3f.POSITIVE_INFINITY);
Vector3f max = vars.vect2.set(Vector3f.NEGATIVE_INFINITY);
for (int i = 0; i < particles.length; ++i) {
Particle p = particles[i];
if (p.life == 0) { // particle is dead
// assert i <= firstUnUsed;
continue;
}
p.life -= tpf;
if (p.life <= 0) {
this.freeParticle(i);
continue;
}
// position += velocity * tpf
//p.distToCam = -1;
// applying gravity
p.velocity.x -= gravity.x * tpf;
p.velocity.y -= gravity.y * tpf;
p.velocity.z -= gravity.z * tpf;
temp.set(p.velocity).multLocal(tpf);
p.position.addLocal(temp);
// affecting color, size and angle
float b = (p.startlife - p.life) / p.startlife;
p.color.interpolate(startColor, endColor, b);
p.size = FastMath.interpolateLinear(b, startSize, endSize);
p.angle += p.rotateSpeed * tpf;
// Computing bounding volume
temp.set(p.position).addLocal(p.size, p.size, p.size);
max.maxLocal(temp);
temp.set(p.position).subtractLocal(p.size, p.size, p.size);
min.minLocal(temp);
if (!selectRandomImage) {
p.imageIndex = (int) (b * imagesX * imagesY);
}
if (firstUnUsed < i) {
this.swap(firstUnUsed, i);
if (i == lastUsed) {
lastUsed = firstUnUsed;
}
firstUnUsed++;
}
}
float particlesToEmitF = particlesPerSec * tpf;
int particlesToEmit = (int) particlesToEmitF;
emitCarry += particlesToEmitF - particlesToEmit;
while (emitCarry > 1f) {
++particlesToEmit;
emitCarry -= 1f;
}
for (int i = 0; i < particlesToEmit; ++i) {
this.emitParticle(min, max);
}
BoundingBox bbox = (BoundingBox) this.getMesh().getBound();
bbox.setMinMax(min, max);
this.setBoundRefresh();
vars.release();
}
示例6: update
import com.jme3.math.FastMath; //导入方法依赖的package包/类
@Override
public void update(ElementParticle particle, float tpf) {
if (isEnabled) {
particle.size = FastMath.interpolateLinear(interpolation.apply(particle.blend), startSize, endSize);
}
}