zoukankan      html  css  js  c++  java
  • flare3d_Material3D_shader3D

    1、ParticleMaterial3D(Test08_Particles)
    texture = scene.addTextureFromFile( "http://wiki.flare3d.com/demos/resources/Cross_0005.jpg" );
    reflection = scene.addTextureFromFile( "http://wiki.flare3d.com/demos/resources/reflections.jpg" );

    var material:ParticleMaterial3D = new ParticleMaterial3D();
    material.filters.push( new TextureFilter( texture ) );
    material.filters.push( new ColorParticleFilter( [ 0xffff00, 0xff0000, 0x00ff00, 0x0000ff ], [1, 1, 1, 0]));
    material.build();
    var material2:ParticleMaterial3D = new ParticleMaterial3D()
    material2.filters.push( new TextureFilter( texture ) )
    material2.filters.push( new PlanarFilter( reflection, 200 ) );
    material2.filters.push( new ColorParticleFilter( [ 0xffffff, 0x0000ff ], [1, 0], [ 128, 255 ] ) );
    material2.build();
     2、Test10_Lights_And_Materials
            private var texture0:Texture3D;
    private var texture1:Texture3D;
    private var texture2:Texture3D;
    private var texture3:Texture3D;

    private var material0:Shader3D;
    private var material1:Shader3D;
    private var material2:Shader3D;
    private var material3:Shader3D;
    private var material4:Shader3D;
    private var material5:Shader3D;

    texture0 = scene.addTextureFromFile( "http://wiki.flare3d.com/demos/resources/r42.jpg" );
    texture1 = scene.addTextureFromFile( "http://wiki.flare3d.com/demos/resources/mask.png" );
    texture2 = scene.addTextureFromFile( "http://wiki.flare3d.com/demos/resources/gorda.png" );
    texture3 = scene.addTextureFromFile( "http://wiki.flare3d.com/demos/resources/rusty.png" );
     
           //得到人物的Material , 设置他的透明度 , Layer
    material0 = elsa.getMaterialByName( "mElsa" ) as Shader3D;
    material0.filters[0].alpha = 0.75;
    elsa.setLayer( 10 );

    //
    material1 = new Shader3D( "test1" );
    material1.filters.push( new TextureFilter( new Texture3D( "../resources/r42.jpg" ) ) );
    material1.filters.push( new TextureFilter( texture1 ) ); // texture with alpha.
    material1.build();
    clone1.setMaterial( material1 );

    //
    material2 = new Shader3D( "test2" );
    material2.filters.push( new TextureFilter( texture2 ) );
    material2.filters.push( new EnvironmentFilter( texture3, BlendMode.MULTIPLY, 2 ) );
    material2.build();
    clone2.setMaterial( material2 );

    // test 3 - clone the material and add a new filter.
    material3 = material2.clone() as Shader3D;
    material3.filters.push( new ColorFilter( 0xff0000, 1, BlendMode.MULTIPLY ) );
    material3.filters.push( new SpecularFilter( 200, 10 ) );
    material3.build();
    clone3.setMaterial( material3 );

    // test 4 - no lights.        Shader3D(name:String="", filters:Array=null, enableLights:Boolean=true, technique:FLSLFilter=null)
    material4 = new Shader3D( "test4", null, false );
    material4.filters = material1.filters; // if we set the filters directly, don't need to call the build() method to compile.
    clone4.setMaterial( material4 );

    // test 5 - alpha mask.
    material5 = new Shader3D( "test5" );
    material5.filters.push( new TextureFilter( texture1 ) );
    material5.filters.push( new AlphaMaskFilter( 0.5 ) );
    material5.build();
    material5.twoSided = true;
    clone5.setMaterial( material5 );

    scene.addEventListener( Scene3D.UPDATE_EVENT, updateEvent );
    }
          private function updateEvent(e:Event):void 
    		{ 
    			// modify the ColorFilter.
    			material3.filters[2].r = Math.cos( getTimer() / 600 ) * 0.5 + 0.5;
    			material3.filters[2].g = Math.cos( getTimer() / 700 ) * 0.5 + 0.5;
    			material3.filters[2].b = Math.cos( getTimer() / 800 ) * 0.5 + 0.5;
    		}


    
    

  • 相关阅读:
    JSON操作技巧
    我的前端学习历程(转)
    sql指南网址
    using 和try/catch区别和注意点
    【转】StringBuffer的用法与string的区别
    【转】比较page、request、session、application的使用范围
    【转】StringBuilder用法
    【转】.Net高级技术——IDisposable
    【转】.NET快速查找某个类所在的命名空间
    【转】VS2010安装包制作
  • 原文地址:https://www.cnblogs.com/xiaowai/p/2364356.html
Copyright © 2011-2022 走看看