/// <summary> /// /// </summary> /// <returns></returns> public static TransparentPlaneNode Create() { var model = new TransparentPlaneModel(); var vs = new VertexShader(vertexCode); var fs = new FragmentShader(fragmentCode); var array = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add("inPosition", TransparentPlaneModel.strPosition); map.Add("inColor", TransparentPlaneModel.strColor); var builder = new RenderMethodBuilder(array, map); var node = new TransparentPlaneNode(model, TransparentPlaneModel.strPosition, builder); node.Initialize(); node.ModelSize = model.ModelSize; return(node); }
private SceneNodeBase GetRootElement() { string folder = System.Windows.Forms.Application.StartupPath; var bmp = new Bitmap(System.IO.Path.Combine(folder, @"Crate.bmp")); TexStorageBase storage = new TexImageBitmap(bmp); var texture = new Texture(storage); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapS, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapT, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapR, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMinFilter, (int)GL.GL_LINEAR)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMagFilter, (int)GL.GL_LINEAR)); texture.Initialize(); texture.TextureUnitIndex = 0; bmp.Dispose(); this.clippedCube = ClippedCubeNode.Create(texture); this.transparentPlane = TransparentPlaneNode.Create(); transparentPlane.Scale = new vec3(1, 1, 1); var group = new GroupNode(clippedCube, transparentPlane); return group; }