Ejemplo n.º 1
0
 public DetailMesh(DetailMesh d)
 {
     mesh             = d.mesh;
     material         = d.material;
     meshFraction     = d.meshFraction;
     meshOffsetUp     = d.meshOffsetUp;
     meshScale        = d.meshScale;
     useGPUInstancing = d.useGPUInstancing;
     isGrass          = d.isGrass;
     posRots          = new PosRot[0];
 }
Ejemplo n.º 2
0
 public DetailMesh()
 {
     mesh             = null;
     material         = null;
     meshFraction     = 0.001f;
     meshOffsetUp     = 2.5f;
     meshScale        = Vector3.one;
     useGPUInstancing = false;
     isGrass          = false;
     posRots          = new PosRot[0];
 }
Ejemplo n.º 3
0
        public DetailMesh(Mesh mesh, Material material)
        {
            this.mesh     = mesh;
            this.material = material;

            meshFraction     = 0.001f;
            meshOffsetUp     = 2.5f;
            meshScale        = Vector3.one;
            useGPUInstancing = false;
            isGrass          = false;
            posRots          = new PosRot[0];
        }
Ejemplo n.º 4
0
        public PosRot[] Positions(float fraction, DetailObject d)
        {
            int i       = Mathf.RoundToInt((1f - fraction) * positions.Count);
            var posrots = new PosRot[(positions.Count - i)];

            Vector3    rdown = rotation * down;
            Quaternion rot   = Quaternion.LookRotation(-rdown) * Quaternion.Euler(90f, 0f, 0f);
            Vector3    pos   = position + (rdown * -d.meshOffsetUp);
            int        j     = 0;

            for (; i < positions.Count; i++)
            {
                posrots[j] = new PosRot(positions[i] + pos, rot);
                j++;
            }

            int x = Mathf.RoundToInt((1f - fraction) * positions.Count);
            int l = positions.Count - x;

            positions.RemoveRange(x, l);
            indicies.RemoveRange(x, l);
            normals.RemoveRange(x, l);
            return(posrots);
        }