public bool Equals(BspGeometryVertex other) { return Position == other.Position && Normal == other.Normal && UV0 == other.UV0 && UV1 == other.UV1 && Color == other.Color; }
private void TessalateFace(IList<BspGeometryFace> faces, BspGeometryFace f) { var v01 = new BspGeometryVertex() { Normal = f.Vertex0.Normal, Position = (f.Vertex0.Position + f.Vertex1.Position)*0.5f, UV0 = (f.Vertex0.UV0 + f.Vertex1.UV0) * 0.5f, UV1 = (f.Vertex0.UV1 + f.Vertex1.UV1) * 0.5f, Color = Color.FromArgb( (byte)(((int)f.Vertex0.Color.A + (int)f.Vertex1.Color.A) / 2), (byte)(((int)f.Vertex0.Color.R + (int)f.Vertex1.Color.R) / 2), (byte)(((int)f.Vertex0.Color.G + (int)f.Vertex1.Color.G) / 2), (byte)(((int)f.Vertex0.Color.B + (int)f.Vertex1.Color.B) / 2)) }; var v02 = new BspGeometryVertex() { Normal = f.Vertex0.Normal, Position = (f.Vertex0.Position + f.Vertex2.Position)*0.5f, UV0 = (f.Vertex0.UV0 + f.Vertex2.UV0) * 0.5f, UV1 = (f.Vertex0.UV1 + f.Vertex2.UV1) * 0.5f, Color = Color.FromArgb( (byte)(((int)f.Vertex0.Color.A + (int)f.Vertex2.Color.A) / 2), (byte)(((int)f.Vertex0.Color.R + (int)f.Vertex2.Color.R) / 2), (byte)(((int)f.Vertex0.Color.G + (int)f.Vertex2.Color.G) / 2), (byte)(((int)f.Vertex0.Color.B + (int)f.Vertex2.Color.B) / 2)) }; var v12 = new BspGeometryVertex() { Normal = f.Vertex1.Normal, Position = (f.Vertex1.Position + f.Vertex2.Position)*0.5f, UV0 = (f.Vertex1.UV0 + f.Vertex2.UV0) * 0.5f, UV1 = (f.Vertex1.UV1 + f.Vertex2.UV1) * 0.5f, Color = Color.FromArgb( (byte)(((int)f.Vertex1.Color.A + (int)f.Vertex2.Color.A) / 2), (byte)(((int)f.Vertex1.Color.R + (int)f.Vertex2.Color.R) / 2), (byte)(((int)f.Vertex1.Color.G + (int)f.Vertex2.Color.G) / 2), (byte)(((int)f.Vertex1.Color.B + (int)f.Vertex2.Color.B) / 2)) }; faces.Add(new BspGeometryFace() { Texture = f.Texture, Lightmap = f.Lightmap, Vertex0 = f.Vertex0, Vertex1 = v01, Vertex2 = v02 }); faces.Add(new BspGeometryFace() { Texture = f.Texture, Lightmap = f.Lightmap, Vertex0 = f.Vertex1, Vertex1 = v12, Vertex2 = v01 }); faces.Add(new BspGeometryFace() { Texture = f.Texture, Lightmap = f.Lightmap, Vertex0 = f.Vertex2, Vertex1 = v02, Vertex2 = v12 }); faces.Add(new BspGeometryFace() { Texture = f.Texture, Lightmap = f.Lightmap, Vertex0 = v01, Vertex1 = v12, Vertex2 = v02 }); }
private LevelVBItem GetLevelVBItem(BspGeometryVertex bspGeometryVertex) { return new LevelVBItem() { Position = GetVec3(bspGeometryVertex.Position), Normal = GetVec3Fixed(bspGeometryVertex.Normal), UV0 = GetVec2Fixed(bspGeometryVertex.UV0), UV1 = GetVec2Fixed(bspGeometryVertex.UV1), Colour = GetColour(bspGeometryVertex.Color) }; }
private BspGeometryVertex CorrectLightmapCoords(BspGeometryVertex src, Size dstSize, AtlasItem item) { BspGeometryVertex res = new BspGeometryVertex(); res.Color = src.Color; res.Normal = src.Normal; res.Position = src.Position; res.UV0 = src.UV0; var size =item.Size; var position =item.Position; res.UV1.X = ((float)item.Position.X + src.UV1.X * (float)size.Width) / (float)dstSize.Width; res.UV1.Y = ((float)item.Position.Y + src.UV1.Y * (float)size.Height) / (float)dstSize.Height; return res; }