public void Render(IMeshRenderer renderer, int rectangleCount,
                               Material material, UnityEngine.Color additionalColor)
            {
                if (parent != null)
                {
                    parent.Render(renderer, rectangleCount, material, additionalColor);
                    return;
                }

                if (currentMeshComponent == null)
                {
                    meshComponentNo      = 0;
                    currentMeshComponent = meshComponents[meshComponentNo];
                    currentMeshComponent.SetMaterial(material, additionalColor);
                }
                else
                {
                    Material componentMaterial =
                        currentMeshComponent.meshRenderer.sharedMaterial;
                    if (componentMaterial != material ||
                        (currentMeshComponent.property != null &&
                         currentMeshComponent.additionalColor != additionalColor))
                    {
                        int no = ++meshComponentNo;
                        if (no >= meshComponents.Count)
                        {
                            AddMeshComponent();
                        }
                        currentMeshComponent = meshComponents[no];
                        currentMeshComponent.SetMaterial(material, additionalColor);
                    }
                }

                currentMeshComponent.AddRenderer(renderer, rectangleCount, updateCount);
            }
Esempio n. 2
0
            public override void BeginRender(LWF lwf)
            {
                base.BeginRender(lwf);

                parent = null;
                var lwfParent = lwf.GetParent();

                if (lwfParent != null)
                {
                    parent = lwfParent.rendererFactory as Factory;
                }
                if (parent != null)
                {
                    return;
                }

                needsUpdate = false;
                if (updateCount != lwf.updateCount)
                {
                    needsUpdate          = true;
                    updateCount          = lwf.updateCount;
                    meshComponentNo      = -1;
                    currentMeshComponent = null;
                }
            }
            private CombinedMeshComponent AddMeshComponent()
            {
                GameObject gobj = new GameObject(
                    "LWF/" + data.name + "/Mesh/" + meshComponents.Count);

                gobj.SetActive(false);
                gobj.transform.parent        = gameObject.transform;
                gobj.transform.localPosition = Vector3.zero;
                gobj.transform.localScale    = Vector3.one;
                gobj.transform.localRotation = Quaternion.identity;
                CombinedMeshComponent meshComponent =
                    gobj.AddComponent <CombinedMeshComponent>();

                meshComponent.Init(this);
                meshComponents.Add(meshComponent);
                return(meshComponent);
            }
Esempio n. 4
0
            public void Render(
		IMeshRenderer renderer, int rectangleCount, Material material)
            {
                if (parent != null) {
                parent.Render(renderer, rectangleCount, material);
                return;
                }

                if (currentMeshComponent == null) {
                meshComponentNo = 0;
                currentMeshComponent = meshComponents[meshComponentNo];
                currentMeshComponent.SetMaterial(material);
                } else {
                Material componentMaterial =
                currentMeshComponent.meshRenderer.sharedMaterial;
                if (componentMaterial != material) {
                int no = ++meshComponentNo;
                if (no >= meshComponents.Count)
                    AddMeshComponent();
                currentMeshComponent = meshComponents[no];
                currentMeshComponent.SetMaterial(material);
                }
                }

                currentMeshComponent.AddRenderer(renderer, rectangleCount, updateCount);
            }
Esempio n. 5
0
            public override void BeginRender(LWF lwf)
            {
                base.BeginRender(lwf);

                parent = null;
                var lwfParent = lwf.GetParent();
                if (lwfParent != null)
                parent = lwfParent.rendererFactory as Factory;
                if (parent != null)
                return;

                updateCount = lwf.updateCount;
                meshComponentNo = -1;
                currentMeshComponent = null;
            }
Esempio n. 6
0
            public void Render(IMeshRenderer renderer, int rectangleCount,
		Material material, UnityEngine.Color additionalColor)
            {
                if (parent != null) {
                parent.Render(renderer, rectangleCount, material, additionalColor);
                return;
                }
                if (!needsUpdate)
                return;

                if (currentMeshComponent == null) {
                meshComponentNo = 0;
                currentMeshComponent = meshComponents[meshComponentNo];
                currentMeshComponent.SetMaterial(material, additionalColor);
                } else {
                Material componentMaterial =
                currentMeshComponent.meshRenderer.sharedMaterial;
                if (componentMaterial != material ||
                    (currentMeshComponent.property != null &&
                    currentMeshComponent.additionalColor != additionalColor)) {
                int no = ++meshComponentNo;
                if (no >= meshComponents.Count)
                    AddMeshComponent();
                currentMeshComponent = meshComponents[no];
                currentMeshComponent.SetMaterial(material, additionalColor);
                }
                }

                currentMeshComponent.AddRenderer(renderer, rectangleCount, updateCount);
            }