updated material texture serialization; added sponza test scene; editor updates;
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
wiSlider* cloudScaleSlider;
|
||||
wiSlider* cloudSpeedSlider;
|
||||
wiSlider* windSpeedSlider;
|
||||
wiSlider* windDirectionSlider;
|
||||
wiButton* skyButton;
|
||||
wiColorPicker* ambientColorPicker;
|
||||
wiColorPicker* horizonColorPicker;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 358 KiB |
|
After Width: | Height: | Size: 941 KiB |
|
After Width: | Height: | Size: 425 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 480 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 475 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 653 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 903 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 580 KiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 752 KiB |
|
After Width: | Height: | Size: 473 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 818 KiB |
|
After Width: | Height: | Size: 416 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 792 KiB |
|
After Width: | Height: | Size: 437 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 782 KiB |
|
After Width: | Height: | Size: 8.8 MiB |
|
After Width: | Height: | Size: 8.4 MiB |
|
After Width: | Height: | Size: 8.5 MiB |
|
After Width: | Height: | Size: 8.0 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 792 KiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 484 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 677 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 836 KiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 153 KiB |
|
After Width: | Height: | Size: 560 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 426 KiB |
|
After Width: | Height: | Size: 629 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 837 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 719 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 208 KiB |
|
After Width: | Height: | Size: 1.6 MiB |