public LightMap(ModelInstance mi, Mesh m) { model = mi; mesh = m; width = mesh.texels.GetLength(0); height = mesh.texels.GetLength(1); texels = new Texel[width,height]; patches = new List<Patch>(); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { texels[i,j] = new Texel(); foreach (Patch p in mesh.texels[i,j].patches) { Patch temp = new Patch(p,model.transform); texels[i,j].add(temp); patches.Add(temp); } } } name = "lm" + model.layoutName + "_" + convertToBase36(model.id) + "_0" + mesh.id; }
public Patch(Patch p, Matrix4 transform) : this( p.position, p.normal, p.emmission, new Vector3()/*p.reflectance*/) { position = Vector3.Transform(p.position, transform); normal = Vector3.Transform(p.normal, transform) - transform.Row3.Xyz; }
public void add(Patch p) { patches.Add(p); }
public Patch(Patch p, Matrix4 transform) : this(p.position, p.normal, p.emmission, new Vector3() /*p.reflectance*/) { position = Vector3.Transform(p.position, transform); normal = Vector3.Transform(p.normal, transform) - transform.Row3.Xyz; }