示例#1
0
        public warp_FXLensFlare(String name, warp_Scene scene, bool zBufferSensitive) : base(scene)
        {
            this.zBufferSensitive = zBufferSensitive;

            flareObject = new warp_Object();
            flareObject.addVertex(new warp_Vertex(1f, 1f, 1f));
            flareObject.rebuild();

            scene.addObject(name, flareObject);
        }
示例#2
0
        public static void projectFrontal(warp_Object obj)
        {
            obj.rebuild();
            warp_Vector min = obj.minimum();
            warp_Vector max = obj.maximum();
            float       du  = 1 / (max.x - min.x);
            float       dv  = 1 / (max.y - min.y);

            for (int i = 0; i < obj.vertices; i++)
            {
                obj.fastvertex[i].u = (obj.fastvertex[i].pos.x - min.x) * du;
                obj.fastvertex[i].v = 1 - (obj.fastvertex[i].pos.y - min.y) * dv;
            }
        }
示例#3
0
        public static void projectCylindric(warp_Object obj)
        {
            obj.rebuild();
            warp_Vector min = obj.minimum();
            warp_Vector max = obj.maximum();
            float       dz  = 1 / (max.z - min.z);

            for (int i = 0; i < obj.vertices; i++)
            {
                obj.fastvertex[i].pos.buildCylindric();
                obj.fastvertex[i].u = obj.fastvertex[i].pos.theta / (2 * 3.14159265f);
                obj.fastvertex[i].v = (obj.fastvertex[i].pos.z - min.z) * dz;
            }
        }
示例#4
0
        public warp_Object getClone()
        {
            warp_Object obj = new warp_Object();

            rebuild();
            for (int i = 0; i < vertices; i++)
            {
                obj.addVertex(fastvertex[i].getClone());
            }
            for (int i = 0; i < triangles; i++)
            {
                obj.addTriangle(fasttriangle[i].getClone());
            }
            obj.name         = name + " [cloned]";
            obj.material     = material;
            obj.matrix       = matrix.getClone();
            obj.normalmatrix = normalmatrix.getClone();
            obj.rebuild();
            return(obj);
        }