private void DrawOrbitIcon(Vessel thatVessel, MapIcons.OtherIcon iconType, Color iconColor, double givenPoint = 0) { double timePoint = start; switch (iconType) { case MapIcons.OtherIcon.AP: timePoint += thatVessel.orbit.timeToAp; break; case MapIcons.OtherIcon.PE: timePoint += thatVessel.orbit.timeToPe; break; case MapIcons.OtherIcon.AN: case MapIcons.OtherIcon.DN: case MapIcons.OtherIcon.NODE: timePoint = givenPoint; break; } if (JUtil.OrbitMakesSense(thatVessel)) { bool collision; Vector2d coord; if (GetPositionAtT(thatVessel, thatVessel.orbit, start, timePoint, out coord, out collision) && !collision) { DrawIcon(coord.x, coord.y, thatVessel.vesselType, iconColor, iconType); } } }
private void DrawIcon(float xPos, float yPos, VesselType vt, Color iconColor, MapIcons.OtherIcon icon = MapIcons.OtherIcon.None) { var position = new Rect(xPos - iconPixelSize * 0.5f, yPos - iconPixelSize * 0.5f, iconPixelSize, iconPixelSize); Rect shadow = position; shadow.x += iconShadowShift.x; shadow.y += iconShadowShift.y; iconMaterial.color = iconColorShadowValue; Graphics.DrawTexture(shadow, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial); iconMaterial.color = iconColor; Graphics.DrawTexture(position, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial); }
private void DrawIcon(double longitude, double latitude, VesselType vt, Color iconColor, MapIcons.OtherIcon icon = MapIcons.OtherIcon.None) { var position = new Rect((float)(longitudeToPixels(longitude, latitude) - iconPixelSize / 2), (float)(latitudeToPixels(longitude, latitude) - iconPixelSize / 2), iconPixelSize, iconPixelSize); Rect shadow = position; shadow.x += iconShadowShift.x; shadow.y += iconShadowShift.y; iconMaterial.color = iconColorShadowValue; Graphics.DrawTexture(shadow, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial); iconMaterial.color = iconColor; Graphics.DrawTexture(position, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, iconMaterial); }
private void DrawIcon(float xPos, float yPos, VesselType vt, Color iconColor, MapIcons.OtherIcon icon = MapIcons.OtherIcon.None) { var position = new Rect(xPos - iconPixelSize * 0.5f, yPos - iconPixelSize * 0.5f, iconPixelSize, iconPixelSize); //Rect shadow = position; //shadow.x += iconShadowShift.x; //shadow.y += iconShadowShift.y; //MapView.OrbitIconsMaterial.color = iconColorShadowValue; //Graphics.DrawTexture(shadow, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, MapView.OrbitIconsMaterial); // the old icon material wasn't working, so just use this one // but I don't fully understand the color/blend system // a = 1.0 is far too faint; 4.0 looks pretty good MapView.OrbitIconsMaterial.color = new Color(iconColor.r, iconColor.g, iconColor.b, 4.0f); Graphics.DrawTexture(position, MapView.OrbitIconsMap, MapIcons.VesselTypeIcon(vt, icon), 0, 0, 0, 0, MapView.OrbitIconsMaterial); // if the icon texture ever changes, you can use this code to dump it out for inspection #if false var filepath = "orbiticonsmap.png"; if (!System.IO.File.Exists(filepath)) { var textureCopy = duplicateTexture(MapView.OrbitIconsMap); var textureBytes = textureCopy.EncodeToPNG(); System.IO.File.WriteAllBytes(filepath, textureBytes); } #endif }