Ejemplo n.º 1
0
    //  // Called every frame. 'delta' is the elapsed time since the previous frame.
    //  public override void _Process(float delta)
    //  {
    //
    //  }

    // Cube contructor
    public Cube(PlanetChunk owner, int currentX, int currentY, int currentZ,
                Vector3 cubePosition, SpatialMaterial cubeMaterial)
    {
        this.owner        = owner;
        cubeLocation      = cubePosition;
        this.cubeMaterial = cubeMaterial;
        cube = new CSGCombiner(); // TODO: keep as CSGCombiner or change to Spatial?

        this.currentX = currentX;
        this.currentY = currentY;
        this.currentZ = currentZ;
    }
Ejemplo n.º 2
0
    //  // Called every frame. 'delta' is the elapsed time since the previous frame.
    //  public override void _Process(float delta)
    //  {
    //
    //  }


    /*
     * Constructor
     * parent, is the GameObject of the parent object (planet, in this case)
     * owner, is the owner class (Planet, in this case)
     * position is the location of the chunk we are currently working on
     * material, is the material that will cover the chunk - TODO: make it so that there is a material for each cube/quad
     *
     * e.g. chunk 0 will be based at 0,0,0 in the Universe
     */
    public PlanetChunk(Planet owner, Vector3 chunkPosition, SpatialMaterial chunkMaterial, float chunkXIndex, float chunkYIndex, float chunkZIndex)
    {
        planetChunk = new CSGCombiner();
        name        = "Chunk_" + Universe.BuildPlanetChunkName(chunkXIndex, chunkYIndex, chunkZIndex);

        combiner = new CSGCombiner();

        planet = owner; // the planet this chunk is part of (child of) TODO: IS THIS NEEDED??? I do no think so

        this.chunkPosition = chunkPosition;

        this.chunkXIndex = chunkXIndex;
        this.chunkYIndex = chunkYIndex;
        this.chunkZIndex = chunkZIndex;

        this.chunkMaterial = chunkMaterial;

        chunkData   = new Cube[planet.chunkSize, planet.chunkSize, planet.chunkSize];
        CubeIsSolid = new bool[owner.chunkSize, owner.chunkSize, owner.chunkSize];
    }