Inheritance: UpdatableData
    private static void ApplyTexturesToNewTerrain(TerrainData terrainData, TextureData data)
    {
        if (data.ControlTextureResolution != terrainData.alphamapResolution)
        {
            data.AdjustSplatMapResolution(terrainData.alphamapResolution);
        }

        terrainData.SetAlphamaps(0, 0, data.SplatMaps);
    }
 public WinRenderer(BattleState battleState)
     : base(battleState)
 {
     whitePixelTextureData = ResourceManager.GetTextureData("white_pixel");
     minScale = Game1.MinScreenScaleFactor;
     visibleItemCount = (int)Math.Floor(10 * minScale.Y);
 }
 public ParticleManager(float particleTime, string text, Color textColor)
 {
     this.particleTime = particleTime;
     this.text = text;
     this.textColor = textColor;
     textureData = null;
 }
        public ThinkRenderer(BattleState battleState)
            : base(battleState)
        {
            menuOptions = new List<ThinkRendererOuterMenuOption>(Think.OuterMenuOptions.Length);
            sortedMenuOptions = new List<ThinkRendererOuterMenuOption>(Think.OuterMenuOptions.Length);
            for (int i = 0; i < Think.OuterMenuOptions.Length; ++i)
            {
                string optionName = Think.OuterMenuOptions[i].ToLower();
                ThinkRendererOuterMenuOption menuOption = new ThinkRendererOuterMenuOption(ResourceManager.GetTextureData("battle_ui/icons/" + optionName), menuOptionColors[optionName], i);
                menuOptions.Add(menuOption);
                sortedMenuOptions.Add(menuOption);
            }
            iconContainerTextureData = ResourceManager.GetTextureData("battle_ui/icons/container");
            iconContainerGlowTextureData = ResourceManager.GetTextureData("battle_ui/icons/container_glow");
            actionIconTextureData = new TextureData[actionIconNames.Length];
            for (int i = 0; i < actionIconNames.Length; ++i)
                actionIconTextureData[i] = ResourceManager.GetTextureData("battle_ui/icons/" + actionIconNames[i]);
            ResetOuterMenuTransitions();

            anglePerOption = MathHelper.TwoPi / Think.OuterMenuOptions.Length;
            halfOptionsLength = Think.OuterMenuOptions.Length / 2;

            whitePixelTextureData = ResourceManager.GetTextureData("white_pixel");
        }
 public IntroOutroRenderer(BattleState battleState)
     : base(battleState)
 {
     pixelTextureData = ResourceManager.GetTextureData("white_pixel");
 }
Exemple #6
0
 [DllImport(Lib.name)] static extern void msServerServeTexture(IntPtr self, TextureData data);
 void OnUpdateTexture(Texture tex, TextureData data)
 {
     m_log += "Texture: " + tex.name + "\n";
 }
 public ThinkRendererOuterMenuOption(TextureData iconTextureData, Color color, int menuOptionIndex)
 {
     this.iconTextureData = iconTextureData;
     this.color = color;
     MenuOptionIndex = menuOptionIndex;
 }
        public uint GenStringTexture(string a_szString, out Vector2 a_v2Size)
        {
            a_v2Size = Vector2.Zero;

            // first Check if the string is valid:
            if (a_szString == null)
            {
                return 0;
            }

            // next we see if this string has been gend already:
            TextureData oTexture;
            if (m_dicTextures.TryGetValue(a_szString, out oTexture))
            {
                oTexture.m_uiUseCount++;
                return oTexture.m_uiTextureID;
            }

            // looks like the string is valid and we have not gend it before
            // Create New Texture Data:
            TextureData oNewTexture = new TextureData();
            oNewTexture.m_szTextureFile = a_szString;
            oNewTexture.m_uiUseCount = 1;

            // create working Vars:
            a_v2Size.X = a_szString.Length * Pulsar4X.UI.UIConstants.DEFAULT_STRING_TEXTURE_WIDTH_PER_CHAR; // Calcs the texture width based on no of chars.
            a_v2Size.Y = Pulsar4X.UI.UIConstants.DEFAULT_STRING_TEXTURE_HEIGHT_PER_CHAR;
            Bitmap oStringBitmap = new Bitmap((int)a_v2Size.X, (int)a_v2Size.Y);

            // render using System.Drawing:
            using (Graphics gfx = Graphics.FromImage(oStringBitmap))
            {
                gfx.Clear(Color.Transparent);
                Font oFont = new Font(new FontFamily("Arial"), 128.0f, FontStyle.Regular, GraphicsUnit.Pixel);
                SolidBrush oBrush = new SolidBrush(Color.White);
                gfx.DrawString(a_szString, oFont, oBrush, 0, 0);

            }

            // lock bits for editing:
            System.Drawing.Imaging.BitmapData oBitmapData = oStringBitmap.LockBits(new Rectangle(0, 0, oStringBitmap.Width, oStringBitmap.Height),
                                                                                    System.Drawing.Imaging.ImageLockMode.ReadOnly,
                                                                                    System.Drawing.Imaging.PixelFormat.Format32bppArgb);


            // Generate Texture Handle
            GL.GenTextures(1, out oNewTexture.m_uiTextureID);
            // Tell openGL that this is a 2d texture:
            GL.BindTexture(TextureTarget.Texture2D, oNewTexture.m_uiTextureID);

            // Configure Text Paramaters:
            //GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvMode.Modulate);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (float)TextureMagFilter.Nearest);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Nearest);

            // Load data by telling OpenGL to build mipmaps out of bitmap data
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, oStringBitmap.Width, oStringBitmap.Height,
                          0, PixelFormat.Bgra, PixelType.UnsignedByte, oBitmapData.Scan0);

            // unlock bitmap.
            oStringBitmap.UnlockBits(oBitmapData);

            // add our new texture to the dic:
            if (!m_dicTextures.ContainsKey(a_szString)){
                m_dicTextures.Add(a_szString, oNewTexture);
            }

            // return the texture id.
            return oNewTexture.m_uiTextureID;
        }
Exemple #10
0
    /// <summary>
    /// Import Everything Based on Checked Data
    /// </summary>
    public static void Import()
    {
        Debug.Log("Loading XML Data");

        string XMLPath = GetXMLPath();

        //Load Data from XML Data
        LoadXMLData(XMLPath);

        if (KSIData.useCustomNames && KSIData.customImageName != "")
        {
            SetCustomNames();
        }

        //Create a New String and Get Its Path
        string scenePath = CreateNewScene();

        //If the User Canceled Creating a Scene
        if (scenePath == "")
        {
            return;
        }

        //Grab a Reference to the Scene So We Can Save it When We Are All Done
        Scene importScene = SceneManager.GetSceneByPath(scenePath);

        //For Each Imported Image We Need to Handle
        for (int i = 0; i < imports.Count; i++)
        {
            //Get the Image So We Can Pass it by Reference
            ImageData curImage = imports[i];

            //Save the Image Into the Project
            bool success = SaveImage(ref curImage);

            if (!success)
            {
                return;
            }

            Debug.Log("New Image Info: " + curImage.ToString());

            //Load the Texture For Use With the Importer
            success = LoadTexture(ref curImage);

            if (!success)
            {
                return;
            }

            //Save the Image Information
            imports[i] = curImage;
            TextureData curTexture = textures[textures.Count - 1];
            Debug.Log("Texture Data: " + curTexture.data.ToString());

            //Set the Importer Information
            SetImporter(ref curTexture);

            //Set the Handler Information
            SetHandler(ref curTexture);

            //Set the Images Name in Scene
            SetImageSceneName(ref curTexture);

            //Save the New Texture Information
            textures[textures.Count - 1] = curTexture;
        }

        //Now That All of the Images Are Imported, Start Adding Them To The Scene
        foreach (var texture in textures)
        {
            KSISceneManager.AddToScene(texture);
        }

        //Save the Final Scene
        EditorSceneManager.SaveScene(importScene);

        //Reset Lists For Reuse
        textures.Clear();
        imports.Clear();
    }
 public override void RefreshData(BuildInfo buildReport, AssetDependencies assetDependencies, TextureData textureData, UnityBuildReport unityBuildReport)
 {
 }
 public MenuRenderer(OverworldState overworldState)
     : base(overworldState)
 {
     whitePixelTextureData = ResourceManager.GetTextureData("white_pixel");
 }
 private Vector2 positionFromScale(TextureData containerTextureData, Vector2 containerScale, Vector2 scaleScale)
 {
     Vector2 originalDimensions = new Vector2(containerTextureData.Width, containerTextureData.Height) * containerScale;
     Vector2 scaledDimensions = originalDimensions * scaleScale;
     Vector2 difference = originalDimensions - scaledDimensions;
     return Position + (difference / 2.0f);
 }
 public void Draw(TextureData iconContainerTextureData, TextureData iconContainerGlowTextureData, Vector2 containerScale, Vector2 iconScale, Vector2 scaleScale, Renderer renderer)
 {
     ScaledPosition = positionFromScale(iconContainerTextureData, containerScale, scaleScale);
     containerScale *= scaleScale;
     iconScale *= scaleScale;
     Vector2 iconPosition = ScaledPosition + (new Vector2(iconContainerTextureData.Width - iconTextureData.Width, iconContainerTextureData.Height - iconTextureData.Height) * scaleScale * 0.5f * Game1.ScreenScaleFactor.X);
     Color containerColor = color;
     Color iconColor = Color.White;
     if (iconContainerGlowTextureData == null)
     {
         containerColor = new Color(color.ToVector3() * 0.7f);
         iconColor = new Color(Color.White.ToVector3() * 0.7f);
     }
     else
         renderer.Draw(iconContainerGlowTextureData, ScaledPosition - (new Vector2(iconContainerGlowTextureData.Width - iconContainerTextureData.Width) * 0.5f * containerScale.X), Color.WhiteSmoke, 0.0f, containerScale, false);
     renderer.Draw(iconContainerTextureData, ScaledPosition, containerColor, 0.0f, containerScale, false);
     renderer.Draw(iconTextureData, iconPosition, iconColor, 0.0f, iconScale, false);
 }
Exemple #15
0
    public void LoadTextureInfo()
    {
        Dictionary <string, Texture> dicTexture = Resources.LoadAll <Texture>("Textures").ToDictionary(v => v.name, v => v);
        Dictionary <string, Sprite>  dicIcon    = Resources.LoadAll <Sprite>("Icons").ToDictionary(v => v.name, v => v);

        string[][] grid;

        // HelmetTexture ------------------------------------------
        if (HelmetTextureCSV)
        {
            grid = CsvParser.Parse(HelmetTextureCSV.text);
            for (int i = startReadCsvAtRow - 1; i < grid.Length; i++)
            {
                TextureData textureData = new TextureData(
                    grid[i][1],
                    grid[i][0],
                    dicIcon[grid[i][2]],
                    dicTexture[grid[i][3]],
                    dicTexture[grid[i][4]],
                    grid[i][5],
                    int.Parse(grid[i][6]),
                    int.Parse(grid[i][7]),
                    int.Parse(grid[i][8]),
                    grid[i][9],
                    grid[i][10]
                    );
                dicTextureHelmetInfo.Add(grid[i][0], textureData);
                listHelmetTextureInfo.Add(textureData);
            }
        }
        // Suit ------------------------------------------
        if (SuitCSV)
        {
            grid = CsvParser.Parse(SuitCSV.text);
            for (int i = startReadCsvAtRow - 1; i < grid.Length; i++)
            {
                TextureData textureData = new TextureData(
                    grid[i][1],
                    grid[i][0],
                    dicIcon[grid[i][2]],
                    dicTexture[grid[i][3]],
                    dicTexture[grid[i][4]],
                    grid[i][5],
                    int.Parse(grid[i][6]),
                    int.Parse(grid[i][7]),
                    int.Parse(grid[i][8]),
                    grid[i][9],
                    grid[i][10]
                    );
                dicTextureSuitInfo.Add(grid[i][0], textureData);
                listTextureSuitInfo.Add(textureData);
            }
        }

        // Glove ------------------------------------------
        if (GloveCSV)
        {
            grid = CsvParser.Parse(GloveCSV.text);
            for (int i = startReadCsvAtRow - 1; i < grid.Length; i++)
            {
                TextureData textureData = new TextureData(
                    grid[i][1],
                    grid[i][0],
                    dicIcon[grid[i][2]],
                    dicTexture[grid[i][3]],
                    dicTexture[grid[i][4]],
                    grid[i][5],
                    int.Parse(grid[i][6]),
                    int.Parse(grid[i][7]),
                    int.Parse(grid[i][8]),
                    grid[i][9],
                    grid[i][10]
                    );
                dicTextureGloveInfo.Add(grid[i][0], textureData);
                listTextureGloveInfo.Add(textureData);
            }
        }

        // Boots ------------------------------------------
        if (BootsCSV)
        {
            grid = CsvParser.Parse(BootsCSV.text);
            for (int i = startReadCsvAtRow - 1; i < grid.Length; i++)
            {
                TextureData textureData = new TextureData(
                    grid[i][1],
                    grid[i][0],
                    dicIcon[grid[i][2]],
                    dicTexture[grid[i][3]],
                    dicTexture[grid[i][4]],
                    grid[i][5],
                    int.Parse(grid[i][6]),
                    int.Parse(grid[i][7]),
                    int.Parse(grid[i][8]),
                    grid[i][9],
                    grid[i][10]
                    );
                dicTextureBootsInfo.Add(grid[i][0], textureData);
                listTextureBootsInfo.Add(textureData);
            }
        }
    }
Exemple #16
0
        /// <summary>
        /// Load all GeonBit.UI resources.
        /// </summary>
        /// <param name="content">Content manager to use.</param>
        /// <param name="theme">Which theme to load resources from.</param>
        static public void LoadContent(ContentManager content, string theme = "default")
        {
            // set resources root path
            string root = "GeonBit.UI/themes/" + theme + "/";

            // cursor texture
            CursorDefault = content.Load <Texture2D>(root + "textures/cursor");
            CursorHand    = content.Load <Texture2D>(root + "textures/cursor_hand");

            // load white texture for rectangle
            WhiteTexture = content.Load <Texture2D>(root + "textures/white_texture");

            // panel textures
            PanelTextures = new Texture2D[Enum.GetValues(typeof(PanelSkin)).Length];
            PanelData     = new TextureData[Enum.GetValues(typeof(PanelSkin)).Length];
            foreach (PanelSkin skin in Enum.GetValues(typeof(PanelSkin)))
            {
                // skip none panel skin
                if (skin == PanelSkin.None)
                {
                    continue;
                }

                // load panel texture and metadata
                string skinName = skin.ToString().ToLower();
                PanelTextures[(int)skin] = content.Load <Texture2D>(root + "textures/panel_" + skinName);
                PanelData[(int)skin]     = content.Load <TextureData>(root + "textures/panel_" + skinName + "_md");
            }

            // arrow down
            ArrowDown = content.Load <Texture2D>(root + "textures/arrow_down");

            // scrollbar texture
            VerticalScrollbarTexture     = content.Load <Texture2D>(root + "textures/scrollbar");
            VerticalScrollbarMarkTexture = content.Load <Texture2D>(root + "textures/scrollbar_mark");

            // scrollbar metadata
            VerticalScrollbarData = content.Load <TextureData>(root + "textures/scrollbar_md");

            // slider textures
            SliderTextures     = new Texture2D[Enum.GetValues(typeof(SliderSkin)).Length];
            SliderMarkTextures = new Texture2D[Enum.GetValues(typeof(SliderSkin)).Length];
            SliderData         = new TextureData[Enum.GetValues(typeof(SliderSkin)).Length];
            foreach (SliderSkin skin in Enum.GetValues(typeof(SliderSkin)))
            {
                // load slider textures
                string skinName = skin.ToString().ToLower();
                SliderTextures[(int)skin]     = content.Load <Texture2D>(root + "textures/slider_" + skinName);
                SliderMarkTextures[(int)skin] = content.Load <Texture2D>(root + "textures/slider_" + skinName + "_mark");

                // load slider textures metadata
                SliderData[(int)skin] = content.Load <TextureData>(root + "textures/slider_" + skinName + "_md");
            }

            // horizontal line texture
            HorizontalLineTexture = content.Load <Texture2D>(root + "textures/horizontal_line");

            // font for paragraphs and text
            Fonts = new SpriteFont[Enum.GetValues(typeof(FontStyle)).Length];
            foreach (FontStyle style in Enum.GetValues(typeof(FontStyle)))
            {
                Fonts[(int)style]              = content.Load <SpriteFont>(root + "fonts/" + style.ToString());
                Fonts[(int)style].LineSpacing += 2;
            }

            // get mouse states count
            int mouseStatesOnEntityCount = Enum.GetValues(typeof(EntityState)).Length;

            // init button textures
            ButtonTextures = new Texture2D[Enum.GetValues(typeof(ButtonSkin)).Length, mouseStatesOnEntityCount];
            ButtonData     = new TextureData[Enum.GetValues(typeof(ButtonSkin)).Length];
            foreach (ButtonSkin skin in Enum.GetValues(typeof(ButtonSkin)))
            {
                // load textures
                string skinName = skin.ToString().ToLower();
                ButtonTextures[(int)skin, (int)EntityState.Default]    = content.Load <Texture2D>(root + "textures/button_" + skinName);
                ButtonTextures[(int)skin, (int)EntityState.MouseDown]  = content.Load <Texture2D>(root + "textures/button_" + skinName + "_down");
                ButtonTextures[(int)skin, (int)EntityState.MouseHover] = content.Load <Texture2D>(root + "textures/button_" + skinName + "_hover");

                // load metadata
                ButtonData[(int)skin] = content.Load <TextureData>(root + "textures/button_" + skinName + "_md");
            }

            // checkbox textures
            CheckBoxTextures = new Texture2D[mouseStatesOnEntityCount];
            CheckBoxTextures[(int)EntityState.Default]    = content.Load <Texture2D>(root + "textures/checkbox");
            CheckBoxTextures[(int)EntityState.MouseDown]  = content.Load <Texture2D>(root + "textures/checkbox_down");
            CheckBoxTextures[(int)EntityState.MouseHover] = content.Load <Texture2D>(root + "textures/checkbox_hover");

            // radio button textures
            RadioTextures = new Texture2D[mouseStatesOnEntityCount];
            RadioTextures[(int)EntityState.Default]    = content.Load <Texture2D>(root + "textures/radio");
            RadioTextures[(int)EntityState.MouseDown]  = content.Load <Texture2D>(root + "textures/radio_down");
            RadioTextures[(int)EntityState.MouseHover] = content.Load <Texture2D>(root + "textures/radio_hover");

            // progress bar texture
            ProgressBarTexture     = content.Load <Texture2D>(root + "textures/progressbar");
            ProgressBarFillTexture = content.Load <Texture2D>(root + "textures/progressbar_fill");
            ProgressBarData        = content.Load <TextureData>(root + "textures/progressbar_md");

            // load icons
            IconTextures = new Texture2D[Enum.GetValues(typeof(IconType)).Length];
            foreach (IconType icon in Enum.GetValues(typeof(IconType)))
            {
                IconTextures[(int)(icon)] = content.Load <Texture2D>(root + "textures/icons/" + icon.ToString());
            }
            IconBackgroundTexture = content.Load <Texture2D>(root + "textures/icons/background");

            // load effects
            DisabledEffect   = content.Load <Effect>(root + "effects/disabled");
            SilhouetteEffect = content.Load <Effect>(root + "effects/silhouette");

            // load default styleSheets
            LoadDefaultStyles(ref Entity.DefaultStyle, "Entity", root, content);
            LoadDefaultStyles(ref Paragraph.DefaultStyle, "Paragraph", root, content);
            LoadDefaultStyles(ref Button.DefaultStyle, "Button", root, content);
            LoadDefaultStyles(ref Button.DefaultParagraphStyle, "ButtonParagraph", root, content);
            LoadDefaultStyles(ref CheckBox.DefaultStyle, "CheckBox", root, content);
            LoadDefaultStyles(ref CheckBox.DefaultParagraphStyle, "CheckBoxParagraph", root, content);
            LoadDefaultStyles(ref ColoredRectangle.DefaultStyle, "ColoredRectangle", root, content);
            LoadDefaultStyles(ref DropDown.DefaultStyle, "DropDown", root, content);
            LoadDefaultStyles(ref DropDown.DefaultParagraphStyle, "DropDownParagraph", root, content);
            LoadDefaultStyles(ref DropDown.DefaultSelectedParagraphStyle, "DropDownSelectedParagraph", root, content);
            LoadDefaultStyles(ref Header.DefaultStyle, "Header", root, content);
            LoadDefaultStyles(ref HorizontalLine.DefaultStyle, "HorizontalLine", root, content);
            LoadDefaultStyles(ref Icon.DefaultStyle, "Icon", root, content);
            LoadDefaultStyles(ref Image.DefaultStyle, "Image", root, content);
            LoadDefaultStyles(ref Label.DefaultStyle, "Label", root, content);
            LoadDefaultStyles(ref Panel.DefaultStyle, "Panel", root, content);
            LoadDefaultStyles(ref ProgressBar.DefaultStyle, "ProgressBar", root, content);
            LoadDefaultStyles(ref ProgressBar.DefaultFillStyle, "ProgressBarFill", root, content);
            LoadDefaultStyles(ref RadioButton.DefaultStyle, "RadioButton", root, content);
            LoadDefaultStyles(ref RadioButton.DefaultParagraphStyle, "RadioButtonParagraph", root, content);
            LoadDefaultStyles(ref SelectList.DefaultStyle, "SelectList", root, content);
            LoadDefaultStyles(ref SelectList.DefaultParagraphStyle, "SelectListParagraph", root, content);
            LoadDefaultStyles(ref Slider.DefaultStyle, "Slider", root, content);
            LoadDefaultStyles(ref TextInput.DefaultStyle, "TextInput", root, content);
            LoadDefaultStyles(ref TextInput.DefaultParagraphStyle, "TextInputParagraph", root, content);
            LoadDefaultStyles(ref TextInput.DefaultPlaceholderStyle, "TextInputPlaceholder", root, content);
            LoadDefaultStyles(ref VerticalScrollbar.DefaultStyle, "VerticalScrollbar", root, content);
        }
        public override void DrawGUI(Rect position,
                                     BuildInfo buildReportToDisplay, AssetDependencies assetDependencies, TextureData textureData,
                                     UnityBuildReport unityBuildReport,
                                     out bool requestRepaint
                                     )
        {
            requestRepaint = false;

            if (Event.current.type == EventType.Layout)
            {
                _hasTotalBuildSize = !string.IsNullOrEmpty(buildReportToDisplay.TotalBuildSize) &&
                                     !string.IsNullOrEmpty(buildReportToDisplay.BuildFilePath);

                _hasUsedAssetsTotalSize = !string.IsNullOrEmpty(buildReportToDisplay.UsedTotalSize);
                _hasCompressedBuildSize = !string.IsNullOrEmpty(buildReportToDisplay.CompressedBuildSize);
                _hasBuildSizes          = buildReportToDisplay.BuildSizes != null;
                _hasMonoDLLsToDisplay   = buildReportToDisplay.MonoDLLs != null && buildReportToDisplay.MonoDLLs.Length > 0;

                _hasUnityEngineDLLsToDisplay = buildReportToDisplay.UnityEngineDLLs != null &&
                                               buildReportToDisplay.UnityEngineDLLs.Length > 0;

                _hasScriptDLLsToDisplay =
                    buildReportToDisplay.ScriptDLLs != null && buildReportToDisplay.ScriptDLLs.Length > 0;
            }


            GUILayout.Space(2);             // top padding for scrollbar

            _assetListScrollPos = GUILayout.BeginScrollView(_assetListScrollPos);

            GUILayout.Space(10);             // top padding for content

            GUILayout.BeginHorizontal();
            GUILayout.Space(10);             // extra left padding

            DrawTotalSize(buildReportToDisplay);

            GUILayout.Space(BuildReportTool.Window.Settings.CATEGORY_HORIZONTAL_SPACING);
            GUILayout.BeginVertical();

            DrawBuildSizes(buildReportToDisplay);

            GUILayout.Space(BuildReportTool.Window.Settings.CATEGORY_VERTICAL_SPACING);

            DrawDLLList(buildReportToDisplay);

            GUILayout.EndVertical();
            GUILayout.Space(20);             // extra right padding
            GUILayout.EndHorizontal();

            GUILayout.EndScrollView();
        }
Exemple #18
0
 /// <summary>
 /// Set the Name That the Final Object Will Have In Scene.
 /// NOTE: Can Be Altered To User's Needs
 /// </summary>
 /// <param name="textureData"></param>
 public static void SetImageSceneName(ref TextureData textureData)
 {
     textureData.data.NameInScene = textureData.data.Filename;
 }
Exemple #19
0
        /// <summary>
        /// 构造制定贴图的边界。
        /// </summary>
        /// <param name="tex"></param>
        public SpriteBorder ( Texture2D tex )
        {
            InitialSurroundPoint();

            borderCircles = new List<BorderCircleList>();
            texData = new TextureData( tex );
            borderMap = new BorderMap( tex.Width, tex.Height );

            CreateBorderCircles( tex );
        }
Exemple #20
0
    public static void Create(Vector2Int coordinates)
    {
        var record     = LandRecord.Get(coordinates);
        var gameObject = new GameObject(coordinates.ToString());

        gameObject.transform.position = new Vector3(coordinates.x * 8192, 0, coordinates.y * 8192);

        var meshFilter = gameObject.AddComponent <MeshFilter>();

        var meshRenderer = gameObject.AddComponent <MeshRenderer>();

        meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.TwoSided;
        meshRenderer.sharedMaterial    = new Material(MaterialManager.Instance.TerrainShader);
        meshRenderer.sharedMaterial.mainTextureScale = new Vector2(16, 16);

        // Generate the mesh
        int vertexStep = 8192 / 64;

        // Generate vertices and appropriate heights
        var vertices      = new Vector3[65 * 65];
        var uvs           = new Vector2[vertices.Length];
        var nextColHeight = record.HeightData.ReferenceHeight;

        var triangles = new int[64 * 64 * 6];

        for (int y = 0, i = 0; y < 65; y++)
        {
            var previousHeight = nextColHeight;
            for (var x = 0; x < 65; x++, i++)
            {
                var height = previousHeight + record.HeightData.HeightPoints[i];                 // this is the change in elevation from the previous (to the leftt) vertex, multiplied by 8

                if (x == 0)
                {
                    nextColHeight = height;
                }

                var vertex = new Vector3(x * vertexStep, height * 8, y * vertexStep);                 // Each vertex is 128 game-units apart
                vertices[i]    = vertex;
                previousHeight = height;

                // Generate UV too ( every 4 patches should be one UV)
                var uvX = Mathf.Lerp(1f / 18f, 1 - 1f / 18f, x / 64f);
                var uvY = Mathf.Lerp(1f / 18f, 1 - 1f / 18f, y / 64f);

                uvs[x + y * 65] = new Vector2(uvX, uvY);
            }
        }

        // Triangles
        // Needs to be seperate from previous loop
        for (int ti = 0, vi = 0, y = 0; y < 64; y++, vi++)
        {
            for (int x = 0; x < 64; x++, ti += 6, vi++)
            {
                triangles[ti]     = vi;
                triangles[ti + 3] = triangles[ti + 2] = vi + 1;
                triangles[ti + 4] = triangles[ti + 1] = vi + 64 + 1;
                triangles[ti + 5] = vi + 64 + 2;
            }
        }

        var normals = new Vector3[record.NormalData.Normals.Length / 3];

        for (var i = 0; i < normals.Length; i++)
        {
            normals[i] = new Vector3(record.NormalData.Normals[i * 3] / 128f, record.NormalData.Normals[i * 3 + 2] / 128f, record.NormalData.Normals[i * 3 + 1] / 128f);
        }

        var mesh = new Mesh
        {
            vertices  = vertices,
            triangles = triangles,
            uv        = uvs,
            normals   = normals,
            colors32  = record.ColorData.Colors
        };

        meshFilter.sharedMesh = mesh;

        // Now calculate vertex colors. Look at each "patch". if the neighbouring patch is a different texture, then set the alpha between the pixels to 0 or something

        // Remaining steps are for textures only
        if (record.TextureData == null)
        {
            return;
        }

        // Get the texturedata, and surrounding cells
        Directions cellDirections = 0;
        var        borderCells    = new TextureData[3, 3];

        for (var y = 0; y < 3; y++)
        {
            for (var x = 0; x < 3; x++)
            {
                var        xCoord     = coordinates.x + (x - 1);
                var        yCoord     = coordinates.y + (y - 1);
                var        coordinate = new Vector2Int(xCoord, yCoord);
                LandRecord landRecord;
                if (LandRecord.Records.TryGetValue(coordinate, out landRecord))
                {
                    borderCells[x, y] = landRecord.TextureData;
                    cellDirections   |= (Directions)(Mathf.Pow(2, x + y * 3));
                }
            }
        }

        // Don't do this inside the loop, silly
        var currentIndices = record.TextureData.TextureIndices;
        var borderIndices  = GetBorderIndices(cellDirections, borderCells);        // Get an 18x18 array, which includes the surrounding textures

        var control = new Texture2D(18, 18, TextureFormat.Alpha8, false, true)
        {
            filterMode = FilterMode.Point
        };

        for (var y = 0; y < control.height; y++)
        {
            for (var x = 0; x < control.width; x++)
            {
                var textureIndex = borderIndices[x, y];
                var color        = new Color32(0, 0, 0, (byte)textureIndex);
                control.SetPixel(x, y, color);
            }
        }

        control.Apply(false, true);

        meshRenderer.sharedMaterial.SetTexture("_MainTex", LandTextureRecord.GetTexture2DArray());
        meshRenderer.sharedMaterial.SetTexture("_Control", control);

        gameObject.AddComponent <MeshCollider>();
    }
 public AssetParameterFlex(TextureData textureData)
 => TextureValue = textureData;
        /// <summary>
        /// Blocking method to download and parse currently worn wearable assets
        /// </summary>
        /// <returns>True on success, otherwise false</returns>
        private bool DownloadWearables()
        {
            bool success = true;

            // Make a copy of the wearables dictionary to enumerate over
            Dictionary<WearableType, WearableData> wearables;
            lock (Wearables)
                wearables = new Dictionary<WearableType, WearableData>(Wearables);

            // We will refresh the textures (zero out all non bake textures)
            for (int i = 0; i < Textures.Length; i++)
            {
                bool isBake = false;
                for (int j = 0; j < BakeIndexToTextureIndex.Length; j++)
                {
                    if (BakeIndexToTextureIndex[j] == i)
                    {
                        isBake = true;
                        break;
                    }
                }
                if (!isBake)
                    Textures[i] = new TextureData();
            }

            int pendingWearables = wearables.Count;
            foreach (WearableData wearable in wearables.Values)
            {
                if (wearable.Asset != null)
                {
                    DecodeWearableParams(wearable);
                    --pendingWearables;
                }
            }

            if (pendingWearables == 0)
                return true;

            Logger.DebugLog("Downloading " + pendingWearables + " wearable assets");

            Parallel.ForEach<WearableData>(Math.Min(pendingWearables, MAX_CONCURRENT_DOWNLOADS), wearables.Values,
                delegate(WearableData wearable)
                {
                    if (wearable.Asset == null)
                    {
                        AutoResetEvent downloadEvent = new AutoResetEvent(false);

                        // Fetch this wearable asset
                        Client.Assets.RequestAsset(wearable.AssetID, wearable.AssetType, true,
                            delegate(AssetDownload transfer, Asset asset)
                            {
                                if (transfer.Success && asset is AssetWearable)
                                {
                                    // Update this wearable with the freshly downloaded asset
                                    wearable.Asset = (AssetWearable)asset;

                                    if (wearable.Asset.Decode())
                                    {
                                        DecodeWearableParams(wearable);
                                        Logger.DebugLog("Downloaded wearable asset " + wearable.WearableType + " with " + wearable.Asset.Params.Count +
                                            " visual params and " + wearable.Asset.Textures.Count + " textures", Client);

                                    }
                                    else
                                    {
                                        wearable.Asset = null;
                                        Logger.Log("Failed to decode asset:" + Environment.NewLine +
                                            Utils.BytesToString(asset.AssetData), Helpers.LogLevel.Error, Client);
                                    }
                                }
                                else
                                {
                                    Logger.Log("Wearable " + wearable.AssetID + "(" + wearable.WearableType + ") failed to download, " +
                                        transfer.Status, Helpers.LogLevel.Warning, Client);
                                }

                                downloadEvent.Set();
                            }
                        );

                        if (!downloadEvent.WaitOne(WEARABLE_TIMEOUT, false))
                        {
                            Logger.Log("Timed out downloading wearable asset " + wearable.AssetID + " (" + wearable.WearableType + ")",
                                Helpers.LogLevel.Error, Client);
                            success = false;
                        }

                        --pendingWearables;
                    }
                }
            );

            return success;
        }
 public AssetPropertyDouble4DMap(TextureData tdata) : base(tdata)
 {
 }
Exemple #24
0
        private void rasterizeTri(Point2D v0, Point2D v1, Point2D v2, TextureData t0, TextureData t1, TextureData t2, uint c0, uint c1, uint c2, uint palette, uint texpage, Primitive primitive)
        {
            int area = orient2d(v0, v1, v2);

            if (area == 0)
            {
                return;
            }

            if (area < 0)
            {
                Point2D vertexAux = v1;
                v1 = v2;
                v2 = vertexAux;
                TextureData textureAux = t1;
                t1 = t2;
                t2 = textureAux;
                uint colorAux = c1;
                c1 = c2;
                c2 = colorAux;
            }

            /*(Point2D min, Point2D max) = */
            boundingBox(v0, v1, v2);

            int A01 = v0.y - v1.y, B01 = v1.x - v0.x;
            int A12 = v1.y - v2.y, B12 = v2.x - v1.x;
            int A20 = v2.y - v0.y, B20 = v0.x - v2.x;

            int w0_row = orient2d(v1, v2, min);
            int w1_row = orient2d(v2, v0, min);
            int w2_row = orient2d(v0, v1, min);

            //TEST
            area = w0_row + w1_row + w2_row;
            int depth      = (int)(texpage >> 7) & 0x3;
            int semiTransp = (int)((texpage >> 5) & 0x3);

            Point2D clut = new Point2D();

            clut.x = (short)((palette & 0x3f) << 4);
            clut.y = (short)((palette >> 6) & 0x1FF);

            Point2D textureBase = new Point2D();

            textureBase.x = (short)((texpage & 0xF) << 6);
            textureBase.y = (short)(((texpage >> 4) & 0x1) << 8);

            int baseColor = GetRgbColor(c0);

            //TESTING END


            // Rasterize
            for (int y = min.y; y < max.y; y++)
            {
                // Barycentric coordinates at start of row
                int w0 = w0_row;
                int w1 = w1_row;
                int w2 = w2_row;

                for (int x = min.x; x < max.x; x++)
                {
                    // If p is on or inside all edges, render pixel.
                    if ((w0 | w1 | w2) >= 0)
                    {
                        // reset default color of the triangle calculated outside the for as it gets overwriten as follows...
                        int color = baseColor;

                        if (primitive.isShaded)
                        {
                            color = getShadedColor(w0, w1, w2, c0, c1, c2, area);
                        }

                        if (primitive.isTextured)
                        {
                            (int texelX, int texelY) = interpolateCoords(w0, w1, w2, t0, t1, t2, area);
                            int texel = getTexel(texelX, texelY, clut, textureBase, depth);
                            if (texel == 0)
                            {
                                w0 += A12;
                                w1 += A20;
                                w2 += A01;
                                continue;
                            }

                            if (!primitive.isRawTextured)
                            {
                                color0.val = (uint)color;
                                color1.val = (uint)texel;
                                color1.r   = clampToFF(color0.r * color1.r >> 7);
                                color1.g   = clampToFF(color0.g * color1.g >> 7);
                                color1.b   = clampToFF(color0.b * color1.b >> 7);

                                texel = (int)color1.val;
                            }

                            color = texel;
                        }

                        if (primitive.isSemiTransparent && (!primitive.isTextured || (color & 0xFF00_0000) != 0))
                        {
                            color = handleSemiTransp(x, y, color, semiTransp);
                        }

                        VRAM.SetPixel((x & 0x3FF), (y & 0x1FF), color);
                    }
                    // One step to the right
                    w0 += A12;
                    w1 += A20;
                    w2 += A01;
                }
                // One row step
                w0_row += B12;
                w1_row += B20;
                w2_row += B01;
            }
            //if (debug) {
            //    //window.update(VRAM.Bits);
            //    Console.ReadLine();
            //}
        }
Exemple #25
0
        private void rasterizeRect(Point2D[] vec, TextureData t, uint c, ushort palette, uint texpage, Primitive primitive)
        {
            int xOrigin = Math.Max(vec[0].x, drawingAreaLeft);
            int yOrigin = Math.Max(vec[0].y, drawingAreaTop);
            int width   = Math.Min(vec[3].x, drawingAreaRight);
            int height  = Math.Min(vec[3].y, drawingAreaBottom);

            int depth      = (int)(texpage >> 7) & 0x3;
            int semiTransp = (int)((texpage >> 5) & 0x3);

            Point2D clut = new Point2D();

            clut.x = (short)((palette & 0x3f) << 4);
            clut.y = (short)((palette >> 6) & 0x1FF);

            Point2D textureBase = new Point2D();

            textureBase.x = (short)((texpage & 0xF) << 6);
            textureBase.y = (short)(((texpage >> 4) & 0x1) << 8);

            int uOrigin = t.x + (xOrigin - vec[0].x);
            int vOrigin = t.y + (yOrigin - vec[0].y);

            int baseColor = GetRgbColor(c);

            for (int y = yOrigin, v = vOrigin; y < height; y++, v++)
            {
                for (int x = xOrigin, u = uOrigin; x < width; x++, u++)
                {
                    int color = baseColor;

                    if (primitive.isTextured)
                    {
                        int texel = getTexel(u, v, clut, textureBase, depth);
                        if (texel == 0)
                        {
                            continue;
                        }

                        if (!primitive.isRawTextured)
                        {
                            color0.val = (uint)color;
                            color1.val = (uint)texel;
                            color1.r   = clampToFF(color0.r * color1.r >> 7);
                            color1.g   = clampToFF(color0.g * color1.g >> 7);
                            color1.b   = clampToFF(color0.b * color1.b >> 7);

                            texel = (int)color1.val;
                        }

                        color = texel;
                    }

                    if (primitive.isSemiTransparent && (!primitive.isTextured || (color & 0xFF00_0000) != 0))
                    {
                        color = handleSemiTransp(x, y, color, semiTransp);
                    }

                    VRAM.SetPixel(x, y, color);
                }
            }
        }
Exemple #26
0
 public void ServeTexture(TextureData data)
 {
     msServerServeTexture(self, data);
 }
        private void rasterizeTri(Point2D v0, Point2D v1, Point2D v2, TextureData t0, TextureData t1, TextureData t2, uint c0, uint c1, uint c2, uint palette, uint texpage, Type type)
        {
            area = orient2d(v0, v1, v2);

            if (area == 0)
            {
                return;
            }

            if (area < 0)
            {
                Point2D vertexAux = v1;
                v1 = v2;
                v2 = vertexAux;
                TextureData textureAux = t1;
                t1 = t2;
                t2 = textureAux;
                uint colorAux = c1;
                c1 = c2;
                c2 = colorAux;
            }

            /*(Point2D min, Point2D max) = */
            boundingBox(v0, v1, v2);

            int A01 = v0.y - v1.y, B01 = v1.x - v0.x;
            int A12 = v1.y - v2.y, B12 = v2.x - v1.x;
            int A20 = v2.y - v0.y, B20 = v0.x - v2.x;

            int w0_row = orient2d(v1, v2, min);
            int w1_row = orient2d(v2, v0, min);
            int w2_row = orient2d(v0, v1, min);

            //TEST
            area = w0_row + w1_row + w2_row;
            int depth = (int)(texpage >> 7) & 0x3;

            Point2D clut = new Point2D();

            clut.x = (short)((palette & 0x3f) << 4);
            clut.y = (short)((palette >> 6) & 0x1FF);

            Point2D textureBase = new Point2D();

            textureBase.x = (short)((texpage & 0xF) << 6);
            textureBase.y = (short)(((texpage >> 4) & 0x1) << 8);

            int col = GetRgbColor(c0);

            //TESTING END


            // Rasterize
            for (int y = min.y; y < max.y; y++)
            {
                // Barycentric coordinates at start of row
                int w0 = w0_row;
                int w1 = w1_row;
                int w2 = w2_row;

                for (int x = min.x; x < max.x; x++)
                {
                    // If p is on or inside all edges, render pixel.
                    if ((w0 | w1 | w2) >= 0)
                    {
                        switch (type)
                        {
                        case Type.flat:
                            //col = GetRgbColor(c0); //this is overkill here as its the same but putting it outside slows the important ones
                            VRAM.SetPixel((x & 0x3FF), (y & 0x1FF), col);
                            break;

                        case Type.shaded:
                            col = getShadedColor(w0, w1, w2, c0, c1, c2);
                            VRAM.SetPixel((x & 0x3FF), (y & 0x1FF), col);
                            break;

                        case Type.textured:
                            col = getTextureColor(w0, w1, w2, t0, t1, t2, clut, textureBase, depth);
                            if (col != 0)
                            {
                                VRAM.SetPixel((x & 0x3FF), (y & 0x1FF), col);
                            }
                            break;
                        }
                    }
                    // One step to the right
                    w0 += A12;
                    w1 += A20;
                    w2 += A01;
                }
                // One row step
                w0_row += B12;
                w1_row += B20;
                w2_row += B01;
            }
        }
 public void OnStrokeComplete()
 {
     TextureData.AfterStroke(Stroke);
 }
        private int getTextureColor(int w0, int w1, int w2, TextureData t0, TextureData t1, TextureData t2, Point2D clut, Point2D textureBase, int depth)
        {
            //https://codeplea.com/triangular-interpolation
            int x = (t0.x * w0 + t1.x * w1 + t2.x * w2) / area;
            int y = (t0.y * w0 + t1.y * w1 + t2.y * w2) / area;

            x &= 255;
            y &= 255;

            // Texture masking
            // texel = (texel AND(NOT(Mask * 8))) OR((Offset AND Mask) * 8)
            x = (x & ~(textureWindowMaskX * 8)) | ((textureWindowOffsetX & textureWindowMaskX) * 8);
            y = (y & ~(textureWindowMaskY * 8)) | ((textureWindowOffsetY & textureWindowMaskY) * 8);

            switch (depth)
            {
            case 0: return(get4bppTexel(x, y, clut, textureBase));

            case 1: return(get8bppTexel(x, y, clut, textureBase));

            case 2: return(get16bppTexel(x, y, textureBase));

            default: return(0x00FF00FF);
            }
        }
Exemple #30
0
 public EncounterRenderer(OverworldState overworldState)
     : base(overworldState)
 {
     pixelTextureData = ResourceManager.GetTextureData("white_pixel");
 }
Exemple #31
0
        public virtual void ConfigureTilemap()
        {
            var tilemapChip = target.tilemapChip;


            if (data.ContainsKey("layers"))
            {
                var layers   = data["layers"] as List <object>;
                var tileSets = data["tilesets"] as List <object>;

                var total = layers.Count;

                for (var i = 0; i < total; i++)
                {
                    try
                    {
                        var layer = layers[i] as Dictionary <string, object>;

                        var layerType = (string)layer["type"];

                        if (layerType == "tilelayer")
                        {
                            var tileSet = tileSets[i] as Dictionary <string, object>;


                            var offset = (int)(long)tileSet["firstgid"];

                            var columns = (int)(long)layer["width"];
                            var rows    = (int)(long)layer["height"];

                            var rawLayerData = layer["data"] as List <object>;

                            var dataValues = rawLayerData
                                             .Select(x => (int)(long)x - offset < -1 ? -1 : (int)(long)x - offset).ToArray();

                            if (columns != tilemapChip.columns || rows > tilemapChip.rows)
                            {
                                // Create texture data that matches the memory of the tilemap chip
                                var tmpPixelData = new TextureData(tilemapChip.columns, tilemapChip.rows);
                                tmpPixelData.Clear();

                                var jsonData = new TextureData(columns, rows);
                                jsonData.Clear();
                                jsonData.SetPixels(0, 0, columns, rows, dataValues);

                                var tmpCol = columns > tilemapChip.columns ? tilemapChip.columns : columns;
                                var tmpRow = rows > tilemapChip.rows ? tilemapChip.rows : rows;

                                if (tmpCol > columns)
                                {
                                    tmpCol = columns;
                                }

                                if (tmpRow > rows)
                                {
                                    tmpRow = rows;
                                }

                                var tmpData = new int[tmpCol * tmpRow];

                                jsonData.CopyPixels(ref tmpData, 0, 0, tmpCol, tmpRow);

                                tmpPixelData.SetPixels(0, 0, tmpCol, tmpRow, tmpData);

                                tmpPixelData.CopyPixels(ref dataValues, 0, 0, tmpPixelData.width, tmpPixelData.height);

                                tmpPixelData.CopyPixels(ref dataValues, 0, 0, tilemapChip.columns, tilemapChip.rows);
                            }


                            for (var j = 0; j < tilemapChip.total; j++)
                            {
                                var tile = tilemapChip.tiles[j];

                                if ((string)layer["name"] == "Sprites")
                                {
                                    tile.spriteID = dataValues[j];
                                }
                                else if ((string)layer["name"] == "Flags")
                                {
                                    tile.flag = dataValues[j];
                                }

                                tile.Invalidate();
                            }
                        }
                        else if (layerType == "objectgroup")
                        {
                            var objects = layer["objects"] as List <object>;

                            var totalTiles = objects.Count;

                            for (var j = 0; j < totalTiles; j++)
                            {
                                var tileObject = objects[j] as Dictionary <string, object>;

                                var column = (int)Math.Floor((float)(long)tileObject["x"] / 8);
                                var row    = (int)Math.Floor((float)(long)tileObject["y"] / 8) - 1;


                                var tile = tilemapChip.GetTile(column, row);


                                var gid = (uint)(long)tileObject["gid"];

                                var idMask = (1 << 30) - 1;

                                tile.spriteID = (int)(gid & idMask) - 1;

                                var hMask = 1 << 31;

                                tile.flipH = (hMask & gid) != 0;

                                var vMask = 1 << 30;

                                tile.flipV = (vMask & gid) != 0;

                                var properties = tileObject["properties"] as List <object>;

//								int flagID = -1;
//								int colorOffset = 0;

                                for (var k = 0; k < properties.Count; k++)
                                {
                                    var prop = properties[k] as Dictionary <string, object>;

                                    var propName = (string)prop["name"];

                                    if (propName == "flagID")
                                    {
                                        tile.flag = (int)(long)prop["value"];
                                    }
                                    else if (propName == "colorOffset")
                                    {
                                        tile.colorOffset = (int)(long)prop["value"];
                                    }
                                }

                                tile.Invalidate();
                            }
                        }

                        tilemapChip.Invalidate();
                        // TODO need to make sure that the layer is the same size as the display chip

                        // TODO copy the tilemap data over to layer correctly
                    }
                    catch
                    {
                        // Just ignore any layers that don't exist
                        throw new Exception(
                                  "Unable to parse 'tilemap.json' file. It may be corrupt. Try deleting it and creating a new one.");
                    }
                }
            }

            currentStep++;
        }
Exemple #32
0
        public TexturedMeshRenderer(AssetDatabase ad, RenderContext context, VertexPositionNormalTexture[] vertices, ushort[] indices, TextureData texture)
        {
            _vertices = vertices;
            _indices  = indices;
            _texture  = texture;

            _centeredBounds = BoundingSphere.CreateFromPoints(vertices);

            if (context != _currentContext)
            {
                if (_currentContext == null)
                {
                    InitializeContextObjects(context);
                }
                else
                {
                    ChangeRenderContext(ad, context);
                }
            }
        }
    void PrintCubemap()
    {
        float3[][] forwd = new float3[6][];
        for (int i = 0; i < 6; ++i)
        {
            forwd[i] = new float3[4];
        }
        //Forward
        forwd[4][0] = normalize(float3(-1, 1, 1));
        forwd[4][1] = normalize(float3(1, 1, 1));
        forwd[4][2] = normalize(float3(-1, -1, 1));
        forwd[4][3] = normalize(float3(1, -1, 1));
        //Left
        forwd[1][0] = normalize(float3(-1, 1, -1));
        forwd[1][1] = normalize(float3(-1, 1, 1));
        forwd[1][2] = normalize(float3(-1, -1, -1));
        forwd[1][3] = normalize(float3(-1, -1, 1));
        //Back
        forwd[5][0] = normalize(float3(1, 1, -1));
        forwd[5][1] = normalize(float3(-1, 1, -1));
        forwd[5][2] = normalize(float3(1, -1, -1));
        forwd[5][3] = normalize(float3(-1, -1, -1));

        //Right
        forwd[0][0] = normalize(float3(1, 1, 1));
        forwd[0][1] = normalize(float3(1, 1, -1));
        forwd[0][2] = normalize(float3(1, -1, 1));
        forwd[0][3] = normalize(float3(1, -1, -1));

        //up
        forwd[2][0] = normalize(float3(-1, 1, -1));
        forwd[2][1] = normalize(float3(1, 1, -1));
        forwd[2][2] = normalize(float3(-1, 1, 1));
        forwd[2][3] = normalize(float3(1, 1, 1));

        //down
        forwd[3][0] = normalize(float3(-1, -1, 1));
        forwd[3][1] = normalize(float3(1, -1, 1));
        forwd[3][2] = normalize(float3(-1, -1, -1));
        forwd[3][3] = normalize(float3(1, -1, -1));
        uint2 size = uint2(max((uint)texture.width, 1024), max((uint)texture.height, 1024));

        ComputeBuffer cb       = new ComputeBuffer((int)size.x * (int)size.y, sizeof(float4), ComputeBufferType.Default);
        int           mipCount = useMipMap ? (int)(log2(size.x / 16) + 0.1) : 1;
        TextureData   data     = new TextureData
        {
            depth       = 6,
            width       = size.x,
            height      = size.y,
            mipCount    = (uint)mipCount,
            format      = TextureData.LoadFormat.LoadFormat_RGBAFloat16,
            textureType = TextureType.Cubemap
        };

        readCS.SetTexture(0, "_MainTex", texture);
        readCS.SetBuffer(0, "_ResultBuffer", cb);
        float4[]          readbackValues = new float4[size.x * size.y];
        NativeList <byte> lst            = new NativeList <byte>((int)(size.x * size.y * 1.4), Unity.Collections.Allocator.Temp);
        byte *            headerPtr      = (byte *)data.Ptr();

        for (int i = 0; i < sizeof(TextureData); ++i)
        {
            lst.Add(headerPtr[i]);
        }
        Vector4[] setterArray = new Vector4[4];
        for (int face = 0; face < 6; ++face)
        {
            size = uint2(max((uint)texture.width, 1024), max((uint)texture.height, 1024));
            for (int i = 0; i < mipCount; ++i)
            {
                readCS.SetInt("_TargetMipLevel", i);
                readCS.SetInt("_Count", (int)size.x);
                for (int j = 0; j < 4; ++j)
                {
                    setterArray[j] = (Vector3)forwd[face][j];
                }
                readCS.SetVectorArray("_Directions", setterArray);
                readCS.Dispatch(0, max(1, Mathf.CeilToInt(size.x / 8f)), max(1, Mathf.CeilToInt(size.y / 8f)), 1);
                int cum = (int)(size.x * size.y);
                cb.GetData(readbackValues, 0, 0, cum);
                int pixelSize = 0;
                if (isCubemapCompress)
                {
                    pixelSize = 1;
                    NativeArray <byte> compressedData = new NativeArray <byte>(cum, Allocator.Temp, NativeArrayOptions.UninitializedMemory);
                    BC6UHCompressJob   job;
                    job.dest   = (uint4 *)compressedData.GetUnsafePtr();
                    job.source = readbackValues.Ptr();
                    job.width  = (int)size.x;
                    JobHandle handle = job.Schedule((cum / 16), max((cum / 16) / 20, 1));
                    handle.Complete();
                    for (int a = 0; a < compressedData.Length; ++a)
                    {
                        lst.Add(compressedData[a]);
                    }
                }
                else
                {
                    pixelSize = sizeof(half4);
                    for (int j = 0; j < cum; ++j)
                    {
                        half4 hlfResult = (half4)readbackValues[j];
                        byte *b         = (byte *)hlfResult.Ptr();
                        for (int z = 0; z < sizeof(half4); ++z)
                        {
                            lst.Add(b[z]);
                        }
                    }
                }
                for (int j = cum * pixelSize; j < 512; ++j)
                {
                    lst.Add(0);
                }
                size /= 2;
                size  = max(size, 1);
            }
        }
        byte[] finalArray = new byte[lst.Length];
        UnsafeUtility.MemCpy(finalArray.Ptr(), lst.unsafePtr, lst.Length);
        using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
        {
            fs.Write(finalArray, 0, lst.Length);
        }
    }
Exemple #34
0
    public static PreviewMap GeneratePreviewMap(int width, int height, float minValue, float maxValue, PreviewMapSettings settings, HeightMap heightMap, TextureData textureData /*, ClutterMap[] clutterMaps*/)
    {
        float[,] previewMapValues = new float[heightMap.values.GetLength(0), heightMap.values.GetLength(1)];
        int numberOfLayers = textureData.layers.Length;

        //int numberOfClutterMaps = clutterMaps.Length;
        Color[] colors      = new Color[numberOfLayers /* + numberOfClutterMaps*/];
        float[] colorValues = new float[numberOfLayers /* + numberOfClutterMaps*/];

        for (int x = 0; x < heightMap.values.GetLength(0); x++)
        {
            for (int y = 0; y < heightMap.values.GetLength(1); y++)
            {
                previewMapValues[x, y] = Mathf.InverseLerp(minValue, maxValue, heightMap.values[x, y]);
            }
        }

        for (int x = 0; x < heightMap.values.GetLength(0); x++)
        {
            for (int y = 0; y < heightMap.values.GetLength(1); y++)
            {
                for (int i = numberOfLayers - 1; i >= 0; i--)
                {
                    if (previewMapValues[x, y] >= textureData.layers[i].startHeight)
                    {
                        previewMapValues[x, y] = i;
                        break;
                    }
                }

                //for (int i = 0; i < numberOfClutterMaps; i++)
                //{
                //    if (clutterMaps[i].values[x, y] == 1)
                //    {
                //        previewMapValues[x, y] = numberOfLayers + i;
                //    }
                //}
            }
        }

        for (int i = colors.Length - 1; i >= 0; i--)
        {
            colors[i]      = settings.colors[i];
            colorValues[i] = i;
        }

        return(new PreviewMap(previewMapValues, colorValues, colors));
    }
Exemple #35
0
        static void SetupNative(TextureData texture)
        {
            ("SetupNative on texture: " + texture.Info.name).Log();
            if (texture.Info.texture == null)
            {
                throw new Exception("Texture null. Todo21: Probably related.");
            }

            /*if ("ThunderAerospace/TacLifeSupportContainers/FoodTexture" == texture.Info.name)
             * {
             *  (texture.Info== null ? "INFO NULL": "INFO OK").Log();
             *  (texture.Info.texture == null ? "TEX NULL" : "TEX OK").Log();
             *  (texture.Info.texture.name).Log();
             *  (texture.Info.texture.format.ToString()).Log();
             *  texture.Info.texture.width.ToString().Log();
             * }*/
            texture.UnloadedTexture = texture.Info.texture.GetNativeTexturePtr();

            /*bool isNormal = false;
             * var tex = Legacy.LegacyLoader.LoadImage(new System.IO.FileInfo(texture.File.fullPath), ref isNormal, texture.Info.isNormalMap);
             * System.IO.File.WriteAllBytes(
             *  texture.File.fullPath + ".png.stock",
             *  tex.EncodeToPNG());
             *
             * //using (var text = System.IO.File.CreateText(texture.File.fullPath + ".stock.txt"))
             * using (var text2 = System.IO.File.CreateText(texture.File.fullPath + ".stockbyte.txt"))
             * {
             *  for (int y = tex.height - 1; y >= 0; y--) // Unity textures are upside down.
             *  {
             *      for (int x = 0; x < tex.width; x++)
             *      {
             *          var c = tex.GetPixel(x, y);
             *          Color32 c2 = c;
             *          //text.Write("{" + c.a + "|" + c.r + "|" + c.g + "|" + c.b + "}");
             *          text2.Write("{" + c2.a + "|" + c2.r + "|" + c2.g + "|" + c2.b + "}");
             *      }
             *      //text.WriteLine();
             *      text2.WriteLine();
             *  }
             * }*/
            /*
             * var oldUnloadedPtr = texture.Info.texture.GetNativeTexturePtr();
             * texture.Info.texture.UpdateExternalTexture(tex.GetNativeTexturePtr());
             * tex.UpdateExternalTexture(oldUnloadedPtr);
             * return;*/
            var imgConfig   = Config.Current.GetImageConfig(texture.File);
            var imgSettings = ImageSettings.Combine(imgConfig.ImageSettings, Config.Current.DefaultImageSettings);

            Logic.ActivityGUI.PrepareStarting();
            ("Sending img settings for texture: {HRC=" + imgSettings.HighResCompress + ", TC=" + imgSettings.ThumbnailCompress + ", TE=" + imgSettings.ThumbnailEnabled + ",TW=" + imgSettings.ThumbnailWidth + ",TH=" + imgSettings.ThumbnailHeight + "}").Log();
            texture.NativeId = NativeBridge.RegisterTextureAndRequestThumbLoad(
                new System.IO.FileInfo(texture.File.fullPath).FullName,
                imgConfig.CacheKey,
                //texture.UnloadedTexture,
                texture.Info.isNormalMap,
                imgSettings
                );
            if (!imgSettings.HighResEnabled.Value)
            {
                texture.File = null;
            }
            texture.Info.isReadable = false;
            ("Native ID received: " + texture.NativeId + " for " + texture.Info.name).Log();
        }
Exemple #36
0
 /// <summary>
 /// Get and Set the Appropriate Handler Information for Importing Into the Scene
 /// </summary>
 /// <param name="textureData">The Image That We Will Be Working On</param>
 public static void SetHandler(ref TextureData textureData)
 {
     textureData.data.handler = KSIKeywordHandler.FindHandler(textureData.data.Type);
 }
 public void set_cr(TextureData c)
 {
     cr = c;
 }
 public EncounterRenderer(OverworldState overworldState)
     : base(overworldState)
 {
     pixelTextureData = ResourceManager.GetTextureData("white_pixel");
 }
    protected override void ApplySplat(Matrix4x4 localToWorld, Matrix4x4 worldToLocal)
    {
        bool should0 = this.ShouldSplat(1);
        bool should1 = this.ShouldSplat(2);
        bool should2 = this.ShouldSplat(4);
        bool should3 = this.ShouldSplat(8);
        bool should4 = this.ShouldSplat(16);
        bool should5 = this.ShouldSplat(32);
        bool should6 = this.ShouldSplat(64);
        bool should7 = this.ShouldSplat(128);

        if (!should0 && !should1 && (!should2 && !should3) && (!should4 && !should5 && (!should6 && !should7)))
        {
            return;
        }
        Vector3     position   = ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.get_zero());
        TextureData heightdata = new TextureData(this.heightmap);
        TextureData splat0data = new TextureData(this.splatmap0);
        TextureData splat1data = new TextureData(this.splatmap1);

        TerrainMeta.SplatMap.ForEachParallel(((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3((float)-this.extents.x, 0.0f, (float)-this.extents.z))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3((float)this.extents.x, 0.0f, (float)-this.extents.z))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3((float)-this.extents.x, 0.0f, (float)this.extents.z))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3((float)this.extents.x, 0.0f, (float)this.extents.z))), (Action <int, int>)((x, z) =>
        {
            float normZ = TerrainMeta.SplatMap.Coordinate(z);
            float normX = TerrainMeta.SplatMap.Coordinate(x);
            Vector3 vector3_1;
            ((Vector3) ref vector3_1).\u002Ector(TerrainMeta.DenormalizeX(normX), 0.0f, TerrainMeta.DenormalizeZ(normZ));
            Vector3 vector3_2 = Vector3.op_Subtraction(((Matrix4x4) ref worldToLocal).MultiplyPoint3x4(vector3_1), this.offset);
            float opacity     = Mathf.InverseLerp((float)position.y, (float)position.y + this.Fade, (float)(position.y + this.offset.y + (double)heightdata.GetInterpolatedHalf((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z)) * this.size.y));
            if ((double)opacity == 0.0)
            {
                return;
            }
            Vector4 interpolatedVector1 = splat0data.GetInterpolatedVector((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z));
            Vector4 interpolatedVector2 = splat1data.GetInterpolatedVector((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z));
            if (!should0)
            {
                interpolatedVector1.x = (__Null)0.0;
            }
            if (!should1)
            {
                interpolatedVector1.y = (__Null)0.0;
            }
            if (!should2)
            {
                interpolatedVector1.z = (__Null)0.0;
            }
            if (!should3)
            {
                interpolatedVector1.w = (__Null)0.0;
            }
            if (!should4)
            {
                interpolatedVector2.x = (__Null)0.0;
            }
            if (!should5)
            {
                interpolatedVector2.y = (__Null)0.0;
            }
            if (!should6)
            {
                interpolatedVector2.z = (__Null)0.0;
            }
            if (!should7)
            {
                interpolatedVector2.w = (__Null)0.0;
            }
            TerrainMeta.SplatMap.SetSplatRaw(x, z, interpolatedVector1, interpolatedVector2, opacity);
        }));
    }
 public ParticleManager(float particleTime, TextureData textureData)
 {
     this.particleTime = particleTime;
     this.textureData = textureData;
     text = null;
 }
        public TexturedMeshRenderer(AssetDatabase ad, RenderContext context, VertexPositionNormalTexture[] vertices, int[] indices, TextureData texture)
        {
            _worldProvider = new DynamicDataProvider <Matrix4x4>();
            _inverseTransposeWorldProvider = new DependantDataProvider <Matrix4x4>(_worldProvider, CalculateInverseTranspose);
            _perObjectProviders            = new ConstantBufferDataProvider[] { _worldProvider, _inverseTransposeWorldProvider };
            _vertices = vertices;
            _indices  = indices;
            _texture  = texture;

            _centeredBounds = BoundingSphere.CreateFromPoints(vertices);

            if (context != _currentContext)
            {
                if (_currentContext == null)
                {
                    InitializeContextObjects(context);
                }
                else
                {
                    ChangeRenderContext(ad, context);
                }
            }
        }
        /// <summary>
        /// Populates textures and visual params from a decoded asset
        /// </summary>
        /// <param name="wearable">Wearable to decode</param>
        /// <summary>
        /// Populates textures and visual params from a decoded asset
        /// </summary>
        /// <param name="wearable">Wearable to decode</param>
        public static void DecodeWearableParams(WearableData wearable, ref TextureData[] textures)
        {
            Dictionary<VisualAlphaParam, float> alphaMasks = new Dictionary<VisualAlphaParam, float>();
            List<ColorParamInfo> colorParams = new List<ColorParamInfo>();

            // Populate collection of alpha masks from visual params
            // also add color tinting information
            foreach (KeyValuePair<int, float> kvp in wearable.Asset.Params)
            {
                if (!VisualParams.Params.ContainsKey(kvp.Key)) continue;

                VisualParam p = VisualParams.Params[kvp.Key];

                ColorParamInfo colorInfo = new ColorParamInfo();
                colorInfo.WearableType = wearable.WearableType;
                colorInfo.VisualParam = p;
                colorInfo.Value = kvp.Value;

                // Color params
                if (p.ColorParams.HasValue)
                {
                    colorInfo.VisualColorParam = p.ColorParams.Value;

                    if (wearable.WearableType == WearableType.Tattoo)
                    {
                        if (kvp.Key == 1062 || kvp.Key == 1063 || kvp.Key == 1064)
                        {
                            colorParams.Add(colorInfo);
                        }
                    }
                    else if (wearable.WearableType == WearableType.Jacket)
                    {
                        if (kvp.Key == 809 || kvp.Key == 810 || kvp.Key == 811)
                        {
                            colorParams.Add(colorInfo);
                        }
                    }
                    else if (wearable.WearableType == WearableType.Hair)
                    {
                        // Param 112 - Rainbow
                        // Param 113 - Red
                        // Param 114 - Blonde
                        // Param 115 - White
                        if (kvp.Key == 112 || kvp.Key == 113 || kvp.Key == 114 || kvp.Key == 115)
                        {
                            colorParams.Add(colorInfo);
                        }
                    }
                    else if (wearable.WearableType == WearableType.Skin)
                    {
                        // For skin we skip makeup params for now and use only the 3
                        // that are used to determine base skin tone
                        // Param 108 - Rainbow Color
                        // Param 110 - Red Skin (Ruddiness)
                        // Param 111 - Pigment
                        if (kvp.Key == 108 || kvp.Key == 110 || kvp.Key == 111)
                        {
                            colorParams.Add(colorInfo);
                        }
                    }
                    else
                    {
                        colorParams.Add(colorInfo);
                    }
                }

                // Add alpha mask
                if (p.AlphaParams.HasValue && p.AlphaParams.Value.TGAFile != string.Empty && !p.IsBumpAttribute && !alphaMasks.ContainsKey(p.AlphaParams.Value))
                {
                    alphaMasks.Add(p.AlphaParams.Value, kvp.Value == 0 ? 0.01f : kvp.Value);
                }

                // Alhpa masks can also be specified in sub "driver" params
                if (p.Drivers != null)
                {
                    for (int i = 0; i < p.Drivers.Length; i++)
                    {
                        if (VisualParams.Params.ContainsKey(p.Drivers[i]))
                        {
                            VisualParam driver = VisualParams.Params[p.Drivers[i]];
                            if (driver.AlphaParams.HasValue && driver.AlphaParams.Value.TGAFile != string.Empty && !driver.IsBumpAttribute && !alphaMasks.ContainsKey(driver.AlphaParams.Value))
                            {
                                alphaMasks.Add(driver.AlphaParams.Value, kvp.Value == 0 ? 0.01f : kvp.Value);
                            }
                        }
                    }
                }
            }

            Color4 wearableColor = Color4.White; // Never actually used
            if (colorParams.Count > 0)
            {
                wearableColor = GetColorFromParams(colorParams);
                Logger.DebugLog("Setting tint " + wearableColor + " for " + wearable.WearableType);
            }

            // Loop through all of the texture IDs in this decoded asset and put them in our cache of worn textures
            foreach (KeyValuePair<AvatarTextureIndex, UUID> entry in wearable.Asset.Textures)
            {
                int i = (int)entry.Key;

                // Update information about color and alpha masks for this texture
                textures[i].AlphaMasks = alphaMasks;
                textures[i].Color = wearableColor;

                // If this texture changed, update the TextureID and clear out the old cached texture asset
                if (textures[i].TextureID != entry.Value)
                {
                    // Treat DEFAULT_AVATAR_TEXTURE as null
                    if (entry.Value != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
                        textures[i].TextureID = entry.Value;
                    else
                        textures[i].TextureID = UUID.Zero;

                    textures[i].Texture = null;
                }
            }
        }
Exemple #43
0
 static extern void msServerServeTexture(IntPtr self, TextureData data);
        public uint LoadTexture(string a_szTextureFile)
        {
            // first Check if we have already loaded the file:
            TextureData oTexture;
            if (m_dicTextures.TryGetValue(a_szTextureFile, out oTexture))
            {
                oTexture.m_uiUseCount++;
                return oTexture.m_uiTextureID;
            }

            // Second check if the file exists:
            if (!System.IO.File.Exists(a_szTextureFile))
            {
#if LOG4NET_ENABLED
                logger.Error("Could not find texture file: " + a_szTextureFile);
#endif
                return 0; // retun 0 if invalid file.
            }

            // looks like the file is valid and we have not loaded it before
            // Create New Texture Data:
            TextureData oNewTexture = new TextureData();
            oNewTexture.m_szTextureFile = a_szTextureFile;
            oNewTexture.m_uiUseCount = 1;

            // load the file into a bitmap
            System.Drawing.Bitmap oTextureBitmap = new System.Drawing.Bitmap(a_szTextureFile);

            // Get the data out of the bit map
            System.Drawing.Imaging.BitmapData oRawTextureData = oTextureBitmap.LockBits(new Rectangle(0, 0, oTextureBitmap.Width, oTextureBitmap.Height),
                                                                                    System.Drawing.Imaging.ImageLockMode.ReadOnly,
                                                                                    System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            // Code to transfer Texture Data to GPU

            // Generate Texture Handle
            GL.GenTextures(1, out oNewTexture.m_uiTextureID);
            // Tell openGL that this is a 2d texture:
            GL.BindTexture(TextureTarget.Texture2D, oNewTexture.m_uiTextureID);

            // Configure Text Paramaters:
            //GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvMode.Modulate);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (float)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Linear);

            // Load data by telling OpenGL to build mipmaps out of bitmap data
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, oTextureBitmap.Width, oTextureBitmap.Height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, oRawTextureData.Scan0);

#if LOG4NET_ENABLED
            logger.Info("OpenGL Loading Texture " + a_szTextureFile + ": " + GL.GetError().ToString());
#endif

            // Now that we have provided the data to OpenGL we can free the texture from system Ram.
            oTextureBitmap.UnlockBits(oRawTextureData);

            // add our new texture to the dic:
            if (!m_dicTextures.ContainsKey(a_szTextureFile)){
                m_dicTextures.Add(a_szTextureFile, oNewTexture);
            }

            return oNewTexture.m_uiTextureID;
        }
Exemple #45
0
        private (int x, int y) interpolateCoords(int w0, int w1, int w2, TextureData t0, TextureData t1, TextureData t2, int area)
        {
            //https://codeplea.com/triangular-interpolation
            int x = (t0.x * w0 + t1.x * w1 + t2.x * w2) / area;
            int y = (t0.y * w0 + t1.y * w1 + t2.y * w2) / area;

            return(x, y);
        }
Exemple #46
0
        public void DeSerializeSettings(AstarSerializer serializer)
        {
            //width = (int)serializer.GetValue ("Width",typeof(int));
            //depth = (int)serializer.GetValue ("Depth",typeof(int));
            //height = (float)serializer.GetValue ("Height",typeof(float));

            unclampedSize = (Vector2)serializer.GetValue ("unclampedSize",typeof(Vector2));

            cutCorners = (bool)serializer.GetValue ("cutCorners",typeof(bool));
            neighbours = (NumNeighbours)serializer.GetValue ("neighbours",typeof(int));

            rotation = (Vector3)serializer.GetValue ("rotation",typeof(Vector3));

            nodeSize = (float)serializer.GetValue ("nodeSize",typeof(float));

            collision = (GraphCollision)serializer.GetValue ("collision",typeof(GraphCollision));

            center = (Vector3)serializer.GetValue ("center",typeof(Vector3));

            maxClimb = (float)serializer.GetValue ("maxClimb",typeof(float));
            maxClimbAxis = (int)serializer.GetValue ("maxClimbAxis",typeof(int),1);
            maxSlope = (float)serializer.GetValue ("maxSlope",typeof(float),90.0F);

            erodeIterations = (int)serializer.GetValue ("erodeIterations",typeof(int));

            penaltyAngle = 			(bool)serializer.GetValue ("penaltyAngle",typeof(bool));
            penaltyAngleFactor = 	(float)serializer.GetValue ("penaltyAngleFactor",typeof(float));
            penaltyPosition = 		(bool)serializer.GetValue ("penaltyPosition",typeof(bool));
            penaltyPositionOffset = (float)serializer.GetValue ("penaltyPositionOffset",typeof(float));
            penaltyPositionFactor = (float)serializer.GetValue ("penaltyPositionFactor",typeof(float));

            aspectRatio = (float)serializer.GetValue ("aspectRatio",typeof(float),1F);

            textureData			=	serializer.GetValue ("textureData",typeof(TextureData)) as TextureData;
            if (textureData == null) textureData = new TextureData ();

            #if UNITY_EDITOR
            Matrix4x4 oldMatrix = matrix;
            #endif

            GenerateMatrix ();
            SetUpOffsetsAndCosts ();

            #if UNITY_EDITOR
            if (serializer.onlySaveSettings) {
                if (oldMatrix != matrix && nodes != null) {
                    AstarPath.active.AutoScan ();
                }
            }
            #endif

            //Debug.Log ((string)serializer.GetValue ("SomeString",typeof(string)));
            //Debug.Log ((Bounds)serializer.GetValue ("SomeBounds",typeof(Bounds)));
        }
 public IntroOutroRenderer(BattleState battleState)
     : base(battleState)
 {
     pixelTextureData = ResourceManager.GetTextureData("white_pixel");
 }