Browse Source

update test meshes to use palette texture

master
cinnaboot 8 years ago
parent
commit
a059dffb68
  1. 757
      data/animated.block.dae
  2. 39
      data/block2.dae
  3. 166
      data/catepillar.dae
  4. 2
      data/default.fs
  5. 9
      data/test.level.dae
  6. 2
      data/test_scene.json
  7. BIN
      data/test_texture.png
  8. 2
      src/mesh.cpp
  9. 3
      src/render_group.cpp
  10. 1
      src/util.cpp

757
data/animated.block.dae

File diff suppressed because one or more lines are too long

39
data/block2.dae

File diff suppressed because one or more lines are too long

166
data/catepillar.dae

File diff suppressed because one or more lines are too long

2
data/default.fs

@ -38,6 +38,6 @@ void main()
vec4 sampled_color = texture(sampler, fragUV.st); vec4 sampled_color = texture(sampler, fragUV.st);
color = clamp(totalBrightness, 0, 1) * sampled_color; color = clamp(totalBrightness, 0, 1) * sampled_color;
//color = clamp(totalBrightness, 0, 1) * fragColor; //color = vec4(clamp(totalBrightness, 0, 1) * fragColor, 0);
} }

9
data/test.level.dae

File diff suppressed because one or more lines are too long

2
data/test_scene.json

@ -74,7 +74,7 @@
}, },
{ {
"name" : "box", "name" : "box",
"model_file" : "animated.block.dae", "model_file" : "block2.dae",
"position" : { "position" : {
"x" : 140, "x" : 140,
"y" : -100, "y" : -100,

BIN
data/test_texture.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

2
src/mesh.cpp

@ -155,7 +155,7 @@ copyMeshInfo(const char* data_dir, const aiScene* scene, aiMesh* mesh)
mi->diffuse_color.b = color.b; mi->diffuse_color.b = color.b;
} }
if (mat->GetTextureCount(aiTextureType_DIFFUSE) > 0) { if (has_tex && mat->GetTextureCount(aiTextureType_DIFFUSE) > 0) {
aiString file_name; aiString file_name;
if (AI_SUCCESS != mat->GetTexture(aiTextureType_DIFFUSE, 0, &file_name, NULL, NULL, NULL, NULL, NULL)) { if (AI_SUCCESS != mat->GetTexture(aiTextureType_DIFFUSE, 0, &file_name, NULL, NULL, NULL, NULL, NULL)) {
LOG(ERROR) << "Some Assimp-type-error\n"; LOG(ERROR) << "Some Assimp-type-error\n";

3
src/render_group.cpp

@ -13,7 +13,7 @@
#include "mesh.h" #include "mesh.h"
#include "util.h" #include "util.h"
#define INFO_LOG_MAX_LENGTH 312; #define INFO_LOG_MAX_LENGTH 312
// forward declarations // forward declarations
@ -222,6 +222,7 @@ rgDraw(render_group* rg, glm::mat4 model_matrix,
} }
} }
// 4th attribute buffer: UV coordinates
if (ro->use_texture) { if (ro->use_texture) {
glEnableVertexAttribArray(3); glEnableVertexAttribArray(3);
glBindBuffer(GL_ARRAY_BUFFER, ro->uv_buffer.buffer_id); glBindBuffer(GL_ARRAY_BUFFER, ro->uv_buffer.buffer_id);

1
src/util.cpp

@ -71,6 +71,7 @@ utilLoadImage(const char* filename)
util_image image; util_image image;
std::memcpy(image.file_path, filename, std::strlen(filename) + 1); std::memcpy(image.file_path, filename, std::strlen(filename) + 1);
stbi_set_flip_vertically_on_load(1);
image.pixels = stbi_load(filename, &image.w, &image.h, &image.num_channels, 0); image.pixels = stbi_load(filename, &image.w, &image.h, &image.num_channels, 0);
image.data_len = image.w * image.h * image.num_channels; // NOTE: assumes 8 bits per channel image.data_len = image.w * image.h * image.num_channels; // NOTE: assumes 8 bits per channel

Loading…
Cancel
Save