Noise() public static méthode

public static Noise ( float xin, float yin ) : float
xin float
yin float
Résultat float
Exemple #1
0
        protected override void Initialize()
        {
            AdvancingFrontVIS2006.AdvancingFrontVIS2006.GetIdealEdgeLength(0, (Resolution / 2 - 2), 0);

            //DualMarchingSquaresNeilson.MarchingSquaresTableGenerator.PrintCaseTable();

            ModelIndex = -1;
            if (ModelIndex > -1)
            {
                Sampler.ReadData(Models[ModelIndex], Resolution);
            }

            float n = SimplexNoise.Noise(0, 0);

            RState          = new RasterizerState();
            RState.CullMode = (Sampler.ImageData != null ? CullMode.CullCounterClockwiseFace : CullMode.CullClockwiseFace);
            GraphicsDevice.RasterizerState     = RState;
            graphics.PreferredBackBufferWidth  = 1600;
            graphics.PreferredBackBufferHeight = 900;
            graphics.PreferMultiSampling       = true;
            graphics.ApplyChanges();

            IsMouseVisible = true;

            //effect = new BasicEffect(GraphicsDevice);
            reg_effect = Content.Load <Effect>("ShaderRegular");
            reg_effect.Parameters["ColorEnabled"].SetValue(true);
            dn_effect = Content.Load <Effect>("ShaderDN");
            dn_effect.Parameters["ColorEnabled"].SetValue(true);
            wire_effect = Content.Load <Effect>("WireShader");


            QualityIndex = 0;
            NextAlgorithm();

            //effect.VertexColorEnabled = true;

            Camera            = new Camera(GraphicsDevice, new Vector3(-Resolution, Resolution, -Resolution), 1f);
            Camera.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), (float)graphics.PreferredBackBufferWidth / (float)graphics.PreferredBackBufferHeight, 0.1f, 1000.0f);
            if (SelectedAlgorithm.Is3D)
            {
                Camera.Update(true);
                //effect.View = Camera.View;
                reg_effect.Parameters["View"].SetValue(Camera.View);
                reg_effect.Parameters["Projection"].SetValue(Camera.Projection);
                dn_effect.Parameters["View"].SetValue(Camera.View);
                dn_effect.Parameters["Projection"].SetValue(Camera.Projection);
            }
            last_state = Keyboard.GetState();

            DrawMode      = Isosurface.DrawModes.Mesh;
            WireframeMode = WireframeModes.Fill;

            base.Initialize();
        }
Exemple #2
0
        protected override void Initialize()
        {
            //DualMarchingSquaresNeilson.MarchingSquaresTableGenerator.PrintCaseTable();

            ModelIndex = -1;
            if (ModelIndex > -1)
            {
                Sampler.ReadData(Models[ModelIndex], Resolution);
            }

            float n = SimplexNoise.Noise(0, 0);

            RState          = new RasterizerState();
            RState.CullMode = (Sampler.ImageData != null ? CullMode.CullCounterClockwiseFace : CullMode.CullClockwiseFace);
            GraphicsDevice.RasterizerState     = RState;
            graphics.PreferredBackBufferWidth  = 1600;
            graphics.PreferredBackBufferHeight = 900;
            graphics.PreferMultiSampling       = true;
            graphics.ApplyChanges();

            IsMouseVisible = true;

            effect = new BasicEffect(GraphicsDevice);

            QualityIndex = 0;
            NextAlgorithm();

            effect.VertexColorEnabled = true;

            Camera = new Camera(GraphicsDevice, new Vector3(-Resolution, Resolution, -Resolution), 1f);
            if (SelectedAlgorithm.Is3D)
            {
                Camera.Update(true);
                effect.View = Camera.View;
            }
            last_state = Keyboard.GetState();

            DrawMode      = Isosurface.DrawModes.Mesh;
            WireframeMode = WireframeModes.Fill;

            base.Initialize();
        }
        public static float Noise(Vector3 pos, int octaves)
        {
            float r = 0.01f;

            return(SimplexNoise.Noise(pos.X * r, pos.Y * r, pos.Z * r, octaves));
        }
        public static float Noise(Vector3 pos)
        {
            float r = 0.05f;

            return(SimplexNoise.Noise(pos.X * r, pos.Y * r, pos.Z * r));
        }