Ejemplo n.º 1
0
        public VoxelMeshGenerator(VoxelManager parent, VoxelDataGenerator vdata) : base(parent)
        {
            resolution = vdata.resolution + Vector3.One; //add 3 (10 Faces mean 11 Vertecies)

            //prepareData();

            surfaceMesh = new Mesh();

            //generateMesh();
        }
Ejemplo n.º 2
0
        public VoxelMeshGenerator(VoxelManager parent, VoxelDataGenerator vdata)
            : base(parent)
        {
            resolution = vdata.resolution + Vector3.One; //add 3 (10 Faces mean 11 Vertecies)

            //prepareData();

            surfaceMesh = new Mesh();

            //generateMesh();
        }
Ejemplo n.º 3
0
        public VoxelDataGenerator(VoxelManager parent, Vector3 start, Vector3 end)
            : base(parent)
        {
            this.start = start;
            this.end   = end;

            scaling = (end - start);

            resolution = Vector3.One * 10f + Vector3.One * 2f;

            voxelAmnt = (int)resolution.X * (int)resolution.Y * (int)resolution.Z;

            voxelSize = Vector3.Divide(scaling, resolution - Vector3.One * 2f);
        }
Ejemplo n.º 4
0
        public VoxelDataGenerator(VoxelManager parent, Vector3 start , Vector3 end)
            : base(parent)
        {
            this.start = start;
            this.end = end;

            scaling = (end - start);

            resolution = Vector3.One * 10f + Vector3.One * 2f;

            voxelAmnt = (int)resolution.X * (int)resolution.Y * (int)resolution.Z;

            voxelSize = Vector3.Divide(scaling, resolution - Vector3.One * 2f);
        }
Ejemplo n.º 5
0
        public VoxelChunk(VoxelManager parent, Vector3 start, Vector3 end)
            : base(parent)
        {
            this.start = start;
            this.end   = end;

            voxelData  = new VoxelDataGenerator(this, start, end);
            meshHelper = new VoxelMeshGenerator(this, voxelData);

            Position = (end + start) / 2f;

            generateSurface();

            wasUpdated = false;
            //generateDebugSurface();
            //generateSurfaceMesh();
            //scene.generateParticleSys();

            surface.isVisible = false;
        }
Ejemplo n.º 6
0
        public VoxelChunk(VoxelManager parent, Vector3 start ,Vector3 end)
            : base(parent)
        {
            this.start = start;
            this.end = end;

            voxelData = new VoxelDataGenerator(this, start, end);
            meshHelper = new VoxelMeshGenerator(this, voxelData);

            Position = (end + start) / 2f;

            generateSurface();

            wasUpdated = false;
            //generateDebugSurface();
            //generateSurfaceMesh();
            //scene.generateParticleSys();

            surface.isVisible = false;
        }
Ejemplo n.º 7
0
 public VoxelVolumeSphere(VoxelManager parent, float radius)
     : base(parent)
 {
     this.AffectionRadius = radius;
 }
Ejemplo n.º 8
0
 public VoxelVolume(VoxelManager parent)
 {
     Parent = parent;
 }
Ejemplo n.º 9
0
 public VoxelVolumeSphere(VoxelManager parent, float radius) : base(parent)
 {
     this.AffectionRadius = radius;
 }
Ejemplo n.º 10
0
 public VoxelVolume(VoxelManager parent)
 {
     Parent = parent;
 }
Ejemplo n.º 11
0
        public void init()
        {
            sunLight = new LightSun(new Vector3(0.1f, 0.125f, 0.2f) * 3f, this);
            sunLight.lightAmbient = new Vector3(0.1f, 0.125f, 0.2f) * 0.5f;//new Vector3(0.2f, 0.125f, 0.1f);//new Vector3(0.1f, 0.14f, 0.3f);
            sunLight.PointingDirection = Vector3.Normalize(new Vector3(674, -674, 1024));
            sunFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false);
            sunInnerFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false);

            mFilter2d = new Quad2d(this);

            mSkyModel = new Skybox(this, gameWindow);

            mGroundPlane = new GroundPlane(this);
            mGroundPlane.setMaterial("floor.xmf");

            mGroundPlane.setMesh("water_plane.obj");
            mGroundPlane.setMaterial("floor.xmf");

            //need to be fixed -- cant be executed after voxel Manager creation.

            if(Settings.Instance.video.Particles)
                generateParticleSys();

            voxelManager = new VoxelManager(this);

            compositeMod.X = Settings.Instance.video.gamma;

            particleAffectors.Add(new ParticleAffectorWind(new Vector3(1,-0.5f,0) * 0.01f));
            particleAffectors.Add(new ParticleAffectorFriction(0.1f));
            particleAffectors.Add(new ParticleAffectorFloorKiller(waterLevel));
            particleAffectors.Add(new ParticleAffectorLifeTimeKiller(this));

            /*
                waterModel.setTextures(mTextureLoader.fromMixed(new int[]{
                TextureGroup.TYPE_FRAMEBUFFER,
                TextureGroup.TYPE_FROMFILE},
                new string[] {
                    Convert.ToString(waterFramebuffer.ColorTexture),
                    "noise.png"}));
             */

            mGroundPlane.Position = new Vector3(0,waterLevel,0);
            //mGroundPlane.updateModelMatrix();

            Matrix4 translate = Matrix4.CreateTranslation(0, -waterLevel * 2, 0);
            Matrix4 invert = Matrix4.Scale(1, -1, 1);
            Matrix4.Mult(ref translate, ref invert, out mWaterMatrix);
        }
Ejemplo n.º 12
0
 public VoxelManager(VoxelManager parent)
     : base(parent)
 {
     Parent = parent;
 }
Ejemplo n.º 13
0
        public void init()
        {
            mFilter2d = new Quad2d(this);

            mSkyModel = new Skybox(this, gameWindow);

            mGroundPlane = new GroundPlane(this);
            mGroundPlane.setMaterial("floor.xmf");

            mGroundPlane.setMesh("water_plane.obj");
            mGroundPlane.setMaterial("floor.xmf");

            //need to be fixed -- cant be executed after voxel Manager creation.
            generateParticleSys();

            voxelManager = new VoxelManager(this);

            particleAffectors.Add(new ParticleAffectorWind(new Vector3(1,-0.5f,0) * 0.01f));
            particleAffectors.Add(new ParticleAffectorFriction(0.1f));
            particleAffectors.Add(new ParticleAffectorFloorKiller(waterLevel));
            particleAffectors.Add(new ParticleAffectorLifeTimeKiller(this));

            /*
                waterModel.setTextures(mTextureLoader.fromMixed(new int[]{
                TextureGroup.TYPE_FRAMEBUFFER,
                TextureGroup.TYPE_FROMFILE},
                new string[] {
                    Convert.ToString(waterFramebuffer.ColorTexture),
                    "noise.png"}));
             */

            mGroundPlane.Position = new Vector3(0,waterLevel,0);
            //mGroundPlane.updateModelMatrix();

            Matrix4 translate = Matrix4.CreateTranslation(0, -waterLevel * 2, 0);
            Matrix4 invert = Matrix4.Scale(1, -1, 1);
            Matrix4.Mult(ref translate, ref invert, out mWaterMatrix);
        }
Ejemplo n.º 14
0
 public VoxelManager(VoxelManager parent)
     : base(parent)
 {
     Parent = parent;
 }