public LotThumbContent() { GameThread.SetInterval(Update, 1000); Client = new ApiClient(ApiClient.CDNUrl ?? GlobalSettings.Default.GameEntryUrl); DefaultThumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); using (var strm = File.Open("Content/3D/defaulthouse.fsof", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { DefaultFSOF = new FSOF(); DefaultFSOF.Read(strm); DefaultFSOF.LoadGPU(GameFacade.GraphicsDevice); } TextureUtils.ManualTextureMask(ref DefaultThumb, new uint[] { 0xFF000000 }); }
public FSOF GetFSOF(GraphicsDevice gd, WorldRC world, Blueprint bp, Action onNight, bool compressed) { var result = new FSOF(); RoofOnFloor = true; GenerateWalls(gd, world, bp, false); //GROUND_SUBDIV = 64; GenerateFloor(gd, world, bp, false); //SimplifyFloor(); GenerateRoof(gd, world, bp); result.TexCompressionType = (compressed) ? 1 : 0; result.FloorWidth = FloorTexture.Width; result.FloorHeight = FloorTexture.Height; result.WallWidth = WallTarget.Width; result.WallHeight = WallTarget.Height; result.FloorTextureData = TexToData(FloorTexture, compressed); result.WallTextureData = TexToData(WallTarget, compressed); var tVerts = new List <DGRP3DVert>(); var tInd = new List <int>(); var indOff = 0; for (int i = 0; i < 5; i++) { var tcOffset = new Vector2((i % 3) / 3f, (i / 3) / 2f); //save each floor. offset the floor for each level var posOffset = i * 2.95f; var fVerts = FloorVerts.Select(x => new DGRP3DVert(new Vector3(x.Position.X, x.Position.Y + posOffset, x.Position.Z), Vector3.Zero, x.TextureCoordinate + tcOffset)); tVerts.AddRange(fVerts); tInd.AddRange(FloorIndices.Select(x => x + indOff)); indOff = tVerts.Count; if (i == 0) { tcOffset = new Vector2((5 % 3) / 3f, (5 / 3) / 2f); //save each floor. offset the floor for each level posOffset = 0.5f * 2.95f; fVerts = FloorVerts.Select(x => new DGRP3DVert(new Vector3(x.Position.X, x.Position.Y + posOffset, x.Position.Z), Vector3.Zero, x.TextureCoordinate + tcOffset)); tVerts.AddRange(fVerts); tInd.AddRange(FloorIndices.Select(x => x + indOff)); indOff = tVerts.Count; } } tVerts.AddRange(RoofVerts.Select(x => new DGRP3DVert(x.Position, Vector3.Zero, x.TextureCoordinate))); tInd.AddRange(RoofIndices.Select(x => x + indOff)); DGRP3DVert.GenerateNormals(false, tVerts, FloorIndices); result.FloorVertices = tVerts.ToArray(); result.FloorIndices = tInd.ToArray(); var tempVerts = WallVerts.Select(x => new DGRP3DVert(x.Position, Vector3.Zero, x.TextureCoordinate)).ToList(); DGRP3DVert.GenerateNormals(false, tempVerts, WallIndices); result.WallVertices = tempVerts.ToArray(); result.WallIndices = WallIndices; onNight(); GenerateWalls(gd, world, bp, true); GenerateFloor(gd, world, bp, true); result.NightFloorTextureData = TexToData(FloorTexture, compressed); result.NightWallTextureData = TexToData(WallTarget, compressed); result.NightLightColor = world.State.OutsideColor; return(result); }