Merge branch 'master' into vulkan

This commit is contained in:
turanszkij
2018-04-09 12:36:48 +01:00
18 changed files with 994 additions and 311 deletions
+21 -1
View File
@@ -16,6 +16,8 @@ CameraWindow::CameraWindow(wiGUI* gui) :GUI(gui)
fpscamera = true;
orbitalCamTarget = new Transform;
movespeed = 10.0f;
rotationspeed = 1.0f;
cameraWindow = new wiWindow(GUI, "Camera Window");
cameraWindow->SetSize(XMFLOAT2(400, 300));
@@ -54,7 +56,25 @@ CameraWindow::CameraWindow(wiGUI* gui) :GUI(gui)
});
cameraWindow->AddWidget(fovSlider);
resetButton = new wiButton("Reset Pos");
movespeedSlider = new wiSlider(1, 100, 10, 10000, "Movement Speed: ");
movespeedSlider->SetSize(XMFLOAT2(100, 30));
movespeedSlider->SetPos(XMFLOAT2(x, y += inc));
movespeedSlider->OnSlide([&](wiEventArgs args) {
movespeed = args.fValue;
});
movespeedSlider->SetValue(rotationspeed);
cameraWindow->AddWidget(movespeedSlider);
rotationspeedSlider = new wiSlider(0.1f, 2, 1, 10000, "Rotation Speed: ");
rotationspeedSlider->SetSize(XMFLOAT2(100, 30));
rotationspeedSlider->SetPos(XMFLOAT2(x, y += inc));
rotationspeedSlider->OnSlide([&](wiEventArgs args) {
rotationspeed = args.fValue;
});
rotationspeedSlider->SetValue(rotationspeed);
cameraWindow->AddWidget(rotationspeedSlider);
resetButton = new wiButton("Reset Camera");
resetButton->SetSize(XMFLOAT2(140, 30));
resetButton->SetPos(XMFLOAT2(x, y += inc));
resetButton->OnClick([&](wiEventArgs args) {
+4
View File
@@ -17,6 +17,8 @@ public:
bool fpscamera;
Transform* orbitalCamTarget;
float movespeed;
float rotationspeed;
wiGUI* GUI;
@@ -24,6 +26,8 @@ public:
wiSlider* farPlaneSlider;
wiSlider* nearPlaneSlider;
wiSlider* fovSlider;
wiSlider* movespeedSlider;
wiSlider* rotationspeedSlider;
wiButton* resetButton;
wiCheckBox* fpsCheckBox;
};
+10 -4
View File
@@ -308,6 +308,8 @@ void EditorComponent::DeleteWindows()
SAFE_DELETE(objectWnd);
SAFE_DELETE(meshWnd);
SAFE_DELETE(cameraWnd);
SAFE_DELETE(rendererWnd);
SAFE_DELETE(envProbeWnd);
SAFE_DELETE(decalWnd);
SAFE_DELETE(lightWnd);
SAFE_DELETE(animWnd);
@@ -329,6 +331,7 @@ void EditorComponent::Initialize()
SAFE_INIT(meshWnd);
SAFE_INIT(cameraWnd);
SAFE_INIT(rendererWnd);
SAFE_INIT(envProbeWnd);
SAFE_INIT(decalWnd);
SAFE_INIT(lightWnd);
SAFE_INIT(animWnd);
@@ -796,7 +799,7 @@ void EditorComponent::Load()
stringstream ss("");
ss << "Help: " << endl << "############" << endl << endl;
ss << "Move camera: WASD" << endl;
ss << "Look: Middle mouse button" << endl;
ss << "Look: Middle mouse button / arrow keys" << endl;
ss << "Select: Right mouse button" << endl;
ss << "Place decal/interact: Left mouse button when nothing is selected" << endl;
ss << "Camera speed: SHIFT button" << endl;
@@ -811,6 +814,7 @@ void EditorComponent::Load()
ss << "Script Console / backlog: HOME button" << endl;
ss << endl;
ss << "You can find sample models in the models directory. Try to load one." << endl;
ss << "You can also import models from .OBJ files." << endl;
ss << "You can also export models from Blender with the io_export_wicked_wi_bin.py script." << endl;
ss << "You can find a program configuration file at Editor/config.ini" << endl;
ss << "You can find a startup script at Editor/startup.lua (this will be executed on program start)" << endl;
@@ -905,6 +909,9 @@ void EditorComponent::Update(float dt)
yDif += buttonrotSpeed;
}
xDif *= cameraWnd->rotationspeed;
yDif *= cameraWnd->rotationspeed;
Camera* cam = wiRenderer::getCamera();
if (cameraWnd->fpscamera)
@@ -912,7 +919,7 @@ void EditorComponent::Update(float dt)
// FPS Camera
cam->detach();
float speed = (wiInputManager::GetInstance()->down(VK_SHIFT) ? 100.0f : 10.0f) * dt;
const float speed = (wiInputManager::GetInstance()->down(VK_SHIFT) ? 10.0f : 1.0f) * cameraWnd->movespeed * dt;
static XMVECTOR move = XMVectorSet(0, 0, 0, 0);
XMVECTOR moveNew = XMVectorSet(0, 0, 0, 0);
@@ -1709,8 +1716,7 @@ void ConsumeHistoryOperation(bool undo)
object->mesh->subsets[i].material = new Material;
object->mesh->subsets[i].material->Serialize(*archive);
}
object->mesh->CreateVertexArrays();
object->mesh->CreateBuffers(object);
object->mesh->CreateRenderData();
model->Add(object);
}
}
+15
View File
@@ -49,6 +49,21 @@ EnvProbeWindow::EnvProbeWindow(wiGUI* gui) : GUI(gui)
});
envProbeWindow->AddWidget(refreshButton);
refreshAllButton = new wiButton("Refresh All");
refreshAllButton->SetPos(XMFLOAT2(x, y += step));
refreshAllButton->SetEnabled(true);
refreshAllButton->OnClick([&](wiEventArgs args) {
const Scene& scene = wiRenderer::GetScene();
for (Model* x : scene.models)
{
for (EnvironmentProbe* probe : x->environmentProbes)
{
probe->isUpToDate = false;
}
}
});
envProbeWindow->AddWidget(refreshAllButton);
+1
View File
@@ -23,5 +23,6 @@ public:
wiCheckBox* realTimeCheckBox;
wiButton* generateButton;
wiButton* refreshButton;
wiButton* refreshAllButton;
};
+60 -10
View File
@@ -20,9 +20,10 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
float x = 200;
float y = 0;
float step = 35;
meshInfoLabel = new wiLabel("Mesh Info");
meshInfoLabel->SetPos(XMFLOAT2(x, y += 30));
meshInfoLabel->SetPos(XMFLOAT2(x, y += step));
meshInfoLabel->SetSize(XMFLOAT2(400, 150));
meshWindow->AddWidget(meshInfoLabel);
@@ -30,7 +31,7 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
doubleSidedCheckBox = new wiCheckBox("Double Sided: ");
doubleSidedCheckBox->SetTooltip("If enabled, the inside of the mesh will be visible.");
doubleSidedCheckBox->SetPos(XMFLOAT2(x, y += 30));
doubleSidedCheckBox->SetPos(XMFLOAT2(x, y += step));
doubleSidedCheckBox->OnClick([&](wiEventArgs args) {
if (mesh != nullptr)
{
@@ -42,7 +43,7 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
massSlider = new wiSlider(0, 5000, 0, 100000, "Mass: ");
massSlider->SetTooltip("Set the mass amount for the physics engine.");
massSlider->SetSize(XMFLOAT2(100, 30));
massSlider->SetPos(XMFLOAT2(x, y += 30));
massSlider->SetPos(XMFLOAT2(x, y += step));
massSlider->OnSlide([&](wiEventArgs args) {
if (mesh != nullptr)
{
@@ -54,7 +55,7 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
frictionSlider = new wiSlider(0, 5000, 0, 100000, "Friction: ");
frictionSlider->SetTooltip("Set the friction amount for the physics engine.");
frictionSlider->SetSize(XMFLOAT2(100, 30));
frictionSlider->SetPos(XMFLOAT2(x, y += 30));
frictionSlider->SetPos(XMFLOAT2(x, y += step));
frictionSlider->OnSlide([&](wiEventArgs args) {
if (mesh != nullptr)
{
@@ -66,7 +67,7 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
impostorCreateButton = new wiButton("Create Impostor");
impostorCreateButton->SetTooltip("Create an impostor image of the mesh. The mesh will be replaced by this image when far away, to render faster.");
impostorCreateButton->SetSize(XMFLOAT2(240, 30));
impostorCreateButton->SetPos(XMFLOAT2(x - 50, y += 30));
impostorCreateButton->SetPos(XMFLOAT2(x - 50, y += step));
impostorCreateButton->OnClick([&](wiEventArgs args) {
if (mesh != nullptr)
{
@@ -78,7 +79,7 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
impostorDistanceSlider = new wiSlider(0, 1000, 100, 10000, "Impostor Distance: ");
impostorDistanceSlider->SetTooltip("Assign the distance where the mesh geometry should be switched to the impostor image.");
impostorDistanceSlider->SetSize(XMFLOAT2(100, 30));
impostorDistanceSlider->SetPos(XMFLOAT2(x, y += 30));
impostorDistanceSlider->SetPos(XMFLOAT2(x, y += step));
impostorDistanceSlider->OnSlide([&](wiEventArgs args) {
if (mesh != nullptr)
{
@@ -90,7 +91,7 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
tessellationFactorSlider = new wiSlider(0, 16, 0, 10000, "Tessellation Factor: ");
tessellationFactorSlider->SetTooltip("Set the dynamic tessellation amount. Tessellation should be enabled in the Renderer window and your GPU must support it!");
tessellationFactorSlider->SetSize(XMFLOAT2(100, 30));
tessellationFactorSlider->SetPos(XMFLOAT2(x, y += 30));
tessellationFactorSlider->SetPos(XMFLOAT2(x, y += step));
tessellationFactorSlider->OnSlide([&](wiEventArgs args) {
if (mesh != nullptr)
{
@@ -99,6 +100,58 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
});
meshWindow->AddWidget(tessellationFactorSlider);
flipCullingButton = new wiButton("Flip Culling");
flipCullingButton->SetTooltip("Flip faces to reverse triangle culling order.");
flipCullingButton->SetSize(XMFLOAT2(240, 30));
flipCullingButton->SetPos(XMFLOAT2(x - 50, y += step));
flipCullingButton->OnClick([&](wiEventArgs args) {
if (mesh != nullptr)
{
mesh->FlipCulling();
SetMesh(mesh);
}
});
meshWindow->AddWidget(flipCullingButton);
flipNormalsButton = new wiButton("Flip Normals");
flipNormalsButton->SetTooltip("Flip surface normals.");
flipNormalsButton->SetSize(XMFLOAT2(240, 30));
flipNormalsButton->SetPos(XMFLOAT2(x - 50, y += step));
flipNormalsButton->OnClick([&](wiEventArgs args) {
if (mesh != nullptr)
{
mesh->FlipNormals();
SetMesh(mesh);
}
});
meshWindow->AddWidget(flipNormalsButton);
computeNormalsSmoothButton = new wiButton("Compute Normals [SMOOTH]");
computeNormalsSmoothButton->SetTooltip("Compute surface normals of the mesh. Resulting normals will be unique per vertex.");
computeNormalsSmoothButton->SetSize(XMFLOAT2(240, 30));
computeNormalsSmoothButton->SetPos(XMFLOAT2(x - 50, y += step));
computeNormalsSmoothButton->OnClick([&](wiEventArgs args) {
if (mesh != nullptr)
{
mesh->ComputeNormals(true);
SetMesh(mesh);
}
});
meshWindow->AddWidget(computeNormalsSmoothButton);
computeNormalsHardButton = new wiButton("Compute Normals [HARD]");
computeNormalsHardButton->SetTooltip("Compute surface normals of the mesh. Resulting normals will be unique per face.");
computeNormalsHardButton->SetSize(XMFLOAT2(240, 30));
computeNormalsHardButton->SetPos(XMFLOAT2(x - 50, y += step));
computeNormalsHardButton->OnClick([&](wiEventArgs args) {
if (mesh != nullptr)
{
mesh->ComputeNormals(false);
SetMesh(mesh);
}
});
meshWindow->AddWidget(computeNormalsHardButton);
@@ -118,9 +171,6 @@ MeshWindow::~MeshWindow()
void MeshWindow::SetMesh(Mesh* mesh)
{
if (this->mesh == mesh)
return;
this->mesh = mesh;
if (mesh != nullptr)
{
+4
View File
@@ -30,5 +30,9 @@ public:
wiButton* impostorCreateButton;
wiSlider* impostorDistanceSlider;
wiSlider* tessellationFactorSlider;
wiButton* flipCullingButton;
wiButton* flipNormalsButton;
wiButton* computeNormalsSmoothButton;
wiButton* computeNormalsHardButton;
};
+76 -23
View File
@@ -82,30 +82,28 @@ WorldWindow::WorldWindow(wiGUI* gui) : GUI(gui)
if (x == nullptr)
{
thread([&] {
char szFile[260];
char szFile[260];
OPENFILENAMEA ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = nullptr;
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "Cubemap texture\0*.dds\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileNameA(&ofn) == TRUE) {
string fileName = ofn.lpstrFile;
wiRenderer::SetEnviromentMap((Texture2D*)wiResourceManager::GetGlobal()->add(fileName));
skyButton->SetText(fileName);
}
}).detach();
OPENFILENAMEA ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = nullptr;
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "Cubemap texture\0*.dds\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileNameA(&ofn) == TRUE) {
string fileName = ofn.lpstrFile;
wiRenderer::SetEnviromentMap((Texture2D*)wiResourceManager::GetGlobal()->add(fileName));
skyButton->SetText(fileName);
}
}
else
{
@@ -113,11 +111,66 @@ WorldWindow::WorldWindow(wiGUI* gui) : GUI(gui)
skyButton->SetText("Load Sky");
}
// Also, we invalidate all environment probes to reflect the sky changes.
const Scene& scene = wiRenderer::GetScene();
for (Model* x : scene.models)
{
for (EnvironmentProbe* probe : x->environmentProbes)
{
probe->isUpToDate = false;
}
}
});
worldWindow->AddWidget(skyButton);
wiButton* convertDDSButton = new wiButton("HELPERSCRIPT - ConvertMaterialsDDS");
convertDDSButton->SetTooltip("Every material in the scene will have its textures saved and renamed as DDS into textures_dds folder.");
convertDDSButton->SetSize(XMFLOAT2(240, 30));
convertDDSButton->SetPos(XMFLOAT2(x - 100, y += step * 3));
convertDDSButton->OnClick([=](wiEventArgs args) {
const Scene& scene = wiRenderer::GetScene();
for (Model* x : scene.models)
{
for (auto& y : x->materials)
{
Material* material = y.second;
CreateDirectory(L"textures_dds", 0);
if (!material->textureName.empty())
{
string newName = wiHelper::GetFileNameFromPath(material->textureName.substr(0, material->textureName.length() - 4) + ".dds");
wiRenderer::GetDevice()->SaveTextureDDS(wiHelper::GetWorkingDirectory() + "textures_dds/" + newName, material->GetBaseColorMap(), GRAPHICSTHREAD_IMMEDIATE);
material->textureName = newName;
}
if (!material->normalMapName.empty())
{
string newName = wiHelper::GetFileNameFromPath(material->normalMapName.substr(0, material->normalMapName.length() - 4) + ".dds");
wiRenderer::GetDevice()->SaveTextureDDS(wiHelper::GetWorkingDirectory() + "textures_dds/" + newName, material->GetNormalMap(), GRAPHICSTHREAD_IMMEDIATE);
material->normalMapName = newName;
}
if (!material->surfaceMapName.empty())
{
string newName = wiHelper::GetFileNameFromPath(material->surfaceMapName.substr(0, material->surfaceMapName.length() - 4) + ".dds");
wiRenderer::GetDevice()->SaveTextureDDS(wiHelper::GetWorkingDirectory() + "textures_dds/" + newName, material->GetSurfaceMap(), GRAPHICSTHREAD_IMMEDIATE);
material->surfaceMapName = newName;
}
if (!material->displacementMapName.empty())
{
string newName = wiHelper::GetFileNameFromPath(material->displacementMapName.substr(0, material->displacementMapName.length() - 4) + ".dds");
wiRenderer::GetDevice()->SaveTextureDDS(wiHelper::GetWorkingDirectory() + "textures_dds/" + newName, material->GetDisplacementMap(), GRAPHICSTHREAD_IMMEDIATE);
material->displacementMapName = newName;
}
}
}
});
worldWindow->AddWidget(convertDDSButton);
+2 -2
View File
@@ -320,8 +320,8 @@ void wiEmittedParticle::UpdateRenderData(GRAPHICSTHREAD threadID)
GPUResource* resources[] = {
wiTextureHelper::getInstance()->getRandom64x64(),
&object->mesh->indexBuffer,
&object->mesh->vertexBuffer_POS,
object->mesh->indexBuffer,
object->mesh->vertexBuffer_POS,
};
device->BindResources(CS, resources, TEXSLOT_ONDEMAND0, ARRAYSIZE(resources), threadID);
+414 -112
View File
File diff suppressed because it is too large Load Diff
+14 -49
View File
@@ -446,12 +446,12 @@ public:
std::vector<MeshSubset> subsets;
std::vector<std::string> materialNames;
wiGraphicsTypes::GPUBuffer indexBuffer;
wiGraphicsTypes::GPUBuffer vertexBuffer_POS;
wiGraphicsTypes::GPUBuffer vertexBuffer_TEX;
wiGraphicsTypes::GPUBuffer vertexBuffer_BON;
wiGraphicsTypes::GPUBuffer streamoutBuffer_POS;
wiGraphicsTypes::GPUBuffer streamoutBuffer_PRE;
wiGraphicsTypes::GPUBuffer* indexBuffer;
wiGraphicsTypes::GPUBuffer* vertexBuffer_POS;
wiGraphicsTypes::GPUBuffer* vertexBuffer_TEX;
wiGraphicsTypes::GPUBuffer* vertexBuffer_BON;
wiGraphicsTypes::GPUBuffer* streamoutBuffer_POS;
wiGraphicsTypes::GPUBuffer* streamoutBuffer_PRE;
// Dynamic vertexbuffers write into a global pool, these will be the offsets into that:
UINT bufferOffset_POS;
@@ -488,54 +488,19 @@ public:
float tessellationFactor;
bool optimized;
bool renderDataComplete;
Mesh(){
init();
}
Mesh(const std::string& newName){
name=newName;
init();
}
~Mesh() {}
Mesh(const std::string& newName = "");
~Mesh();
void LoadFromFile(const std::string& newName, const std::string& fname
, const MaterialCollection& materialColl, const std::unordered_set<Armature*>& armatures, const std::string& identifier="");
bool buffersComplete;
void Optimize();
// Object is needed in CreateBuffers because how else would we know if the mesh needs to be deformed?
void CreateBuffers(Object* object);
void CreateRenderData();
static void CreateImpostorVB();
bool arraysComplete;
void CreateVertexArrays();
void init()
{
parent="";
indices.resize(0);
renderable=false;
doubleSided=false;
aabb=AABB();
trailInfo=RibbonTrail();
armature=nullptr;
isBillboarded=false;
billboardAxis=XMFLOAT3(0,0,0);
vertexGroups.clear();
softBody=false;
mass=friction=1;
massVG=-1;
goalVG=-1;
softVG = -1;
goalPositions.clear();
goalNormals.clear();
buffersComplete = false;
arraysComplete = false;
calculatedAO = false;
armatureName = "";
impostorDistance = 100.0f;
tessellationFactor = 0.0f;
optimized = false;
bufferOffset_POS = 0;
bufferOffset_PRE = 0;
indexFormat = wiGraphicsTypes::INDEXFORMAT_16BIT;
}
void ComputeNormals(bool smooth = false);
void FlipCulling();
void FlipNormals();
void init();
bool hasArmature() const { return armature != nullptr; }
bool hasImpostor() const { return impostorTarget.IsInitialized(); }
+20
View File
@@ -90,6 +90,26 @@ namespace wiMath
return ++x;
}
float TriangleArea(const XMVECTOR& A, const XMVECTOR& B, const XMVECTOR& C)
{
// Heron's formula:
XMVECTOR a = XMVector3Length(B - A);
XMVECTOR b = XMVector3Length(C - A);
XMVECTOR c = XMVector3Length(C - B);
XMVECTOR p = (a + b + c) * 0.5f;
XMVECTOR areaSq = p * (p - a) * (p - b) * (p - c);
float area;
XMStoreFloat(&area, areaSq);
area = sqrtf(area);
return area;
}
float TriangleArea(float a, float b, float c)
{
// Heron's formula:
float p = (a + b + c) * 0.5f;
return sqrtf(p * (p - a) * (p - b) * (p - c));
}
float InverseLerp(float value1, float value2, float pos)
{
+5
View File
@@ -27,6 +27,11 @@ namespace wiMath
UINT GetNextPowerOfTwo(UINT x);
float SmoothStep(float value1, float value2, float amount);
// A, B, C: trangle vertices
float TriangleArea(const XMVECTOR& A, const XMVECTOR& B, const XMVECTOR& C);
// a, b, c: trangle side lengths
float TriangleArea(float a, float b, float c);
XMFLOAT3 getCubicHermiteSplinePos(const XMFLOAT3& startPos, const XMFLOAT3& endPos
, const XMFLOAT3& startTangent, const XMFLOAT3& endTangent
, float atInterval);
File diff suppressed because it is too large Load Diff
+22 -20
View File
@@ -3074,6 +3074,8 @@ void wiRenderer::UpdatePerFrameData(float dt)
Light* l = (Light*)c;
l->entityArray_index = i;
l->UpdateLight();
// Link shadowmaps to lights till there are free slots
l->shadowMap_index = -1;
@@ -3223,7 +3225,7 @@ void wiRenderer::UpdateRenderData(GRAPHICSTHREAD threadID)
matrixArray[shadowIndex + 0] = l->shadowCam_dirLight[0].getVP();
matrixArray[shadowIndex + 1] = l->shadowCam_dirLight[1].getVP();
matrixArray[shadowIndex + 2] = l->shadowCam_dirLight[2].getVP();
matrixCounter = max(matrixCounter, (UINT)shadowIndex + 2);
matrixCounter = max(matrixCounter, (UINT)shadowIndex + 3);
}
}
break;
@@ -3237,7 +3239,7 @@ void wiRenderer::UpdateRenderData(GRAPHICSTHREAD threadID)
if (l->shadow && shadowIndex >= 0 && !l->shadowCam_spotLight.empty())
{
matrixArray[shadowIndex + 0] = l->shadowCam_spotLight[0].getVP();
matrixCounter = max(matrixCounter, (UINT)shadowIndex + 2);
matrixCounter = max(matrixCounter, (UINT)shadowIndex + 1);
}
}
break;
@@ -3402,7 +3404,7 @@ void wiRenderer::UpdateRenderData(GRAPHICSTHREAD threadID)
Mesh* mesh = iter->second;
if (mesh->hasArmature() && !mesh->hasDynamicVB() && mesh->renderable && !mesh->vertices_POS.empty()
&& mesh->streamoutBuffer_POS.IsValid() && mesh->vertexBuffer_POS.IsValid())
&& mesh->streamoutBuffer_POS != nullptr && mesh->vertexBuffer_POS != nullptr)
{
Armature* armature = mesh->armature;
@@ -3444,12 +3446,12 @@ void wiRenderer::UpdateRenderData(GRAPHICSTHREAD threadID)
// Do the skinning
GPUResource* vbs[] = {
&mesh->vertexBuffer_POS,
&mesh->vertexBuffer_BON,
mesh->vertexBuffer_POS,
mesh->vertexBuffer_BON,
};
GPUResource* sos[] = {
&mesh->streamoutBuffer_POS,
&mesh->streamoutBuffer_PRE,
mesh->streamoutBuffer_POS,
mesh->streamoutBuffer_PRE,
};
GetDevice()->BindResources(CS, vbs, SKINNINGSLOT_IN_VERTEX_POS, ARRAYSIZE(vbs), threadID);
@@ -4154,13 +4156,13 @@ void wiRenderer::DrawDebugEmitters(Camera* camera, GRAPHICSTHREAD threadID)
GetDevice()->UpdateBuffer(constantBuffers[CBTYPE_MISC], &sb, threadID);
GPUBuffer* vbs[] = {
&x->object->mesh->vertexBuffer_POS,
x->object->mesh->vertexBuffer_POS,
};
const UINT strides[] = {
sizeof(Mesh::Vertex_POS),
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, threadID);
GetDevice()->BindIndexBuffer(&x->object->mesh->indexBuffer, x->object->mesh->GetIndexFormat(), 0, threadID);
GetDevice()->BindIndexBuffer(x->object->mesh->indexBuffer, x->object->mesh->GetIndexFormat(), 0, threadID);
GetDevice()->DrawIndexed((int)x->object->mesh->indices.size(), 0, 0, threadID);
}
@@ -5244,7 +5246,7 @@ void wiRenderer::RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culle
if (k < 1)
continue;
device->BindIndexBuffer(&mesh->indexBuffer, mesh->GetIndexFormat(), 0, threadID);
device->BindIndexBuffer(mesh->indexBuffer, mesh->GetIndexFormat(), 0, threadID);
enum class BOUNDVERTEXBUFFERTYPE
{
@@ -5338,7 +5340,7 @@ void wiRenderer::RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culle
case BOUNDVERTEXBUFFERTYPE::POSITION:
{
GPUBuffer* vbs[] = {
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_POS.IsValid() ? &mesh->streamoutBuffer_POS : &mesh->vertexBuffer_POS),
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_POS != nullptr ? mesh->streamoutBuffer_POS : mesh->vertexBuffer_POS),
dynamicVertexBufferPool
};
UINT strides[] = {
@@ -5355,8 +5357,8 @@ void wiRenderer::RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culle
case BOUNDVERTEXBUFFERTYPE::POSITION_TEXCOORD:
{
GPUBuffer* vbs[] = {
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_POS.IsValid() ? &mesh->streamoutBuffer_POS : &mesh->vertexBuffer_POS),
&mesh->vertexBuffer_TEX,
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_POS != nullptr ? mesh->streamoutBuffer_POS : mesh->vertexBuffer_POS),
mesh->vertexBuffer_TEX,
dynamicVertexBufferPool
};
UINT strides[] = {
@@ -5375,9 +5377,9 @@ void wiRenderer::RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culle
case BOUNDVERTEXBUFFERTYPE::EVERYTHING:
{
GPUBuffer* vbs[] = {
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_POS.IsValid() ? &mesh->streamoutBuffer_POS : &mesh->vertexBuffer_POS),
&mesh->vertexBuffer_TEX,
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_PRE.IsValid() ? &mesh->streamoutBuffer_PRE : &mesh->vertexBuffer_POS),
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_POS != nullptr ? mesh->streamoutBuffer_POS : mesh->vertexBuffer_POS),
mesh->vertexBuffer_TEX,
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_PRE != nullptr ? mesh->streamoutBuffer_PRE : mesh->vertexBuffer_POS),
dynamicVertexBufferPool,
dynamicVertexBufferPool
};
@@ -7196,9 +7198,9 @@ void wiRenderer::CreateImpostor(Mesh* mesh)
GetDevice()->InvalidateBufferAccess(dynamicVertexBufferPool, threadID);
GPUBuffer* vbs[] = {
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_POS.IsValid() ? &mesh->streamoutBuffer_POS : &mesh->vertexBuffer_POS),
&mesh->vertexBuffer_TEX,
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_PRE.IsValid() ? &mesh->streamoutBuffer_PRE : &mesh->vertexBuffer_POS),
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_POS != nullptr ? mesh->streamoutBuffer_POS : mesh->vertexBuffer_POS),
mesh->vertexBuffer_TEX,
mesh->hasDynamicVB() ? dynamicVertexBufferPool : (mesh->streamoutBuffer_PRE != nullptr ? mesh->streamoutBuffer_PRE : mesh->vertexBuffer_POS),
dynamicVertexBufferPool,
dynamicVertexBufferPool
};
@@ -7218,7 +7220,7 @@ void wiRenderer::CreateImpostor(Mesh* mesh)
};
GetDevice()->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, offsets, threadID);
GetDevice()->BindIndexBuffer(&mesh->indexBuffer, mesh->GetIndexFormat(), 0, threadID);
GetDevice()->BindIndexBuffer(mesh->indexBuffer, mesh->GetIndexFormat(), 0, threadID);
GetDevice()->BindPrimitiveTopology(TRIANGLELIST, threadID);
+1 -1
View File
@@ -292,7 +292,7 @@ protected:
UINT mips;
VoxelizedSceneData() :enabled(false), res(128), voxelsize(1.0f), center(XMFLOAT3(0, 0, 0)), extents(XMFLOAT3(0, 0, 0)), numCones(8),
rayStepSize(0.5f), secondaryBounceEnabled(true), reflectionsEnabled(false), centerChangedThisFrame(true), mips(8)
rayStepSize(0.5f), secondaryBounceEnabled(true), reflectionsEnabled(false), centerChangedThisFrame(true), mips(7)
{}
} static voxelSceneData;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 16;
// minor bug fixes, alterations, refactors, updates
const int revision = 31;
const int revision = 39;
long GetVersion()
Binary file not shown.