Ejemplo n.º 1
0
        public UIForiaMaterialPool(Material material)
        {
            this.small   = new Material(material);
            this.medium  = new Material(material);
            this.large   = new Material(material);
            this.huge    = new Material(material);
            this.massive = new Material(material);

            this.small.EnableKeyword("BATCH_SIZE_SMALL");
            this.medium.EnableKeyword("BATCH_SIZE_MEDIUM");
            this.large.EnableKeyword("BATCH_SIZE_LARGE");
            this.huge.EnableKeyword("BATCH_SIZE_HUGE");
            this.massive.EnableKeyword("BATCH_SIZE_MASSIVE");

            this.smallBlock   = new UIForiaPropertyBlock(small, RenderContext.k_ObjectCount_Small);
            this.mediumBlock  = new UIForiaPropertyBlock(medium, RenderContext.k_ObjectCount_Medium);
            this.largeBlock   = new UIForiaPropertyBlock(large, RenderContext.k_ObjectCount_Large);
            this.hugeBlock    = new UIForiaPropertyBlock(huge, RenderContext.k_ObjectCount_Huge);
            this.massiveBlock = new UIForiaPropertyBlock(massive, RenderContext.k_ObjectCount_Massive);

            FixedRenderState state = FixedRenderState.Default;

            MaterialUtil.SetupState(small, state);
            MaterialUtil.SetupState(medium, state);
            MaterialUtil.SetupState(large, state);
            MaterialUtil.SetupState(huge, state);
            MaterialUtil.SetupState(massive, state);
        }
Ejemplo n.º 2
0
        public ClipContext(UIForiaSettings settings)
        {
            this.clipDrawMaterial   = new Material(settings.sdfPathMaterial);
            this.clearMaterial      = new Material(settings.clearClipRegionsMaterial);
            this.clearCountMaterial = new Material(clearMaterial);

            this.clearMaterial.SetColor(s_Color, Color.white);
            this.clearCountMaterial.SetColor(s_Color, new Color(0, 0, 0, 0));

            this.countMaterial     = new Material(settings.clipCountMaterial);
            this.blitCountMaterial = new Material(settings.clipBlitMaterial);
            this.clipMaterialPool  = new ClipMaterialPool(clipDrawMaterial);
            this.positionList      = new StructList <Vector3>();
            this.texCoordList0     = new StructList <Vector4>();
            this.texCoordList1     = new StructList <Vector4>();
            this.triangleList      = new StructList <int>();
            this.batchesToRender   = new StructList <ClipBatch>();
            this.clippers          = new LightList <ClipData>();
            this.meshPool          = new MeshPool();
            // todo -- dont use screen dimensions
            this.clipTexture       = new RenderTexture(Screen.width, Screen.height, 24, RenderTextureFormat.ARGB32);
            this.countTexture      = new RenderTexture(Screen.width, Screen.height, 24, RenderTextureFormat.ARGB32);
            this.clipTexture.name  = "UIForia Clip Draw Texture";
            this.countTexture.name = "UIForia Clip Count Texture";
            BlendState blendState = BlendState.Default;

            blendState.sourceBlendMode = BlendMode.One;
            blendState.destBlendMode   = BlendMode.One;
            blendState.blendOp         = BlendOp.Min;
            DepthState depthState = DepthState.Default;

            depthState.compareFunction = CompareFunction.Equal;
            depthState.writeEnabled    = true;

            MaterialUtil.SetupState(clipDrawMaterial, new FixedRenderState(blendState, depthState));
        }