func (this *WorldRenderer) Resize(width, height int) { this.Proj = mgl.Perspective(90, float32(width)/float32(height), 0.3, 1000) gl.Viewport(0, 0, width, height) for _, fb := range this.Framebuffer { fb.Resize(width, height) } }
func NewWorldRenderer(window *sdl.Window, w *gamestate.World) *WorldRenderer { width, height := window.GetSize() return &WorldRenderer{ Proj: mgl.Perspective(90, float32(width)/float32(height), 0.3, 1000), View: mgl.Ident4(), ClippingPlane_ws: mgl.Vec4{1, 0, 0, -1000000}, Textures: NewTextures(w.HeightMap), HeightMapRenderer: NewHeightMapRenderer(), WaterRendererA: NewSurfaceWaterRenderer(), WaterRendererB: NewDebugWaterRenderer(), MeshRenderer: NewMeshRenderer(), PortalRenderer: NewPortalRenderer(), TreeRenderer: NewTreeRenderer(), SkyboxRenderer: NewSkyboxRenderer(), Skybox: &Skybox{}, ParticleSystem: particles.NewParticleSystem(w, 10000, mgl.Vec3{32, 32, 32}, 1, 250), Framebuffer: [2]*FrameBuffer{NewFrameBuffer(window.GetSize()), NewFrameBuffer(window.GetSize())}, ScreenQuad: &ScreenQuad{}, ScreenQuadRenderer: NewScreenQuadRenderer(), DebugRenderer: NewLineRenderer(), MaxRecursion: 1, } }