Exemplo n.º 1
0
        public void RenderOn(GameObject go)
        {
            //Create ranges for cubic faces
            float rad         = 1;
            Zone3 topRange    = new Zone3(new Vector3(-rad, rad, rad), new Vector3(rad, rad, rad), new Vector3(rad, rad, -rad), new Vector3(-rad, rad, -rad));
            Zone3 bottomRange = new Zone3(new Vector3(-rad, -rad, -rad), new Vector3(rad, -rad, -rad), new Vector3(rad, -rad, rad), new Vector3(-rad, -rad, rad));

            Zone3 frontRange = new Zone3(new Vector3(rad, rad, rad), new Vector3(-rad, rad, rad), new Vector3(-rad, -rad, rad), new Vector3(rad, -rad, rad));
            Zone3 backRange  = new Zone3(new Vector3(-rad, rad, -rad), new Vector3(rad, rad, -rad), new Vector3(rad, -rad, -rad), new Vector3(-rad, -rad, -rad));

            Zone3 rightRange = new Zone3(new Vector3(rad, rad, -rad), new Vector3(rad, rad, rad), new Vector3(rad, -rad, rad), new Vector3(rad, -rad, -rad));
            Zone3 leftRange  = new Zone3(new Vector3(-rad, rad, rad), new Vector3(-rad, rad, -rad), new Vector3(-rad, -rad, -rad), new Vector3(-rad, -rad, rad));

            if (config.generationService)
            {
                config.generationService.Init();
            }

            UpdateMaterial(go, true);

            this.topFace         = new PlanetFace(PlanetFaceDirection.Top, config.generationService, config.detailService, config.radius, config.highestQualityAtDistance, config.lodDepth, topRange, config.textureService);
            this.topFace.go.name = "Top";
            this.topFace.transform.SetParent(go.transform);
            this.topFace.transform.localPosition = Vector3.zero;

            this.bottomFace         = new PlanetFace(PlanetFaceDirection.Bottom, config.generationService, config.detailService, config.radius, config.highestQualityAtDistance, config.lodDepth, bottomRange, config.textureService);
            this.bottomFace.go.name = "Bottom";
            this.bottomFace.transform.SetParent(go.transform);
            this.bottomFace.transform.localPosition = Vector3.zero;

            this.leftFace         = new PlanetFace(PlanetFaceDirection.Left, config.generationService, config.detailService, config.radius, config.highestQualityAtDistance, config.lodDepth, leftRange, config.textureService);
            this.leftFace.go.name = "Left";
            this.leftFace.transform.SetParent(go.transform);
            this.leftFace.transform.localPosition = Vector3.zero;

            this.rightFace         = new PlanetFace(PlanetFaceDirection.Right, config.generationService, config.detailService, config.radius, config.highestQualityAtDistance, config.lodDepth, rightRange, config.textureService);
            this.rightFace.go.name = "Right";
            this.rightFace.transform.SetParent(go.transform);
            this.rightFace.transform.localPosition = Vector3.zero;

            this.backFace         = new PlanetFace(PlanetFaceDirection.Back, config.generationService, config.detailService, config.radius, config.highestQualityAtDistance, config.lodDepth, backRange, config.textureService);
            this.backFace.go.name = "Back";
            this.backFace.transform.SetParent(go.transform);
            this.backFace.transform.localPosition = Vector3.zero;

            this.frontFace         = new PlanetFace(PlanetFaceDirection.Front, config.generationService, config.detailService, config.radius, config.highestQualityAtDistance, config.lodDepth, frontRange, config.textureService);
            this.frontFace.go.name = "Front";
            this.frontFace.transform.SetParent(go.transform);
            this.frontFace.transform.localPosition = Vector3.zero;
        }
Exemplo n.º 2
0
        public override Material GetMaterialFor(PlanetFace face, QuadNode <ChunkData> node, Mesh mesh)
        {
            switch (face.direction)
            {
            case PlanetFaceDirection.Top:
                return(top);

            case PlanetFaceDirection.Bottom:
                return(bottom);

            case PlanetFaceDirection.Left:
                return(left);

            case PlanetFaceDirection.Right:
                return(right);

            case PlanetFaceDirection.Front:
                return(front);

            default:
                return(back);
            }
        }
Exemplo n.º 3
0
 public abstract Material GetMaterialFor(PlanetFace face, QuadNode <ChunkData> node, Mesh mesh);
Exemplo n.º 4
0
 public override Material GetMaterialFor(PlanetFace face, QuadNode <ChunkData> node, Mesh mesh)
 {
     return(material);
 }