本文整理汇总了C#中ContentManager.add方法的典型用法代码示例。如果您正苦于以下问题:C# ContentManager.add方法的具体用法?C# ContentManager.add怎么用?C# ContentManager.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentManager
的用法示例。
在下文中一共展示了ContentManager.add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: load
private void load()
{
models = new ContentManager<VertexBufferObject>("Data/Models/", new LoadContentFunction<VertexBufferObject>(
(string name, string path) =>
new VertexBufferObject(OBJLoader.loadModelfromOBJ(path + name + ".obj"))));
textures = new ContentManager<Texture>("Data/Textures/", new LoadContentFunction<Texture>(
(string name, string path) =>
Texture.fromFile(path + name + ".png")));
Mesh[] meshes = OBJLoader.loadModelfromOBJ("Data/Models/Motorrad.obj");
models.add("motorcycle", new VertexBufferObject(meshes[0]));
models.add("wheel", new VertexBufferObject(meshes[1]));
textures.add("motorcycle", Texture.fromFile("Data/Textures/Motorrad.png"));
Mesh[] tmmeshes = OBJLoader.loadModelfromOBJ("Data/Models/tm.obj");
models.add("tachometer", new VertexBufferObject(tmmeshes[1]));
models.add("tachometer|", new VertexBufferObject(tmmeshes[0]));
textures.add("tachometer", Texture.fromFile("Data/Textures/tm2.png"));
textures.add("tachometer|", Texture.fromFile("Data/Textures/tm.png"));
meshes = OBJLoader.loadModelfromOBJ("Data/Models/tree.obj");
models.add("tree", new VertexBufferObject(meshes[1]));
models.add("leaf", new VertexBufferObject(meshes[0]));
//textures.add("leafs",Texture.fromFile("Data/Textures/leafs.png",5));
grassModel = new VertexBufferObject(OBJLoader.loadModelfromOBJ("Data/Models/grass.obj")[0]);
grassTexture = Texture.fromFile("Data/Textures/grass.png",5);
//Framebuffer
GL.GenFramebuffers(1, out framebuffer);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, framebuffer);
//Depth texture
GL.GenTextures(1, out depthTextureArray);
GL.BindTexture(TextureTarget.Texture2DArray, depthTextureArray);
GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);
//GL.TexParameter(TextureTarget.Texture2DArray, TextureParameterName.TextureCompareMode, (int)TextureCompareMode.CompareRToTexture);
GL.TexImage3D(TextureTarget.Texture2DArray, 0, PixelInternalFormat.DepthComponent16, depthTextureWidth, depthTextureWidth, 3, 0, PixelFormat.DepthComponent, PixelType.Float, new IntPtr(0));
GL.BindTexture(TextureTarget.Texture2DArray, 0);
//--> framebuffer
GL.FramebufferTexture(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, depthTextureArray, 0);
GL.DrawBuffer(DrawBufferMode.None);
GL.ReadBuffer(ReadBufferMode.None);
FramebufferErrorCode ec = GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer);
if (ec != FramebufferErrorCode.FramebufferComplete)
throw new Exception("Framebuffer konnte nicht erstellt werden!");
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
}