Esempio n. 1
0
        public ActorEarth()
        {
            Mesh = new MeshSphere((float)(SgpConstants.EarthRadiusKm / 100), 96, 48);

            _shader = new ShaderProgram(ShaderBank.PlanetFrag, ShaderBank.PlanetVert);

            Texture = TexturePointer.Create("Resources/Textures/earth_low.jpg");

            _textureWater  = TexturePointer.Create("Resources/Textures/water.png");
            _textureNormal = TexturePointer.Create("Resources/Textures/normal_low.jpg");
            _textureLights = TexturePointer.Create("Resources/Textures/lights_low.jpg");
            _textureClouds = TexturePointer.Create("Resources/Textures/clouds_low.jpg");

            _shader.Uniforms.SetValue("texModel", 0);
            _shader.Uniforms.SetValue("texRandom", 1);

            _shader.Uniforms.SetValue("texWater", 3);
            _shader.Uniforms.SetValue("texNormal", 4);
            _shader.Uniforms.SetValue("texLights", 5);
            _shader.Uniforms.SetValue("texClouds", 6);

            BoundingBox = new AxisAlignedBoundingBox(new Vector3(140, 140, 140), Vector3.Zero, true);

//            LocalTransformation = Matrix4.CreateRotationX((float) (-23.44 / 180 * Math.PI));
        }
Esempio n. 2
0
        private void AddLodComponent(int level, int slice, int ring)
        {
            var coef   = F6Math.Pow2(level);
            var slices = 2 * coef;
            var rings  = 1 * coef;

            _textures.Add(new LeveledTexturePointer(level, slice, ring), TexturePointer.Create($"Resources/Textures/tiles/{level}/{slice:D4}_{ring:D4}.png"));
            _meshes.Add(new MeshSphereLocalLod((float)(SgpConstants.EarthRadiusKm / 100), slices, rings, level, slice, ring));
        }
Esempio n. 3
0
        private void FormBoard_Load(object sender, EventArgs e)
        {
            glBoard.MakeCurrent();

            GL.ClearColor(Color4.White);

            _texBoard            = TexturePointer.Create(Resources.concept_board);
            _texExclamationPoint = TexturePointer.Create(Resources.concept_exclamationpoint);
            _texQuestionMark     = TexturePointer.Create(Resources.concept_questionmark);
            _texCube             = TexturePointer.Create(Resources.concept_cube);
            _texBulb             = TexturePointer.Create(Resources.concept_bulb);
        }
Esempio n. 4
0
        private void DrawFullscreenQuad(TexturePointer texScene, TexturePointer texInterface)
        {
            GL.BindVertexArray(ScreenVao);
            GL.Disable(EnableCap.DepthTest);
            GL.Enable(EnableCap.Texture2D);
            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2DMultisample, texScene.Id);
            GL.ActiveTexture(TextureUnit.Texture1);
            GL.BindTexture(TextureTarget.Texture2DMultisample, texInterface.Id);

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.DrawArrays(PrimitiveType.Triangles, 0, 6);
            GL.Disable(EnableCap.Texture2D);
            GL.Enable(EnableCap.DepthTest);
        }
Esempio n. 5
0
        public void Init(Flat6Window window)
        {
            Window = window;

            Lumberjack.Debug("Creating framebuffers");
            FramebufferScene = new Framebuffer(8);
            FramebufferScene.Init(Window.Width, Window.Height);
            FramebufferInterface = new Framebuffer(8);
            FramebufferInterface.Init(Window.Width, Window.Height);

            CreateScreenVao();

            Lumberjack.Debug("Creating shaders");
            ShaderDefault = new ShaderProgram(EmbeddedResources.FsDefault, EmbeddedResources.VsDefault);
            ShaderDefault.Uniforms.SetValue("texModel", 0);
            ShaderDefault.Uniforms.SetValue("texRandom", 1);

            ShaderScreen = new ShaderProgram(EmbeddedResources.FsScreen, EmbeddedResources.VsScreen);
            ShaderScreen.Uniforms.SetValue("width", Window.Width);
            ShaderScreen.Uniforms.SetValue("height", Window.Height);
            ShaderScreen.Uniforms.SetValue("texScene", 0);
            ShaderScreen.Uniforms.SetValue("texInterface", 1);
            ShaderScreen.Uniforms.SetValue("samplesScene", FramebufferScene.Width);
            ShaderScreen.Uniforms.SetValue("samplesInterface", FramebufferInterface.Samples);

            TextureDefault = TexturePointer.Create(EmbeddedResources.ImgNoTexture);
            TextureRandom  = TexturePointer.Create(EmbeddedResources.ImgRandom);

            Lumberjack.Debug("Creating NanoVG context");
            Nvg = GlNanoVg.CreateGl(NvgCreateFlags.StencilStrokes);
            Nvg.CreateFont("engine_mono", EmbeddedResources.IBMPlexMono_Text);

            // Just so ProcGraph is happy for now, TODO
            Nvg.CreateFont("sans", EmbeddedResources.IBMPlexMono_Text);

            UserInterface = new DebugUserInterface();

            Lumberjack.Debug("Creating scene");
            Camera = new Camera();
            Scene  = new Scene();

            Flat6Window.SuppressGlMessage(131218); // "Shader will be recompiled due to..."

            WindowCreated?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 6
0
 public ActorSkybox()
 {
     Mesh = new MeshSphere(512, 24, 12);
     RenderOutsideFrustum = true;
     Texture = TexturePointer.Create("Resources/Textures/milkyway_low.jpg");
 }