忍者ブログ

Memeplexes

プログラミング、3DCGとその他いろいろについて

XNA爆発チュートリアル 番外(リファクタリング)

エフェクトファイルのコードを見返していて気付いたところがあったので
簡略化します。

リファクタリング前

ExplosionVertexShaderOutput ExplosionVertexShader(float4 velocity:COLOR)
{
        ExplosionVertexShaderOutput output;
        float4 worldPosition = float4(velocity.xyz * Age + Center, 1);

リファクタリング後

ExplosionVertexShaderOutput ExplosionVertexShader(float3 velocity:COLOR)
{
        ExplosionVertexShaderOutput output;
        float4 worldPosition = float4(velocity * Age + Center, 1);

このほうがずっと簡単ですね。

拍手[0回]

PR