/// <summary> /// /// </summary> /// <param name="totalBmp"></param> /// <returns></returns> public static SkyboxNode Create(Bitmap totalBmp) { var vs = new VertexShader(vertexCode); var fs = new FragmentShader(fragmentCode); var provider = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add(inPosition, Skybox.strPosition); var builder = new RenderMethodBuilder(provider, map, new CullFaceState(CullFaceMode.Front)); var model = new Skybox(); var node = new SkyboxNode(model, Skybox.strPosition, totalBmp, builder); node.Initialize(); return(node); }
private void FormMain_Load(object sender, EventArgs e) { var position = new vec3(8, 6, 4) * 4; var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspecitive, this.winGLCanvas1.Width, this.winGLCanvas1.Height); this.teapot = TeapotNode.Create(); this.teapot.Scale *= 3; teapot.Children.Add(new LegacyBoundingBoxNode(teapot.ModelSize)); string folder = System.Windows.Forms.Application.StartupPath; var totalBmp = new Bitmap(System.IO.Path.Combine(folder, @"cubemaps_skybox.png")); this.skybox = SkyboxNode.Create(totalBmp); this.skybox.Scale *= 60; var group = new GroupNode(this.teapot, this.skybox); this.scene = new Scene(camera) { RootNode = group, }; var list = new ActionList(); var transformAction = new TransformAction(scene.RootNode); list.Add(transformAction); var renderAction = new RenderAction(scene); list.Add(renderAction); this.actionList = list; var manipulater = new FirstPerspectiveManipulater(); manipulater.Bind(camera, this.winGLCanvas1); this.pickingAction = new Picking(scene); this.triangleTip = new LegacyTriangleNode(); this.quadTip = new LegacyQuadNode(); this.chkRenderWireframe_CheckedChanged(this.chkRenderWireframe, EventArgs.Empty); this.chkRenderBody_CheckedChanged(this.chkRenderBody, EventArgs.Empty); }