away3d / away3d-core-fp10

Away3D engine for Flash Player 10

Home Page:http://www.away3d.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TextExtrusion.as

DarceyLloyd opened this issue · comments

  • Depth extrusion with light appear to be on wrong side of certain letters in different fonts (could be a font issue or wu getting data correct?)
  • Extrustion material doesn't change
  • Extrusion param back material doesn't do anything
  • Depth is not an essential param (not really a bug)

Here is code correction for allowing material to be supplied and depth to be a required param, replace constructor:

    public function TextExtrusion(mesh:Mesh,material:Material,depth:Number, init:Object=null)
    {
        super(init);

        _mesh = mesh;
        _face = face;
        _subdivisionsZ = ini.getNumber("subdivisionsZ", 1, {min:1, max:100});
        _subdivisionsXY = ini.getNumber("subdivisionsXY", 1, {min:1, max:100});
        //_depth = ini.getNumber("depth", 100); // Original code
        _depth = depth;


        //_material = mesh.material as Material; // Original code (locks material to mesh material
        _material = material;

        for each(var face:Face in mesh.faces)
        generateFaceExtrusion(face);
    }

Usage:
// Give 3D text some depth via TextExtrusion class
var extrusionMaterial:WireColorMaterial = new WireColorMaterial(0x666666);
var textExtrusion:TextExtrusion = new TextExtrusion(txt,extrusionMaterial,150);
textExtrusion.bothsides = true;
//textExtrusion.material = new WireColorMaterial(0x666666); // Dont work in 3.6 Dated: 27-07-2011
//textExtrusion.back = new WireColorMaterial(0x666666); // Dont work in 3.6 Dated: 27-07-2011
textExtrusion.z = txt.z;
scene.addChild(textExtrusion);