public Texture2D OnRenderAtlas()
 {
     fastRenderer = new MB_TextureCombinerRenderTexture();
     _doRenderAtlas = true;
     Texture2D atlas = fastRenderer.DoRenderAtlas(this.gameObject,width,height,padding,rects,textureSets,indexOfTexSetToRender);
     _doRenderAtlas = false;
     return atlas;
 }
예제 #2
0
    public Texture2D OnRenderAtlas(MB3_TextureCombiner combiner)
    {
        fastRenderer   = new MB_TextureCombinerRenderTexture();
        _doRenderAtlas = true;
        Texture2D atlas = fastRenderer.DoRenderAtlas(this.gameObject, width, height, padding, rects, textureSets, indexOfTexSetToRender, texPropertyName, resultMaterialTextureBlender, isNormalMap, fixOutOfBoundsUVs, considerNonTextureProperties, combiner, LOG_LEVEL);

        _doRenderAtlas = false;
        return(atlas);
    }
예제 #3
0
    public Texture2D OnRenderAtlas()
    {
        fastRenderer   = new MB_TextureCombinerRenderTexture();
        _doRenderAtlas = true;
        Texture2D atlas = fastRenderer.DoRenderAtlas(this.gameObject, width, height, padding, rects, textureSets, indexOfTexSetToRender);

        _doRenderAtlas = false;
        return(atlas);
    }
예제 #4
0
    public Texture2D OnRenderAtlas(MB3_TextureCombiner combiner)
    {
        this.fastRenderer   = new MB_TextureCombinerRenderTexture();
        this._doRenderAtlas = true;
        Texture2D result = this.fastRenderer.DoRenderAtlas(base.gameObject, this.width, this.height, this.padding, this.rects, this.textureSets, this.indexOfTexSetToRender, this.isNormalMap, this.fixOutOfBoundsUVs, combiner, this.LOG_LEVEL);

        this._doRenderAtlas = false;
        return(result);
    }
예제 #5
0
        internal Texture2D DoRenderAtlas(GameObject go, int width, int height, bool isNormalMap, ShaderTextureProperty propertyName)
        {
            System.Diagnostics.Stopwatch db_time_DoRenderAtlas = new System.Diagnostics.Stopwatch();
            db_time_DoRenderAtlas.Start();
            Debug.Assert(_initialized && _camSetup);
            RenderTexture _destinationTexture;

            if (isNormalMap)
            {
                _destinationTexture = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
            }
            else
            {
                _destinationTexture = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
            }

            _destinationTexture.filterMode = FilterMode.Point;
            Camera myCamera = go.GetComponent <Camera>();

            myCamera.targetTexture = _destinationTexture;
            if (LOG_LEVEL >= MB2_LogLevel.debug)
            {
                Debug.Log(string.Format("Begin Camera.Render destTex w={0} h={1} camPos={2} camSize={3} camAspect={4}", width, height, go.transform.localPosition, myCamera.orthographicSize, myCamera.aspect.ToString("f5")));
            }
            myCamera.Render();

            System.Diagnostics.Stopwatch db_ConvertRenderTextureToTexture2D = new System.Diagnostics.Stopwatch();
            db_ConvertRenderTextureToTexture2D.Start();
            Texture2D tempTexture = new Texture2D(_destinationTexture.width, _destinationTexture.height, TextureFormat.ARGB32, true, false);

            MB_TextureCombinerRenderTexture.ConvertRenderTextureToTexture2D(_destinationTexture, MB_TextureCombinerRenderTexture.YisFlipped(LOG_LEVEL), isNormalMap, LOG_LEVEL, tempTexture);

            if (LOG_LEVEL >= MB2_LogLevel.trace)
            {
                Debug.Log("Finished rendering atlas " + propertyName.name + "  db_time_DoRenderAtlas:" + (db_time_DoRenderAtlas.ElapsedMilliseconds * .001f) + "  db_ConvertRenderTextureToTexture2D:" + (db_ConvertRenderTextureToTexture2D.ElapsedMilliseconds * .001f));
            }
            MB_Utility.Destroy(_destinationTexture);
            return(tempTexture);
        }
	public Texture2D OnRenderAtlas(MB3_TextureCombiner combiner){
		fastRenderer = new MB_TextureCombinerRenderTexture();
		_doRenderAtlas = true;
		Texture2D atlas = fastRenderer.DoRenderAtlas(this.gameObject,width,height,padding,rects,textureSets,indexOfTexSetToRender, isNormalMap, fixOutOfBoundsUVs, combiner, LOG_LEVEL);
		_doRenderAtlas = false;
		return atlas;
	}