Started image loading with lodepng
This commit is contained in:
parent
d196e42522
commit
07a781c075
18
OpenGLEngine/ImageLoader.cpp
Normal file
18
OpenGLEngine/ImageLoader.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "ImageLoader.h"
|
||||||
|
|
||||||
|
#include "lodepng.h"
|
||||||
|
|
||||||
|
namespace charcoal
|
||||||
|
{
|
||||||
|
namespace image_loader
|
||||||
|
{
|
||||||
|
ImageRGBA load_file(const std::string& filename)
|
||||||
|
{
|
||||||
|
std::vector<unsigned char> file_data;
|
||||||
|
lodepng::load_file(file_data, filename);
|
||||||
|
ImageRGBA ret;
|
||||||
|
lodepng::decode(ret.data, ret.width, ret.height, file_data);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
OpenGLEngine/ImageLoader.h
Normal file
11
OpenGLEngine/ImageLoader.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ImageLoaderImage.h"
|
||||||
|
|
||||||
|
namespace charcoal
|
||||||
|
{
|
||||||
|
namespace image_loader
|
||||||
|
{
|
||||||
|
ImageRGBA load_file(const std::string& filename);
|
||||||
|
}
|
||||||
|
}
|
16
OpenGLEngine/ImageLoaderImage.h
Normal file
16
OpenGLEngine/ImageLoaderImage.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace charcoal
|
||||||
|
{
|
||||||
|
namespace image_loader
|
||||||
|
{
|
||||||
|
struct ImageRGBA
|
||||||
|
{
|
||||||
|
std::vector<unsigned char> data;
|
||||||
|
unsigned int width;
|
||||||
|
unsigned int height;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -158,10 +158,12 @@
|
|||||||
<ClCompile Include="Camera2D.cpp" />
|
<ClCompile Include="Camera2D.cpp" />
|
||||||
<ClCompile Include="Camera3D.cpp" />
|
<ClCompile Include="Camera3D.cpp" />
|
||||||
<ClCompile Include="FPS.cpp" />
|
<ClCompile Include="FPS.cpp" />
|
||||||
|
<ClCompile Include="ImageLoader.cpp" />
|
||||||
<ClCompile Include="LitBatch.cpp" />
|
<ClCompile Include="LitBatch.cpp" />
|
||||||
<ClCompile Include="LitScene.cpp" />
|
<ClCompile Include="LitScene.cpp" />
|
||||||
<ClCompile Include="LitShadowedBatch.cpp" />
|
<ClCompile Include="LitShadowedBatch.cpp" />
|
||||||
<ClCompile Include="LitShadowedScene.cpp" />
|
<ClCompile Include="LitShadowedScene.cpp" />
|
||||||
|
<ClCompile Include="lodepng.cpp" />
|
||||||
<ClCompile Include="MyBuiltinCubeScene.cpp" />
|
<ClCompile Include="MyBuiltinCubeScene.cpp" />
|
||||||
<ClCompile Include="GLFWInputManager.cpp" />
|
<ClCompile Include="GLFWInputManager.cpp" />
|
||||||
<ClCompile Include="GLUtil.cpp" />
|
<ClCompile Include="GLUtil.cpp" />
|
||||||
@ -208,6 +210,8 @@
|
|||||||
<ClInclude Include="DrawMode.h" />
|
<ClInclude Include="DrawMode.h" />
|
||||||
<ClInclude Include="Exception.h" />
|
<ClInclude Include="Exception.h" />
|
||||||
<ClInclude Include="FPS.h" />
|
<ClInclude Include="FPS.h" />
|
||||||
|
<ClInclude Include="ImageLoader.h" />
|
||||||
|
<ClInclude Include="ImageLoaderImage.h" />
|
||||||
<ClInclude Include="LitBatch.h" />
|
<ClInclude Include="LitBatch.h" />
|
||||||
<ClInclude Include="LitScene.h" />
|
<ClInclude Include="LitScene.h" />
|
||||||
<ClInclude Include="LitShaderProgram.h" />
|
<ClInclude Include="LitShaderProgram.h" />
|
||||||
@ -216,6 +220,7 @@
|
|||||||
<ClInclude Include="LitShadowedShaderProgram.h" />
|
<ClInclude Include="LitShadowedShaderProgram.h" />
|
||||||
<ClInclude Include="LitShadowedTypes.h" />
|
<ClInclude Include="LitShadowedTypes.h" />
|
||||||
<ClInclude Include="LitTypes.h" />
|
<ClInclude Include="LitTypes.h" />
|
||||||
|
<ClInclude Include="lodepng.h" />
|
||||||
<ClInclude Include="MyBuiltinCubeScene.h" />
|
<ClInclude Include="MyBuiltinCubeScene.h" />
|
||||||
<ClInclude Include="MyBuiltinLitScene.h" />
|
<ClInclude Include="MyBuiltinLitScene.h" />
|
||||||
<ClInclude Include="MyBuiltinLitShadowedScene.h" />
|
<ClInclude Include="MyBuiltinLitShadowedScene.h" />
|
||||||
|
@ -103,6 +103,24 @@
|
|||||||
<Filter Include="Source Files\Engine\builtin\Scenes\Shaders">
|
<Filter Include="Source Files\Engine\builtin\Scenes\Shaders">
|
||||||
<UniqueIdentifier>{ca004137-6425-4863-b91a-cf32988855be}</UniqueIdentifier>
|
<UniqueIdentifier>{ca004137-6425-4863-b91a-cf32988855be}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Header Files\Engine\Baseline\ImageLoader">
|
||||||
|
<UniqueIdentifier>{ca80863e-8d81-4a1d-96e2-47fc58c65ed4}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\Engine\Baseline\ImageLoader">
|
||||||
|
<UniqueIdentifier>{7627441b-5417-427d-a082-9413952614b4}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\Engine\Plugins">
|
||||||
|
<UniqueIdentifier>{bb1d7dfe-7df9-4d4a-a110-de57a7f79f3a}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\Engine\Plugins\LodePNG">
|
||||||
|
<UniqueIdentifier>{b7246e93-9a5b-4c40-9539-0edd785cdcde}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\Engine\Plugins">
|
||||||
|
<UniqueIdentifier>{1efd8145-fcba-4c08-8267-7180c458a942}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\Engine\Plugins\LodePNG">
|
||||||
|
<UniqueIdentifier>{b8357bff-b6be-4ee1-b45e-2f1e0fee90e1}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
@ -207,6 +225,12 @@
|
|||||||
<ClCompile Include="GLUtil.cpp">
|
<ClCompile Include="GLUtil.cpp">
|
||||||
<Filter>Source Files\Engine\builtin\General</Filter>
|
<Filter>Source Files\Engine\builtin\General</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="ImageLoader.cpp">
|
||||||
|
<Filter>Source Files\Engine\Baseline\ImageLoader</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="lodepng.cpp">
|
||||||
|
<Filter>Source Files\Engine\Plugins\LodePNG</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Application.h">
|
<ClInclude Include="Application.h">
|
||||||
@ -401,6 +425,15 @@
|
|||||||
<ClInclude Include="TextureGenerator.h">
|
<ClInclude Include="TextureGenerator.h">
|
||||||
<Filter>Header Files\Engine\builtin\General</Filter>
|
<Filter>Header Files\Engine\builtin\General</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="ImageLoader.h">
|
||||||
|
<Filter>Header Files\Engine\Baseline\ImageLoader</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ImageLoaderImage.h">
|
||||||
|
<Filter>Header Files\Engine\Baseline\ImageLoader</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="lodepng.h">
|
||||||
|
<Filter>Header Files\Engine\Plugins\LodePNG</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="MySimpleVS.glsl">
|
<None Include="MySimpleVS.glsl">
|
||||||
|
6870
OpenGLEngine/lodepng.cpp
Normal file
6870
OpenGLEngine/lodepng.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1924
OpenGLEngine/lodepng.h
Normal file
1924
OpenGLEngine/lodepng.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user