fixed windoof flip-problem;
git-svn-id: svn://ammerhai.com/home/mike/pokemon_repo@5 24008968-59e6-ed4c-a10b-0b2c954b24ab
This commit is contained in:
parent
7a8abc6af9
commit
c337d52774
Binary file not shown.
Binary file not shown.
BIN
bin/pokemon.exe
BIN
bin/pokemon.exe
Binary file not shown.
BIN
bin/pokemon.pdb
BIN
bin/pokemon.pdb
Binary file not shown.
@ -85,6 +85,13 @@ struct TGA_Image_Specification {
|
||||
uint8_t image_descriptor;
|
||||
};
|
||||
|
||||
void swap(uint32_t& a, uint32_t& b) {
|
||||
uint32_t h;
|
||||
h = a;
|
||||
a = b;
|
||||
b = h;
|
||||
}
|
||||
|
||||
BMP_Texture load_tga_file(const char* path) {
|
||||
auto file = load_entire_file(path);
|
||||
auto start_file = file;
|
||||
@ -110,7 +117,10 @@ BMP_Texture load_tga_file(const char* path) {
|
||||
|
||||
auto descriptor_mask = 0x30;
|
||||
auto image_origin = image_specification.image_descriptor & descriptor_mask;
|
||||
expect(image_origin, 0, "wrong image origin");
|
||||
if (image_origin != 0 && image_origin != 32) {
|
||||
log_error("wrong image origin");
|
||||
return{ 0, 0 };
|
||||
}
|
||||
//TODO: y-achse flippen, weil microsoft, spaeter beide faelle implementieren
|
||||
|
||||
advance(file, id_length);
|
||||
@ -149,6 +159,12 @@ BMP_Texture load_tga_file(const char* path) {
|
||||
}
|
||||
}
|
||||
|
||||
return { image_specification.width, image_specification.height, start_pixel };
|
||||
}
|
||||
if (image_origin == 32) {
|
||||
for (int y = 0; y < (image_specification.height / 2); y++) {
|
||||
for (int x = 0; x < image_specification.width; x++)
|
||||
swap(start_pixel[y * image_specification.width + x], start_pixel[image_specification.width * (image_specification.height - y - 1) + x]);
|
||||
}
|
||||
}
|
||||
|
||||
return { image_specification.width, image_specification.height, start_pixel };
|
||||
}
|
||||
@ -53,8 +53,8 @@ ID3D11PixelShader* pixel_shader;
|
||||
bool Running = true;
|
||||
//
|
||||
|
||||
#define view_width 16
|
||||
#define view_height 12
|
||||
#define view_width 17
|
||||
#define view_height 13
|
||||
|
||||
struct Vertex {
|
||||
V4 pos;
|
||||
@ -427,7 +427,7 @@ int main() {
|
||||
}
|
||||
|
||||
ID3D11ShaderResourceView* player_texture = 0;
|
||||
if (!(player_texture = create_shader_texture("../assets/strawberry_paintnet.tga"))) {
|
||||
if (!(player_texture = create_shader_texture("../assets/strawberry.tga"))) {
|
||||
log_error("CreateShaderTexture has failed.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user