Changed .obj files to our own format. DummyScene.mesh may be broken.

This commit is contained in:
antc13
2016-01-23 20:35:58 +01:00
parent f1835fd89c
commit 3baa988ad4
26 changed files with 99 additions and 83 deletions
+13 -13
View File
@@ -295,7 +295,7 @@ void EditorSystem::createWidget()
#ifdef USING_ASSIMP_AS_IMPORTER
m_World->GetComponent(m_WidgetPlaneX, "Model")["Resource"] = "Models/WidgetPlaneZ.obj"; // 360NoScope widgetPlaneX
#else
m_World->GetComponent(m_WidgetPlaneX, "Model")["Resource"] = "Models/coolCube.mesh"; // 360NoScope widgetPlaneX
m_World->GetComponent(m_WidgetPlaneX, "Model")["Resource"] = "Models/WidgetPlaneZ.mesh";
#endif
m_WidgetY = m_World->CreateEntity(m_Widget);
m_World->AttachComponent(m_WidgetY, "Transform");
@@ -306,7 +306,7 @@ void EditorSystem::createWidget()
#ifdef USING_ASSIMP_AS_IMPORTER
m_World->GetComponent(m_WidgetPlaneY, "Model")["Resource"] = "Models/WidgetPlaneZ.obj"; // 360NoScope widgetPlaneY
#else
m_World->GetComponent(m_WidgetPlaneY, "Model")["Resource"] = "Models/coolCube.mesh"; // 360NoScope widgetPlaneY
m_World->GetComponent(m_WidgetPlaneY, "Model")["Resource"] = "Models/WidgetPlaneZ.mesh";
#endif
m_WidgetZ = m_World->CreateEntity(m_Widget);
m_World->AttachComponent(m_WidgetZ, "Transform");
@@ -317,7 +317,7 @@ void EditorSystem::createWidget()
#ifdef USING_ASSIMP_AS_IMPORTER
m_World->GetComponent(m_WidgetPlaneZ, "Model")["Resource"] = "Models/WidgetPlaneZ.obj"; // 360NoScope widgetPlaneZ
#else
m_World->GetComponent(m_WidgetPlaneZ, "Model")["Resource"] = "Models/coolCube.mesh"; // 360NoScope widgetPlaneZ
m_World->GetComponent(m_WidgetPlaneZ, "Model")["Resource"] = "Models/WidgetPlaneZ.mesh";
#endif
m_WidgetOrigin = m_World->CreateEntity(m_Widget);
m_World->AttachComponent(m_WidgetOrigin, "Transform");
@@ -363,9 +363,9 @@ void EditorSystem::setWidgetMode(WidgetMode newMode)
m_World->GetComponent(m_WidgetOrigin, "Model")["Visible"] = false;
if (newMode == WidgetMode::Translate) {
//m_World->GetComponent(m_WidgetX, "Model")["Resource"] = "Models/TranslationWidgetX.obj"; // 360NoScope TranslationWidgets mesh
//m_World->GetComponent(m_WidgetY, "Model")["Resource"] = "Models/TranslationWidgetY.obj";
//m_World->GetComponent(m_WidgetZ, "Model")["Resource"] = "Models/TranslationWidgetZ.obj";
m_World->GetComponent(m_WidgetX, "Model")["Resource"] = "Models/TranslationWidgetX.mesh";
m_World->GetComponent(m_WidgetY, "Model")["Resource"] = "Models/TranslationWidgetY.mesh";
m_World->GetComponent(m_WidgetZ, "Model")["Resource"] = "Models/TranslationWidgetZ.mesh";
// Temporarily disabled for local space until I can figure out what's wrong with the math
if (m_WidgetSpace != WidgetSpace::Local) {
m_World->GetComponent(m_WidgetPlaneX, "Model")["Visible"] = true;
@@ -379,19 +379,19 @@ void EditorSystem::setWidgetMode(WidgetMode newMode)
}
}
} else if (newMode == WidgetMode::Scale) {
//m_World->GetComponent(m_WidgetX, "Model")["Resource"] = "Models/ScaleWidgetX.obj"; // 360NoScope ScaleWidgets mesh
//m_World->GetComponent(m_WidgetY, "Model")["Resource"] = "Models/ScaleWidgetY.obj";
//m_World->GetComponent(m_WidgetZ, "Model")["Resource"] = "Models/ScaleWidgetZ.obj";
m_World->GetComponent(m_WidgetX, "Model")["Resource"] = "Models/ScaleWidgetX.mesh";
m_World->GetComponent(m_WidgetY, "Model")["Resource"] = "Models/ScaleWidgetY.mesh";
m_World->GetComponent(m_WidgetZ, "Model")["Resource"] = "Models/ScaleWidgetZ.mesh";
m_World->GetComponent(m_WidgetOrigin, "Model")["Visible"] = true;
//m_World->GetComponent(m_WidgetOrigin, "Model")["Resource"] = "Models/ScaleWidgetOrigin.obj"; // 360NoScope ScaleWidgetOrigin mesh
m_World->GetComponent(m_WidgetOrigin, "Model")["Resource"] = "Models/ScaleWidgetOrigin.mesh";
if (m_Selection != EntityID_Invalid) {
auto selectionTransform = m_World->GetComponent(m_Selection, "Transform");
widgetTransform["Orientation"] = glm::eulerAngles(Transform::AbsoluteOrientation(m_World, m_Selection));
}
} else if (newMode == WidgetMode::Rotate) {
//m_World->GetComponent(m_WidgetX, "Model")["Resource"] = "Models/RotationWidgetX.obj"; // 360NoScope RotationWidget mesh
//m_World->GetComponent(m_WidgetY, "Model")["Resource"] = "Models/RotationWidgetY.obj";
//m_World->GetComponent(m_WidgetZ, "Model")["Resource"] = "Models/RotationWidgetZ.obj";
m_World->GetComponent(m_WidgetX, "Model")["Resource"] = "Models/RotationWidgetX.mesh";
m_World->GetComponent(m_WidgetY, "Model")["Resource"] = "Models/RotationWidgetY.mesh";
m_World->GetComponent(m_WidgetZ, "Model")["Resource"] = "Models/RotationWidgetZ.mesh";
if (m_Selection != EntityID_Invalid) {
auto selectionTransform = m_World->GetComponent(m_Selection, "Transform");
if (m_WidgetSpace == WidgetSpace::Local) {
+1 -1
View File
@@ -331,7 +331,7 @@ EntityID Client::createPlayer()
EntityID entityID = m_World->CreateEntity();
ComponentWrapper transform = m_World->AttachComponent(entityID, "Transform");
ComponentWrapper model = m_World->AttachComponent(entityID, "Model");
model["Resource"] = "Models/Core/UnitSphere.obj"; // 360NoScope UnitSphere mesh
model["Resource"] = "Models/Core/UnitSphere.mesh";
ComponentWrapper player = m_World->AttachComponent(entityID, "Player");
return entityID;
}
+1 -1
View File
@@ -349,7 +349,7 @@ EntityID Server::createPlayer()
ComponentWrapper transform = m_World->AttachComponent(entityID, "Transform");
transform["Position"] = glm::vec3(-1.5f, 0.f, 0.f);
ComponentWrapper model = m_World->AttachComponent(entityID, "Model");
model["Resource"] = "Models/Core/UnitSphere.obj"; // 360NoScope UnitSphere
model["Resource"] = "Models/Core/UnitSphere.mesh";
model["Color"] = glm::vec4(rand()%255 / 255.f, rand()%255 / 255.f, rand() %255 / 255.f, 1.f);
ComponentWrapper player = m_World->AttachComponent(entityID, "Player");
return entityID;
+3 -9
View File
@@ -22,8 +22,6 @@ void DrawFinalPass::InitializeShaderPrograms()
m_ForwardPlusProgram->Link();
}
static double tempFrameCounter = 6.348;
void DrawFinalPass::Draw(RenderScene& scene)
{
GLERROR("DrawFinalPass::Draw: Pre");
@@ -40,7 +38,6 @@ void DrawFinalPass::Draw(RenderScene& scene)
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(m_Renderer->Camera()->ProjectionMatrix()));
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
//tempFrameCounter += 0.01;
//TODO: Render: Add code for more jobs than modeljobs.
for (auto &job : scene.ForwardJobs) {
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
@@ -57,21 +54,18 @@ void DrawFinalPass::Draw(RenderScene& scene)
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
}
//TODO: Fixa så att modelsJobs kan spela upp olika animationer och så att den kan få in en tid istället för 1.0f - Hälsningar Johan och Andreas :)
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
#ifdef USING_ASSIMP_AS_IMPORTER
auto animation = modelJob->Model->m_RawModel->m_Skeleton->GetAnimation("combinedAnim_0");
#else
auto animation = modelJob->Model->m_RawModel->m_Skeleton->GetAnimation("running");
#endif
if (animation != nullptr) {
std::vector<glm::mat4> frameBones = modelJob->Model->m_RawModel->m_Skeleton->GetFrameBones(
*animation,
tempFrameCounter
1.0f
);
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
}
// -3 - 9
glBindVertexArray(modelJob->Model->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
+9 -6
View File
@@ -162,8 +162,9 @@ void RawModelCustom::ReadMaterialSingle(unsigned int &offset, char* fileData, un
if (offset + nameLengths[1] > fileByteSize) {
throw Resource::FailedLoadingException("Reading Material NormalMap path failed");
}
newMaterial.NormalMapPath = (fileData + offset);
newMaterial.NormalMapPath = "Textures/";
newMaterial.NormalMapPath += (fileData + offset);
newMaterial.NormalMapPath += ".png";
offset += nameLengths[1];
}
@@ -171,8 +172,9 @@ void RawModelCustom::ReadMaterialSingle(unsigned int &offset, char* fileData, un
if (offset + nameLengths[2] > fileByteSize) {
throw Resource::FailedLoadingException("Reading Material SpecularMap path failed");
}
newMaterial.SpecularMapPath = (fileData + offset);
newMaterial.SpecularMapPath = "Textures/";
newMaterial.SpecularMapPath += (fileData + offset);
newMaterial.SpecularMapPath += ".png";
offset += nameLengths[2];
}
@@ -180,8 +182,9 @@ void RawModelCustom::ReadMaterialSingle(unsigned int &offset, char* fileData, un
if (offset + nameLengths[3] > fileByteSize) {
throw Resource::FailedLoadingException("Reading Material IncandescenceMap path failed");
}
newMaterial.IncandescenceMapPath = (fileData + offset);
newMaterial.IncandescenceMapPath = "Textures/";
newMaterial.IncandescenceMapPath += (fileData + offset);
newMaterial.IncandescenceMapPath += ".png";
offset += nameLengths[3];
}
+2 -2
View File
@@ -99,14 +99,14 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs, World
#ifdef USING_ASSIMP_AS_IMPORTER
model = ResourceManager::Load<::Model>("Models/WidgetPlaneZ.obj"); // 360NoScope StillLoading mesh
#else
model = ResourceManager::Load<::Model>("Models/coolCube.mesh"); // 360NoScope StillLoading mesh
model = ResourceManager::Load<::Model>("Models/WidgetPlaneZ.mesh");
#endif
} catch (const std::exception&) {
try {
#ifdef USING_ASSIMP_AS_IMPORTER
model = ResourceManager::Load<::Model>("Models/WidgetPlaneZ.obj"); // 360NoScope Error mesh
#else
model = ResourceManager::Load<::Model>("Models/coolCube.mesh"); // 360NoScope Error mesh
model = ResourceManager::Load<::Model>("Models/WidgetPlaneZ.mesh");
#endif
} catch (const std::exception&) {
continue;
+1 -1
View File
@@ -198,7 +198,7 @@ bool SoundSystem::OnPlaySoundOnPosition(const Events::PlaySoundOnPosition & e)
(float&)(double)emitter["RollOffFactor"] = e.RollOffFactor;
(float&)(double)emitter["ReferenceDistance"] = e.ReferenceDistance;
auto model = m_World->AttachComponent(emitterID, "Model");
(std::string&)model["Resource"] = "Models/Core/UnitCube.obj"; // 360NoScope UnitCube
(std::string&)model["Resource"] = "Models/Core/UnitCube.mesh"; // 360NoScope UnitCube
source->Type = SoundType::SFX;
m_Sources[emitterID] = source;
playSound(source);
+5 -5
View File
@@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(collisionTest2)
BOOST_AUTO_TEST_CASE(rayVsModelTest)
{
//simple box test
RayTest("Models/Core/UnitCube.obj"); // 360NoScope Unitcube
RayTest("Models/Core/UnitCube.mesh"); // 360NoScope Unitcube
}
BOOST_AUTO_TEST_CASE(rayVsModelTest2)
@@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE(rayVsModelTest2)
someAABB = AABB(minPos, maxPos);
//using a rawmodel here, else we have to init the renderingsystem
ResourceManager::RegisterType<RawModel>("RawModel");
auto unitBox = ResourceManager::Load<RawModel>("Models/Core/UnitCube.obj"); // 360NoScope unitcube
auto unitBox = ResourceManager::Load<RawModel>("Models/Core/UnitCube.mesh"); // 360NoScope unitcube
BOOST_CHECK(unitBox != nullptr);
for (size_t i = 0; i < 1000000; i++)
@@ -189,19 +189,19 @@ BOOST_AUTO_TEST_CASE(rayVsModelTest2)
BOOST_AUTO_TEST_CASE(rayVsModelTest3)
{
//simple test
RayTest("Models/Core/UnitSphere.obj"); // 360NoScope unitSphere
RayTest("Models/Core/UnitSphere.mesh"); // 360NoScope unitSphere
}
BOOST_AUTO_TEST_CASE(rayVsModelTest4)
{
//simple test
RayTest("Models/Core/UnitCylinder.obj"); // 360NoScope unitCylinder
RayTest("Models/Core/UnitCylinder.mesh"); // 360NoScope unitCylinder
}
BOOST_AUTO_TEST_CASE(rayVsModelTest5)
{
//simple test
RayTest("Models/Core/UnitRaptor.obj"); // 360NoScope unitRaptor
RayTest("Models/Core/UnitRaptor.mesh"); // 360NoScope unitRaptor
}
BOOST_AUTO_TEST_CASE(octTest)
{
+2 -2
View File
@@ -55,7 +55,7 @@ GameHealthSystemTest::GameHealthSystemTest()
EntityID playerID = m_World->CreateEntity();
ComponentWrapper transform = m_World->AttachComponent(playerID, "Transform");
ComponentWrapper model = m_World->AttachComponent(playerID, "Model");
model["Resource"] = "Models/Core/UnitSphere.obj"; // 360NoScope UnitSphere
model["Resource"] = "Models/Core/UnitSphere.mesh"; // 360NoScope UnitSphere
ComponentWrapper player = m_World->AttachComponent(playerID, "Player");
ComponentWrapper health = m_World->AttachComponent(playerID, "Health");
healthsID = playerID;
@@ -80,7 +80,7 @@ GameHealthSystemTest::GameHealthSystemTest()
EntityID playerID2 = m_World->CreateEntity();
ComponentWrapper transform2 = m_World->AttachComponent(playerID2, "Transform");
ComponentWrapper model2 = m_World->AttachComponent(playerID2, "Model");
model2["Resource"] = "Models/Core/UnitSphere.obj"; // 360NoScope UnitSphere
model2["Resource"] = "Models/Core/UnitSphere.mesh"; // 360NoScope UnitSphere
ComponentWrapper player2 = m_World->AttachComponent(playerID2, "Player");
ComponentWrapper health2 = m_World->AttachComponent(playerID2, "Health");
//END TEST
+1 -1
View File
@@ -149,7 +149,7 @@ void Game::Tick()
ComponentWrapper transform = m_World->AttachComponent(m_BoxID, "Transform");
transform["Scale"] = boxSize;
ComponentWrapper model = m_World->AttachComponent(m_BoxID, "Model");
model["Resource"] = "Models/Core/UnitBox.obj"; // 360NoScope UnitBox
model["Resource"] = "Models/Core/UnitBox.mesh"; // 360NoScope UnitBox
m_World->createTestEntitiesTest2();
}
+2 -2
View File
@@ -112,7 +112,7 @@ private:
ComponentWrapper transform = world.AttachComponent(entityCollisionBox, "Transform");
transform["Position"] = glm::vec3(0.f, 2.f, 0.f);
ComponentWrapper model = world.AttachComponent(entityCollisionBox, "Model");
model["Resource"] = "Models/Core/UnitBox.obj"; // 360NoScope UnitBox
model["Resource"] = "Models/Core/UnitBox.mesh"; // 360NoScope UnitBox
}
void AddBoxModel(const glm::vec3 &center, const float &halfSize, Octree::Child* child, EntityID &outEntityId) {
@@ -124,7 +124,7 @@ private:
transform["Position"] = center;
transform["Scale"] = glm::vec3(1.0f, 1.0f, 1.0f)*halfSize*2.0f*0.97f;
ComponentWrapper model = world.AttachComponent(entityDummyScene, "Model");
model["Resource"] = "Models/Core/UnitBox.obj"; // 360NoScope unitBox
model["Resource"] = "Models/Core/UnitBox.mesh"; // 360NoScope unitBox
model["Color"] = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
if (child->m_DynamicObjIndices.size() != 0)
model["Color"] = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f);
+1 -1
View File
@@ -112,7 +112,7 @@ void OctTree::Update(float dt, World* world, Camera* cam)
ComponentWrapper transform = world->AttachComponent(m_BoxID, "Transform");
transform["Scale"] = boxSize;
ComponentWrapper model = world->AttachComponent(m_BoxID, "Model");
model["Resource"] = "Models/Core/UnitBox.obj"; // 360NoScope UnitBox
model["Resource"] = "Models/Core/UnitBox.mesh"; // 360NoScope UnitBox
m_UpdatedOnce = true;
}
+2 -2
View File
@@ -26,8 +26,8 @@ BOOST_AUTO_TEST_CASE(resourceManagerTest)
//configfile without register
//check so output says "EE failed to load: type not registered..."
auto m_ScreenQuadNoRegister = ResourceManager::Load<Model>("Models/Core/ScreenQuad.obj"); // 360NoScope ScreenQuad
BOOST_CHECK(!ResourceManager::IsResourceLoaded("Model", "Models/Core/ScreenQuad.obj"));
auto m_ScreenQuadNoRegister = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh"); // 360NoScope ScreenQuad
BOOST_CHECK(!ResourceManager::IsResourceLoaded("Model", "Models/Core/ScreenQuad.mesh"));
//there is no error feedback to check if you try to release the wrong resources - hence that cant be tested either
}