public static Geometry <EntityVertex> Hammer() { var cube1 = Extrusion.Cube <EntityVertex> (1f, 1.5f, 2f).RotateY(MathHelper.PiOver2); var cube2 = Extrusion.Cube <EntityVertex> (1f, 1f, 1f).Scale(0.8f, 0.8f, 0.8f); var cube3 = Extrusion.Cube <EntityVertex> (1f, 1f, 2f); return(Composite.Create(Stacking.StackRight(cube1, cube2, cube3) .Align(Alignment.None, Alignment.Center, Alignment.Center)).Center()); }
public static Reaction <Camera> Renderer(SceneGraph sceneGraph, Vec3 skyColor) { _skyboxShader = new GLProgram(VertexShader(), FragmentShader()); _skybox = new Skybox(_skyboxShader); _skyColor = skyColor; var cube = Extrusion.Cube <PositionalVertex> (_cubeSize, _cubeSize, _cubeSize).Center(); _vertices = new VBO <PositionalVertex> (cube.Vertices, BufferTarget.ArrayBuffer); _indices = new VBO <int> (cube.Indices, BufferTarget.ElementArrayBuffer); var environmentMap = Texture.CubeMapFromFiles( _paths.Map(s => string.Format(@"Textures/{0}.bmp", s)), 0) .LinearFiltering().ClampToEdges(Axes.All); sceneGraph.GlobalLighting.DiffuseMap = environmentMap; return(React.By <Camera> (_skybox.Render) .BindSamplers(new Dictionary <Sampler, Texture> () { { !_skybox.cubeMap, environmentMap } }) .Culling(CullFaceMode.Front) .Program(_skyboxShader)); }