YourGameLib
Loading...
Searching...
No Matches
loading.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_GLLOADING_H
21#define YOURGAME_GLLOADING_H
22
23#include <string>
24#include <vector>
25#include "yourgame/gl_include.h"
27#include "yourgame/gl/shader.h"
28#include "yourgame/gl/texture.h"
30
31namespace yourgame
32{
33 namespace gl
34 {
36 {
38 GLint minMagFilter = GL_LINEAR;
39 GLint wrapMode = GL_REPEAT;
40 bool generateMipmap = false;
41 bool premultiplyAlpha = true;
42 std::vector<std::pair<GLenum, GLint>> parameteri = {};
43 };
44
45 Texture *loadTexture(const std::string &imgFilename,
46 const std::string &atlasFilename,
48
54 Texture *loadCubemap(const std::vector<std::string> &filenames,
56
57 Shader *loadShader(const std::vector<std::pair<GLenum, std::string>> &shaderFilenames,
58 const std::vector<std::pair<GLuint, std::string>> &attrLocs = {},
59 const std::vector<std::pair<GLuint, std::string>> &fragDataLocs = {});
60
61 Shader *loadShaderFromStrings(const std::vector<std::pair<GLenum, std::string>> &shaderCodes,
62 const std::vector<std::pair<GLuint, std::string>> &attrLocs = {},
63 const std::vector<std::pair<GLuint, std::string>> &fragDataLocs = {});
64
65 Geometry *loadGeometry(const std::string &objFilename,
66 const std::string &mtlFilename = "");
67
68 Geometry *loadGeometryFromStrings(const std::string &objCode,
69 const std::string &mtlCode = "");
70 } // namespace gl
71} // namespace yourgame
72
73#endif
const GLenum textureUnitDiffuse
Definition conventions.cpp:58
Shader * loadShader(const std::vector< std::pair< GLenum, std::string > > &shaderFilenames, const std::vector< std::pair< GLuint, std::string > > &attrLocs={}, const std::vector< std::pair< GLuint, std::string > > &fragDataLocs={})
Definition loading.cpp:276
Shader * loadShaderFromStrings(const std::vector< std::pair< GLenum, std::string > > &shaderCodes, const std::vector< std::pair< GLuint, std::string > > &attrLocs={}, const std::vector< std::pair< GLuint, std::string > > &fragDataLocs={})
Definition loading.cpp:293
Geometry * loadGeometry(const std::string &objFilename, const std::string &mtlFilename="")
Definition loading.cpp:315
Texture * loadTexture(const std::string &imgFilename, const std::string &atlasFilename, const yourgame::gl::TextureConfig &cfg)
Definition loading.cpp:38
Texture * loadCubemap(const std::vector< std::string > &filenames, const yourgame::gl::TextureConfig &cfg)
loads images and generates cubemap texture
Definition loading.cpp:225
Geometry * loadGeometryFromStrings(const std::string &objCode, const std::string &mtlCode="")
Definition loading.cpp:343
Definition audio.h:27
Definition loading.h:36
GLint minMagFilter
Definition loading.h:38
bool premultiplyAlpha
Definition loading.h:41
std::vector< std::pair< GLenum, GLint > > parameteri
Definition loading.h:42
GLint wrapMode
Definition loading.h:39
bool generateMipmap
Definition loading.h:40
GLenum unit
Definition loading.h:37