Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        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);
        }