updated material texture serialization; added sponza test scene; editor updates;

This commit is contained in:
turanszkij
2018-12-20 14:31:48 +01:00
parent c3796d621c
commit 848afcbdc0
82 changed files with 61 additions and 19 deletions
+13 -9
View File
@@ -174,7 +174,7 @@ MaterialWindow::MaterialWindow(wiGUI* gui) : GUI(gui)
pomSlider->OnSlide([&](wiEventArgs args) {
MaterialComponent* material = wiRenderer::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->parallaxOcclusionMapping = args.fValue;
material->SetParallaxOcclusionMapping(args.fValue);
});
materialWindow->AddWidget(pomSlider);
@@ -356,8 +356,9 @@ MaterialWindow::MaterialWindow(wiGUI* gui) : GUI(gui)
if (GetSaveFileNameA(&ofn) == TRUE) {
string fileName = ofn.lpstrFile;
material->baseColorMap = (Texture2D*)wiResourceManager::GetGlobal().add(fileName);
material->baseColorMapName = wiHelper::GetFileNameFromPath(fileName);
texture_baseColor_Button->SetText(material->baseColorMapName);
material->baseColorMapName = fileName;
fileName = wiHelper::GetFileNameFromPath(fileName);
texture_baseColor_Button->SetText(fileName);
}
}
});
@@ -408,8 +409,9 @@ MaterialWindow::MaterialWindow(wiGUI* gui) : GUI(gui)
if (GetSaveFileNameA(&ofn) == TRUE) {
string fileName = ofn.lpstrFile;
material->normalMap = (Texture2D*)wiResourceManager::GetGlobal().add(fileName);
material->normalMapName = wiHelper::GetFileNameFromPath(fileName);
texture_normal_Button->SetText(material->normalMapName);
material->normalMapName = fileName;
fileName = wiHelper::GetFileNameFromPath(fileName);
texture_normal_Button->SetText(fileName);
}
}
});
@@ -460,8 +462,9 @@ MaterialWindow::MaterialWindow(wiGUI* gui) : GUI(gui)
if (GetSaveFileNameA(&ofn) == TRUE) {
string fileName = ofn.lpstrFile;
material->surfaceMap = (Texture2D*)wiResourceManager::GetGlobal().add(fileName);
material->surfaceMapName = wiHelper::GetFileNameFromPath(fileName);
texture_surface_Button->SetText(material->surfaceMapName);
material->surfaceMapName = fileName;
fileName = wiHelper::GetFileNameFromPath(fileName);
texture_surface_Button->SetText(fileName);
}
}
});
@@ -512,8 +515,9 @@ MaterialWindow::MaterialWindow(wiGUI* gui) : GUI(gui)
if (GetSaveFileNameA(&ofn) == TRUE) {
string fileName = ofn.lpstrFile;
material->displacementMap = (Texture2D*)wiResourceManager::GetGlobal().add(fileName);
material->displacementMapName = wiHelper::GetFileNameFromPath(fileName);
texture_displacement_Button->SetText(material->displacementMapName);
material->displacementMapName = fileName;
fileName = wiHelper::GetFileNameFromPath(fileName);
texture_displacement_Button->SetText(fileName);
}
}
});
+13 -4
View File
@@ -77,11 +77,20 @@ WeatherWindow::WeatherWindow(wiGUI* gui) : GUI(gui)
windSpeedSlider = new wiSlider(0.001f, 0.2f, 0.1f, 10000, "Wind Speed: ");
windSpeedSlider->SetSize(XMFLOAT2(100, 30));
windSpeedSlider->SetPos(XMFLOAT2(x, y += step));
windSpeedSlider->OnSlide([&](wiEventArgs args) {
GetWeather().windDirection = XMFLOAT3(args.fValue, 0, 0);
});
weatherWindow->AddWidget(windSpeedSlider);
windDirectionSlider = new wiSlider(0, 1, 0, 10000, "Wind Direction: ");
windDirectionSlider->SetSize(XMFLOAT2(100, 30));
windDirectionSlider->SetPos(XMFLOAT2(x, y += step));
windDirectionSlider->OnSlide([&](wiEventArgs args) {
XMMATRIX rot = XMMatrixRotationY(args.fValue * XM_PI * 2);
XMVECTOR dir = XMVectorSet(1, 0, 0, 0);
dir = XMVector3TransformNormal(dir, rot);
dir *= windSpeedSlider->GetValue();
XMStoreFloat3(&GetWeather().windDirection, dir);
});
weatherWindow->AddWidget(windDirectionSlider);
skyButton = new wiButton("Load Sky");
skyButton->SetTooltip("Load a skybox cubemap texture...");
@@ -290,7 +299,7 @@ void WeatherWindow::UpdateFromRenderer()
cloudinessSlider->SetValue(weather.cloudiness);
cloudScaleSlider->SetValue(weather.cloudScale);
cloudSpeedSlider->SetValue(weather.cloudSpeed);
windSpeedSlider->SetValue(weather.windDirection.x);
windSpeedSlider->SetValue(wiMath::Length(weather.windDirection));
}
WeatherComponent& WeatherWindow::GetWeather() const
+1
View File
@@ -29,6 +29,7 @@ public:
wiSlider* cloudScaleSlider;
wiSlider* cloudSpeedSlider;
wiSlider* windSpeedSlider;
wiSlider* windDirectionSlider;
wiButton* skyButton;
wiColorPicker* ambientColorPicker;
wiColorPicker* horizonColorPicker;
+33 -5
View File
@@ -76,6 +76,8 @@ namespace wiSceneSystem
}
void MaterialComponent::Serialize(wiArchive& archive, uint32_t seed)
{
std::string dir = archive.GetSourceDirectory();
if (archive.IsReadMode())
{
archive >> _flags;
@@ -104,22 +106,21 @@ namespace wiSceneSystem
SetDirty();
std::string texturesDir = archive.GetSourceDirectory();
if (!baseColorMapName.empty())
{
baseColorMap = (wiGraphicsTypes::Texture2D*)wiResourceManager::GetGlobal().add(texturesDir + baseColorMapName);
baseColorMap = (wiGraphicsTypes::Texture2D*)wiResourceManager::GetGlobal().add(dir + baseColorMapName);
}
if (!surfaceMapName.empty())
{
surfaceMap = (wiGraphicsTypes::Texture2D*)wiResourceManager::GetGlobal().add(texturesDir + surfaceMapName);
surfaceMap = (wiGraphicsTypes::Texture2D*)wiResourceManager::GetGlobal().add(dir + surfaceMapName);
}
if (!normalMapName.empty())
{
normalMap = (wiGraphicsTypes::Texture2D*)wiResourceManager::GetGlobal().add(texturesDir + normalMapName);
normalMap = (wiGraphicsTypes::Texture2D*)wiResourceManager::GetGlobal().add(dir + normalMapName);
}
if (!displacementMapName.empty())
{
displacementMap = (wiGraphicsTypes::Texture2D*)wiResourceManager::GetGlobal().add(texturesDir + displacementMapName);
displacementMap = (wiGraphicsTypes::Texture2D*)wiResourceManager::GetGlobal().add(dir + displacementMapName);
}
}
@@ -144,6 +145,33 @@ namespace wiSceneSystem
archive << texAnimFrameRate;
archive << texAnimElapsedTime;
// If detecting an absolute path in textures, remove it and convert to relative:
{
size_t found = baseColorMapName.rfind(dir);
if (found != std::string::npos)
{
baseColorMapName = baseColorMapName.substr(found + dir.length());
}
found = surfaceMapName.rfind(dir);
if (found != std::string::npos)
{
surfaceMapName = surfaceMapName.substr(found + dir.length());
}
found = normalMapName.rfind(dir);
if (found != std::string::npos)
{
normalMapName = normalMapName.substr(found + dir.length());
}
found = displacementMapName.rfind(dir);
if (found != std::string::npos)
{
displacementMapName = displacementMapName.substr(found + dir.length());
}
}
archive << baseColorMapName;
archive << surfaceMapName;
archive << normalMapName;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 24;
// minor bug fixes, alterations, refactors, updates
const int revision = 13;
const int revision = 14;
long GetVersion()
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB