当前位置: 首页>>代码示例>>Java>>正文


Java FastMath.interpolateLinear方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:PositionTrack.java

示例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));
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:RotationTrack.java

示例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();
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:9,代码来源:LinearMove.java

示例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();
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:9,代码来源:CurveMove.java

示例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();
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:78,代码来源:ParticleEmitter.java

示例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);
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:7,代码来源:SizeInfluencer.java


注:本文中的com.jme3.math.FastMath.interpolateLinear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。