This repository has been archived on 2022-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
shapes-juke/src/sj/LobbyWorld.d

57 lines
981 B
D

/// License: MIT
module sj.LobbyWorld;
import std.algorithm;
import gl4d;
import sjplayer.Background;
import sj.CubeProgram,
sj.ProgramSet;
///
class LobbyWorld {
public:
///
enum Projection = mat4.perspective(1, 1, 60, 0.1, 100);
///
this(ProgramSet programs) {
background_ = new Background(programs.Get!BackgroundProgram);
cube_program_ = programs.Get!CubeProgram;
}
///
void Draw() {
gl.Disable(GL_DEPTH_TEST);
gl.DepthMask(false);
background_.Draw();
gl.Enable(GL_DEPTH_TEST);
gl.DepthMask(true);
cube_program_.Draw(
cubes.map!"a.Create()",
Projection, view.Create(), light_pos, cube_material);
}
///
@property Background background() {
return background_;
}
///
ModelMatrixFactory!4[] cubes;
///
ViewMatrixFactory view;
///
vec3 light_pos = vec3(0, 10, 0);
///
CubeProgram.Material cube_material;
private:
Background background_;
CubeProgram cube_program_;
}