Started reworking the asset builder

This commit is contained in:
grayson committed 2021-12-10 12:10:07 -06:00
1 parent ea1013c573
commit cc0316ff80
20 files changed
+735 -221

No files matched your search

+7 -2
View File
@@ -81,7 +81,7 @@
<PostBuildEvent />
<PostBuildEvent>
<Command>cd assets
"$(SolutionDir)NFPackCreator\bin\x64$(Configuration)\NFPackCreator.exe"</Command>
"$(SolutionDir)NFAssetBuilder\bin\x64$(Configuration)\NFAssetBuilder.exe"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -116,7 +116,7 @@
<PostBuildEvent />
<PostBuildEvent>
<Command>cd assets
"$(SolutionDir)NFPackCreator\bin\x64$(Configuration)\NFPackCreator.exe"</Command>
"$(SolutionDir)NFAssetBuilder\bin\x64$(Configuration)\NFAssetBuilder.exe"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
@@ -184,6 +184,11 @@
<None Include="res\defaultShader\fragment.shader" />
<None Include="res\defaultShader\vertex.shader" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NFAssetBuilder\NFAssetBuilder.vcxproj">
<Project>{771b4aee-e2c6-4745-ac40-1ef57149612e}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -361,11 +361,11 @@ namespace nf {
for (unsigned int i = 0; i < m_materials.size(); i++) {
Texture* curr;
if ((curr = std::get<0>(m_materials[i])) != nullptr)
Application::getApp()->getCurrentState()->m_texturesToDelete.insert(std::get<0>(m_materials[i]));
Application::getApp()->getCurrentState()->m_texturesToDelete.insert(curr);
if ((curr = std::get<1>(m_materials[i])) != nullptr)
Application::getApp()->getCurrentState()->m_texturesToDelete.insert(std::get<1>(m_materials[i]));
Application::getApp()->getCurrentState()->m_texturesToDelete.insert(curr);
if ((curr = std::get<2>(m_materials[i])) != nullptr)
Application::getApp()->getCurrentState()->m_texturesToDelete.insert(std::get<2>(m_materials[i]));
Application::getApp()->getCurrentState()->m_texturesToDelete.insert(curr);
}
}
}
+2 -8
View File
@@ -1,8 +1,6 @@
#include "nf/Texture.h"
#include "GL/glew.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include "nf/Assets.h"
#include "nf/Utility.h"
@@ -14,18 +12,14 @@ namespace nf {
m_x(0),
m_y(0)
{
//Load dimensions and channels from cooked data
int nChannels;
stbi_set_flip_vertically_on_load(true);
unsigned char* texture = stbi_load_from_memory((unsigned char*)tex->data, (unsigned int)tex->size, &m_x, &m_y, &nChannels, 0);
if (!texture)
NFError("Texture failed to load from memory!");
glGenTextures(1, &m_id);
glBindTexture(GL_TEXTURE_2D, m_id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, linear ? GL_RGBA : GL_SRGB_ALPHA, m_x, m_y, 0, nChannels == 3 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE, texture);
glTexImage2D(GL_TEXTURE_2D, 0, linear ? GL_RGBA : GL_SRGB_ALPHA, m_x, m_y, 0, nChannels == 3 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE, tex->data);
glGenerateMipmap(GL_TEXTURE_2D);
stbi_image_free(texture);
m_isBase = tex->isBaseAsset;
tex->alreadyLoaded = true;
tex->loadedTexture = this;