mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-27 12:03:25 +00:00
supported .png files
flipped quad coordinates
This commit is contained in:
@@ -36,22 +36,22 @@ namespace vb01{
|
||||
v6.pos=Vector3(size.x,0,0);
|
||||
}
|
||||
v1.norm=Vector3(0,0,-1);
|
||||
v1.texCoords=Vector2(1,1);
|
||||
v1.texCoords=Vector2(1,0);
|
||||
|
||||
v2.norm=Vector3(0,0,-1);
|
||||
v2.texCoords=Vector2(0,1);
|
||||
v2.texCoords=Vector2(0,0);
|
||||
|
||||
v3.norm=Vector3(0,0,-1);
|
||||
v3.texCoords=Vector2(0,0);
|
||||
v3.texCoords=Vector2(0,1);
|
||||
|
||||
v4.norm=Vector3(0,0,-1);
|
||||
v4.texCoords=Vector2(0,0);
|
||||
v4.texCoords=Vector2(0,1);
|
||||
|
||||
v5.norm=Vector3(0,0,-1);
|
||||
v5.texCoords=Vector2(1,0);
|
||||
v5.texCoords=Vector2(1,1);
|
||||
|
||||
v6.norm=Vector3(0,0,-1);
|
||||
v6.texCoords=Vector2(1,1);
|
||||
v6.texCoords=Vector2(1,0);
|
||||
|
||||
indices[0]=0;
|
||||
indices[1]=1;
|
||||
|
||||
@@ -242,7 +242,7 @@ buflen stb_image.h /^ int buflen;$/;" m struct:__anon84e4e8860308 typeref:type
|
||||
camera root.h /^ Camera *camera;$/;" m class:vb01::Root typeref:typename:Camera *
|
||||
castShadow mesh.h /^ bool staticVerts=true,castShadow=false;$/;" m class:vb01::Mesh typeref:typename:bool
|
||||
castShadow model.h /^ bool castShadow=false;$/;" m class:vb01::Model typeref:typename:bool
|
||||
ch text.h /^ int ch;$/;" m struct:vb01::Text::Glyph typeref:typename:int
|
||||
ch text.h /^ u32 ch;$/;" m struct:vb01::Text::Glyph typeref:typename:u32
|
||||
channel stb_image.h /^ stbi_uc size,type,channel;$/;" m struct:__anon84e4e8861108 typeref:typename:stbi_uc
|
||||
channel_order stb_image.h /^ int channel_order;$/;" m struct:__anon84e4e8860508 typeref:typename:int
|
||||
characters text.h /^ std::vector<Glyph> characters;$/;" m class:vb01::Text typeref:typename:std::vector<Glyph>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace vb01{
|
||||
class Text{
|
||||
public:
|
||||
struct Glyph{
|
||||
int ch;
|
||||
u32 ch;
|
||||
Texture *texture=nullptr;
|
||||
unsigned int advance;
|
||||
Vector2 size,bearing;
|
||||
|
||||
+6
-1
@@ -59,6 +59,11 @@ namespace vb01{
|
||||
}
|
||||
|
||||
Texture::Texture(string path){
|
||||
bool png=false;
|
||||
int length=path.length();
|
||||
if(path.substr(length-4,string::npos)==".png")
|
||||
png=true;
|
||||
|
||||
glGenTextures(1,&texture);
|
||||
glBindTexture(GL_TEXTURE_2D,texture);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||
@@ -70,7 +75,7 @@ namespace vb01{
|
||||
|
||||
data=stbi_load(path.c_str(),&width,&height,&numChannels,0);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,width,height,0,GL_RGB,GL_UNSIGNED_BYTE,data);
|
||||
glTexImage2D(GL_TEXTURE_2D,0,png?GL_RGBA:GL_RGB,width,height,0,png?GL_RGBA:GL_RGB,GL_UNSIGNED_BYTE,data);
|
||||
//glGenerateMipmap(GL_TEXTURE_2D);
|
||||
stbi_image_free(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user