Exemplo n.º 1
0
        public Range3d scale(float f)
        {
            Range3d b = new Range3d();

            b.a = this.a * f;
            b.b = this.b * f;
            b.c = this.c * f;
            b.d = this.d * f;
            return(b);
        }
Exemplo n.º 2
0
        public void RenderOn(GameObject go)
        {
            //Create ranges for cubic faces
            float   rad         = 1;
            Range3d topRange    = new Range3d(new Vector3(-rad, rad, rad), new Vector3(rad, rad, rad), new Vector3(rad, rad, -rad), new Vector3(-rad, rad, -rad));
            Range3d bottomRange = new Range3d(new Vector3(-rad, -rad, -rad), new Vector3(rad, -rad, -rad), new Vector3(rad, -rad, rad), new Vector3(-rad, -rad, rad));

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

            Range3d rightRange = new Range3d(new Vector3(rad, rad, -rad), new Vector3(rad, rad, rad), new Vector3(rad, -rad, rad), new Vector3(rad, -rad, -rad));
            Range3d leftRange  = new Range3d(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(config.generationService, config.detailService, config.radius, config.highestQualityAtDistance, config.lodDepth, topRange, config.material);
            this.topFace.go.name = "Top";
            this.topFace.transform.SetParent(go.transform);
            this.topFace.transform.localPosition = Vector3.zero;

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

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

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

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

            this.frontFace         = new PlanetFace(config.generationService, config.detailService, config.radius, config.highestQualityAtDistance, config.lodDepth, frontRange, config.material);
            this.frontFace.go.name = "Front";
            this.frontFace.transform.SetParent(go.transform);
            this.frontFace.transform.localPosition = Vector3.zero;
        }
Exemplo n.º 3
0
 public QuadNode(Range3d area)
 {
     this.range = area;
 }
Exemplo n.º 4
0
        public PlanetFace(IMeshService ms, IDetailer ds, float baseRadius, int minDistance, int treeDepth, Range3d range, Material material)
        {
            //Apply params
            this.maxResolutionAt = minDistance;
            this.maxDepth        = treeDepth;
            this.material        = material;
            this.meshService     = ms;
            this.detailService   = ds;
            this.radius          = baseRadius;

            //Create Gameobjects
            go = new GameObject("PlanetFace");

            //Create quadtree
            root = new QuadNode <ChunkData>(range);
            GenerateChunkdata(root);
        }
Exemplo n.º 5
0
 public QuadNode(Range3d area, T value)
 {
     this.range = area;
     this.value = value;
 }