當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。