internal PositionNormalTexturedX2 GetMappedVertex(PositionTexture vert) { var vertOut = new PositionNormalTexturedX2(); var latLng = Coordinates.CartesianToSpherical2(vert.Position); // latLng.Lng += 90; if (latLng.Lng < -180) { latLng.Lng += 360; } if (latLng.Lng > 180) { latLng.Lng -= 360; } //if (false) //{ //// System.Diagnostics.Debug.WriteLine(String.Format("{0},{1}", (int)(vert.Tu * 16 + .5), (int)(vert.Tv * 16 + .5))); //} if (level > 1) { var arrayX = (byte)(int)(vert.Tu * 16 + .5); var arrayY = (byte)(int)(vert.Tv * 16 + .5); demArray[arrayX + arrayY * 17] = DemData[demIndex]; if (backslash) { if (tempBackslashYIndex != null) { tempBackslashXIndex[demIndex] = arrayX; tempBackslashYIndex[demIndex] = arrayY; } } else { if (tempSlashYIndex != null) { tempSlashXIndex[demIndex] = arrayX; tempSlashYIndex[demIndex] = arrayY; } } } var pos = GeoTo3dWithAltitude(latLng.Lat, latLng.Lng, false); vertOut.Tu = (float) vert.Tu; vertOut.Tv = (float) vert.Tv; vertOut.Lat = latLng.Lat; vertOut.Lng = latLng.Lng; vertOut.Normal = pos; pos = pos - localCenter; vertOut.Position = pos; return vertOut; }
public PositionNormalTexturedX2 PositionNormalTextured(Vector3d center, bool backslash) { var latLng = Coordinates.CartesianToSpherical2(Position); // latLng.Lng += 90; if (latLng.Lng < -180) { latLng.Lng += 360; } if (latLng.Lng > 180) { latLng.Lng -= 360; } if (latLng.Lng == -180 && !backslash) { latLng.Lng = 180; } if (latLng.Lng == 180 && backslash) { latLng.Lng = -180; } var pnt = new PositionNormalTexturedX2 { X = (float) (X - center.X), Y = (float) (Y - center.Y), Z = (float) (Z - center.Z), Tu = (float) Tu, Tv = (float) Tv, Lng = latLng.Lng, Lat = latLng.Lat, Normal = Position }; return pnt; }
public static void ReturnLockX2Buffer(PositionNormalTexturedX2[] buff) { if (buff == null) { return; } BufferMutex.WaitOne(); try { var count = buff.Length; if (count < 2048) { if (!LockX2Pools.ContainsKey(count)) { LockX2Pools.Add(count, new Buffers(count)); } LockX2Pools[count].Entries.Push(buff); } } finally { BufferMutex.ReleaseMutex(); } }
public PositionNormalTexturedX2 PositionNormalTextured(Vector3d center, bool backslash) { Coordinates latLng = Coordinates.CartesianToSpherical2(this.Position); // latLng.Lng += 90; if (latLng.Lng < -180) { latLng.Lng += 360; } if (latLng.Lng > 180) { latLng.Lng -= 360; } if (latLng.Lng == -180 && !backslash) { latLng.Lng = 180; } if (latLng.Lng == 180 && backslash) { latLng.Lng = -180; } PositionNormalTexturedX2 pnt = new PositionNormalTexturedX2(); pnt.X = (float)(X - center.X); pnt.Y = (float)(Y - center.Y); pnt.Z = (float)(Z - center.Z); pnt.Tu = (float)Tu; pnt.Tv = (float)Tv; pnt.Lng = latLng.Lng; pnt.Lat = latLng.Lat; pnt.Normal = Position; return pnt; }