Fixes #66 warnings
This commit is contained in:
@@ -81,7 +81,7 @@ class ComponentWrapperFactory
|
||||
{
|
||||
public:
|
||||
ComponentWrapperFactory() = default;
|
||||
ComponentWrapperFactory(std::string componentTypeName, std::size_t allocation = 0)
|
||||
ComponentWrapperFactory(std::string componentTypeName, unsigned int allocation = 0)
|
||||
{
|
||||
m_ComponentInfo.Name = componentTypeName;
|
||||
m_ComponentInfo.Meta->Allocation = allocation;
|
||||
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
~EntityFile();
|
||||
|
||||
public:
|
||||
static std::size_t GetTypeStride(std::string typeName);
|
||||
static unsigned int GetTypeStride(std::string typeName);
|
||||
static void WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes);
|
||||
static void WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ enum class FileWatcher::FileEventFlags
|
||||
};
|
||||
|
||||
inline FileWatcher::FileEventFlags operator|(FileWatcher::FileEventFlags a, FileWatcher::FileEventFlags b) { return static_cast<FileWatcher::FileEventFlags>(static_cast<int>(a) | static_cast<int>(b)); }
|
||||
inline bool operator&(FileWatcher::FileEventFlags a, FileWatcher::FileEventFlags b) { return static_cast<int>(a)& static_cast<int>(b); }
|
||||
inline bool operator&(FileWatcher::FileEventFlags a, FileWatcher::FileEventFlags b) { return (static_cast<int>(a) & static_cast<int>(b)) != 0; }
|
||||
|
||||
class FileWatcher::Worker
|
||||
{
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
private:
|
||||
struct FileInfo
|
||||
{
|
||||
int Size;
|
||||
std::size_t Size;
|
||||
std::time_t Timestamp;
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
m_SpeedMultiplier = m_Config->Get<float>("Editor.CameraSpeed", 3.f);
|
||||
}
|
||||
|
||||
virtual const glm::vec3 Movement() const override { return m_Movement * m_SpeedMultiplier; }
|
||||
virtual const glm::vec3 Movement() const override { return m_Movement * static_cast<float>(m_SpeedMultiplier); }
|
||||
|
||||
void Enable() { m_Enabled = true; }
|
||||
void Disable() { m_Enabled = false; }
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
protected:
|
||||
ConfigFile* m_Config;
|
||||
bool m_Enabled = false;
|
||||
float m_SpeedMultiplier = 1.f;
|
||||
double m_SpeedMultiplier = 1.f;
|
||||
|
||||
EventRelay<EventContext, Events::MousePress> m_EMousePress;
|
||||
bool OnMousePress(const Events::MousePress& e)
|
||||
@@ -105,7 +105,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
m_SpeedMultiplier += e.DeltaY * (0.1f * m_SpeedMultiplier);
|
||||
m_SpeedMultiplier += e.DeltaY * (0.1 * m_SpeedMultiplier);
|
||||
m_Config->Set("Editor.CameraSpeed", m_SpeedMultiplier);
|
||||
m_Config->SaveToDisk();
|
||||
return true;
|
||||
|
||||
@@ -75,21 +75,21 @@ private:
|
||||
|
||||
|
||||
void ReadMeshFile(std::string filePath);
|
||||
void ReadMeshFileHeader(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadMesh(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadVertices(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadIndices(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadMeshFileHeader(std::size_t& offset, char* fileData);
|
||||
void ReadMesh(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadVertices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadIndices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
|
||||
void ReadMaterialFile(std::string filePath);
|
||||
void ReadMaterials(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadMaterialSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadMaterials(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadMaterialSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
|
||||
void ReadAnimationFile(std::string filePath);
|
||||
void ReadAnimationBindPoses(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadAnimationJoint(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadAnimationClips(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int numberOfClips);
|
||||
void ReadAnimationClipSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int clipIndex);
|
||||
void ReadAnimationKeyFrame(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int numberOfJoints, Skeleton::Animation& animation);
|
||||
void ReadAnimationBindPoses(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadAnimationJoint(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadAnimationClips(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfClips);
|
||||
void ReadAnimationClipSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int clipIndex);
|
||||
void ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfJoints, Skeleton::Animation& animation);
|
||||
|
||||
//void CreateSkeleton(std::vector<std::tuple<std::string, glm::mat4>> &boneInfo, std::map<std::string, int> &boneNameMapping, aiNode* node, int parentID);
|
||||
};
|
||||
|
||||
@@ -40,9 +40,9 @@ void EntityFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
|
||||
reader->setFeature(XMLUni::fgXercesCalculateSrcOfs, true);
|
||||
}
|
||||
|
||||
std::size_t EntityFile::GetTypeStride(std::string typeName)
|
||||
unsigned int EntityFile::GetTypeStride(std::string typeName)
|
||||
{
|
||||
std::map<std::string, size_t> typeStrides{
|
||||
std::map<std::string, unsigned int> typeStrides{
|
||||
{ "bool", sizeof(bool) },
|
||||
{ "int", sizeof(int) },
|
||||
{ "float", sizeof(float) },
|
||||
|
||||
@@ -114,7 +114,7 @@ void EntityFilePreprocessor::parseComponentInfo()
|
||||
std::string baseType = XS::ToString(elementDeclaration->getTypeDefinition()->getBaseType()->getName());
|
||||
|
||||
std::string effectiveType = type;
|
||||
size_t stride = EntityFile::GetTypeStride(type);
|
||||
unsigned int stride = EntityFile::GetTypeStride(type);
|
||||
if (stride == 0) {
|
||||
stride = EntityFile::GetTypeStride(baseType);
|
||||
if (stride == 0) {
|
||||
|
||||
@@ -218,7 +218,7 @@ void InputManager::PublishGamepadAxisIfChanged(int gamepadID, Gamepad::Axis axis
|
||||
void InputManager::PublishGamepadButtonIfChanged(int gamepadID, Gamepad::Button button)
|
||||
{
|
||||
bool currentState = m_CurrentGamepadButtonState[gamepadID][static_cast<int>(button)];
|
||||
float lastState = m_LastGamepadButtonState[gamepadID][static_cast<int>(button)];
|
||||
bool lastState = m_LastGamepadButtonState[gamepadID][static_cast<int>(button)];
|
||||
if (currentState != lastState) {
|
||||
if (currentState == true) {
|
||||
Events::GamepadButtonDown e;
|
||||
|
||||
@@ -69,7 +69,7 @@ void EditorGUI::drawTools()
|
||||
} else if (m_CurrentWidgetSpace == WidgetSpace::Local) {
|
||||
spaceTexture = tryLoadTexture("Textures/Icons/Local.png");
|
||||
}
|
||||
if (ImGui::ImageButton((void*)spaceTexture, ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
|
||||
if (ImGui::ImageButton(reinterpret_cast<void*>(spaceTexture), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
|
||||
toggleWidgetSpace();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
@@ -85,14 +85,14 @@ void EditorGUI::drawTools()
|
||||
|
||||
// Play button
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ImageButton((void*)tryLoadTexture("Textures/Icons/Play.png"), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (!m_Paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
if (ImGui::ImageButton(reinterpret_cast<void*>(tryLoadTexture("Textures/Icons/Play.png")), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (!m_Paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
Events::Resume e;
|
||||
e.World = m_World;
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
// Pause button
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ImageButton((void*)tryLoadTexture("Textures/Icons/Pause.png"), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (m_Paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
if (ImGui::ImageButton(reinterpret_cast<void*>(tryLoadTexture("Textures/Icons/Pause.png")), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (m_Paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
Events::Pause e;
|
||||
e.World = m_World;
|
||||
m_EventBroker->Publish(e);
|
||||
@@ -262,7 +262,7 @@ void EditorGUI::drawComponents(EntityWrapper entity)
|
||||
// Draw combo box
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() - 10.f);
|
||||
int selectedItem = -1;
|
||||
if (ImGui::Combo("", &selectedItem, componentTypes.data(), componentTypes.size(), componentTypes.size())) {
|
||||
if (ImGui::Combo("", &selectedItem, componentTypes.data(), static_cast<int>(componentTypes.size()), static_cast<int>(componentTypes.size()))) {
|
||||
if (selectedItem != -1) {
|
||||
if (m_OnComponentAttach != nullptr) {
|
||||
std::string chosenComponentType(componentTypes.at(selectedItem));
|
||||
@@ -565,7 +565,7 @@ void EditorGUI::createWidgetToolButton(WidgetMode mode)
|
||||
break;
|
||||
}
|
||||
if (ImGui::ImageButton(
|
||||
(void*)texture,
|
||||
reinterpret_cast<void*>(texture),
|
||||
ImVec2(24, 24),
|
||||
ImVec2(0, 1),
|
||||
ImVec2(1, 0),
|
||||
|
||||
@@ -80,9 +80,9 @@ bool EditorRenderSystem::OnSetCamera(Events::SetCamera& e)
|
||||
{
|
||||
ComponentWrapper cTransform = e.CameraEntity["Transform"];
|
||||
ComponentWrapper cCamera = e.CameraEntity["Camera"];
|
||||
m_EditorCamera->SetFOV((double)cCamera["FOV"]);
|
||||
m_EditorCamera->SetNearClip((double)cCamera["NearClip"]);
|
||||
m_EditorCamera->SetFarClip((double)cCamera["FarClip"]);
|
||||
m_EditorCamera->SetFOV(static_cast<float>((double)cCamera["FOV"]));
|
||||
m_EditorCamera->SetNearClip(static_cast<float>((double)cCamera["NearClip"]));
|
||||
m_EditorCamera->SetFarClip(static_cast<float>((double)cCamera["FarClip"]));
|
||||
m_EditorCamera->SetPosition(cTransform["Position"]);
|
||||
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
|
||||
m_CurrentCamera = e.CameraEntity;
|
||||
|
||||
@@ -98,7 +98,7 @@ bool MouseInputHandler::OnMouseMove(const Events::MouseMove& e)
|
||||
Events::InputCommand ic;
|
||||
ic.PlayerID = -1;
|
||||
std::tie(ic.Command, ic.Value) = it->second;
|
||||
ic.Value *= e.DeltaX;
|
||||
ic.Value *= static_cast<float>(e.DeltaX);
|
||||
m_InputProxy->Publish(ic);
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ bool MouseInputHandler::OnMouseMove(const Events::MouseMove& e)
|
||||
Events::InputCommand ic;
|
||||
ic.PlayerID = -1;
|
||||
std::tie(ic.Command, ic.Value) = it->second;
|
||||
ic.Value *= e.DeltaY;
|
||||
ic.Value *= static_cast<float>(e.DeltaY);
|
||||
m_InputProxy->Publish(ic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@ bool ImGuiRenderPass::OnMouseRelease(const Events::MouseRelease& e)
|
||||
bool ImGuiRenderPass::OnMouseMove(const Events::MouseMove& e)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.MousePos.x = e.X;
|
||||
io.MousePos.y = e.Y;
|
||||
io.MousePos.x = static_cast<float>(e.X);
|
||||
io.MousePos.y = static_cast<float>(e.Y);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ bool ImGuiRenderPass::createFontsTexture()
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void*)g_FontTexture;
|
||||
io.Fonts->TexID = reinterpret_cast<void*>(g_FontTexture);
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
@@ -291,7 +291,7 @@ void ImGuiRenderPass::newFrame()
|
||||
io.DisplaySize = ImVec2((float)w, (float)h);
|
||||
io.DisplayFramebufferScale = ImVec2((float)display_w / w, (float)display_h / h);
|
||||
|
||||
io.DeltaTime = g_DeltaTime;
|
||||
io.DeltaTime = static_cast<float>(g_DeltaTime);
|
||||
|
||||
io.KeyCtrl = glfwGetKey(g_Window, GLFW_KEY_LEFT_CONTROL) || glfwGetKey(g_Window, GLFW_KEY_RIGHT_CONTROL);
|
||||
io.KeyShift = glfwGetKey(g_Window, GLFW_KEY_LEFT_SHIFT) || glfwGetKey(g_Window, GLFW_KEY_RIGHT_SHIFT);
|
||||
|
||||
@@ -71,12 +71,12 @@ PNG::PNG(std::string path)
|
||||
png_read_update_info(png_ptr, info_ptr);
|
||||
}
|
||||
|
||||
unsigned int row_bytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
std::size_t row_bytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
this->Data = new unsigned char[height * row_bytes];
|
||||
png_bytep* row_pointers = new png_bytep[height];
|
||||
|
||||
// Point each row to the continuous data array
|
||||
for (int i = 0; i < height; ++i) {
|
||||
for (unsigned int i = 0; i < height; ++i) {
|
||||
// Invert Y for OpenGL
|
||||
row_pointers[height - 1 - i] = this->Data + i * row_bytes;
|
||||
}
|
||||
|
||||
@@ -22,42 +22,42 @@ void RawModelCustom::ReadMeshFile(std::string filePath)
|
||||
if (!in.is_open()) {
|
||||
throw Resource::FailedLoadingException("Open mesh file failed");
|
||||
}
|
||||
unsigned int fileByteSize = in.tellg();
|
||||
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
|
||||
in.seekg(0, std::ios_base::beg);
|
||||
|
||||
fileData = new char[fileByteSize];
|
||||
in.read(fileData, fileByteSize);
|
||||
in.close();
|
||||
|
||||
unsigned int offset = 0;
|
||||
std::size_t offset = 0;
|
||||
if (fileByteSize > 0) {
|
||||
ReadMeshFileHeader(offset, fileData, fileByteSize);
|
||||
ReadMeshFileHeader(offset, fileData);
|
||||
ReadMesh(offset, fileData, fileByteSize);
|
||||
}
|
||||
delete fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMeshFileHeader(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadMeshFileHeader(std::size_t& offset, char* fileData)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
m_Vertices.resize(*(unsigned int*)(fileData + offset));
|
||||
m_Vertices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
|
||||
offset += sizeof(unsigned int);
|
||||
m_Indices.resize(*(unsigned int*)(fileData + offset));
|
||||
m_Indices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
|
||||
offset += sizeof(unsigned int);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMesh(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadMesh(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
ReadVertices(offset, fileData, fileByteSize);
|
||||
ReadIndices(offset, fileData, fileByteSize);
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadVertices(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadVertices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
if (offset + m_Vertices.size() * sizeof(Vertex) > fileByteSize) {
|
||||
if (offset + m_Vertices.size() * sizeof(Vertex) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading vertices failed");
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void RawModelCustom::ReadVertices(unsigned int& offset, char* fileData, unsigned
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadIndices(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadIndices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
if (offset + m_Indices.size() * sizeof(unsigned int) > fileByteSize) {
|
||||
@@ -90,35 +90,36 @@ void RawModelCustom::ReadMaterialFile(std::string filePath)
|
||||
if (!in.is_open()) {
|
||||
throw Resource::FailedLoadingException("Open material file failed");
|
||||
}
|
||||
unsigned int fileByteSize = in.tellg();
|
||||
|
||||
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
|
||||
in.seekg(0, std::ios_base::beg);
|
||||
|
||||
fileData = new char[fileByteSize];
|
||||
in.read(fileData, fileByteSize);
|
||||
in.close();
|
||||
|
||||
unsigned int offset = 0;
|
||||
std::size_t offset = 0;
|
||||
if (fileByteSize > 0) {
|
||||
ReadMaterials(offset, fileData, fileByteSize);
|
||||
}
|
||||
delete fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterials(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadMaterials(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
unsigned int* numMaterials = (unsigned int*)(fileData);
|
||||
MaterialGroups.reserve(*numMaterials);
|
||||
offset += sizeof(unsigned int);
|
||||
|
||||
for (int i = 0; i < *numMaterials; i++) {
|
||||
for (unsigned int i = 0; i < *numMaterials; i++) {
|
||||
ReadMaterialSingle(offset, fileData, fileByteSize);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterialSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadMaterialSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
MaterialGroup newMaterial;
|
||||
|
||||
@@ -210,14 +211,14 @@ void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int fileByteSize = in.tellg();
|
||||
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
|
||||
in.seekg(0, std::ios_base::beg);
|
||||
|
||||
fileData = new char[fileByteSize];
|
||||
in.read(fileData, fileByteSize);
|
||||
in.close();
|
||||
|
||||
unsigned int offset = 0;
|
||||
std::size_t offset = 0;
|
||||
if (fileByteSize > 0) {
|
||||
m_Skeleton = new Skeleton();
|
||||
|
||||
@@ -235,7 +236,7 @@ void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||
delete fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationBindPoses(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadAnimationBindPoses(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
unsigned int* numBones = (unsigned int*)(fileData + offset);
|
||||
@@ -248,7 +249,7 @@ void RawModelCustom::ReadAnimationBindPoses(unsigned int &offset, char* fileData
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationJoint(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadAnimationJoint(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
if (offset + sizeof(unsigned int) > fileByteSize) {
|
||||
@@ -290,14 +291,14 @@ void RawModelCustom::ReadAnimationJoint(unsigned int &offset, char* fileData, un
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationClips(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int numberOfClips)
|
||||
void RawModelCustom::ReadAnimationClips(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfClips)
|
||||
{
|
||||
for (unsigned int i = 0; i < numberOfClips; i++) {
|
||||
ReadAnimationClipSingle(offset, fileData, fileByteSize, i);
|
||||
}
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationClipSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int clipIndex)
|
||||
void RawModelCustom::ReadAnimationClipSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int clipIndex)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
Skeleton::Animation newAnimation;
|
||||
@@ -342,7 +343,7 @@ void RawModelCustom::ReadAnimationClipSingle(unsigned int &offset, char* fileDat
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationKeyFrame(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int nrOfJoints, Skeleton::Animation& animation)
|
||||
void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfJoints, Skeleton::Animation& animation)
|
||||
{
|
||||
Skeleton::Animation::Keyframe newKeyFrame;
|
||||
|
||||
@@ -358,12 +359,12 @@ void RawModelCustom::ReadAnimationKeyFrame(unsigned int &offset, char* fileData,
|
||||
newKeyFrame.Time = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
|
||||
if (offset + sizeof(Skeleton::Animation::Keyframe::BoneProperty) * nrOfJoints> fileByteSize) {
|
||||
if (offset + sizeof(Skeleton::Animation::Keyframe::BoneProperty) * numberOfJoints> fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationKeyFrame joints failed");
|
||||
}
|
||||
|
||||
Skeleton::Animation::Keyframe::BoneProperty newBone;
|
||||
for (unsigned int i = 0; i < nrOfJoints; i++) {
|
||||
for (unsigned int i = 0; i < numberOfJoints; i++) {
|
||||
memcpy(&newBone, (fileData + offset), sizeof(Skeleton::Animation::Keyframe::BoneProperty));
|
||||
offset += sizeof(Skeleton::Animation::Keyframe::BoneProperty);
|
||||
newKeyFrame.BoneProperties[newBone.ID] = newBone;
|
||||
|
||||
@@ -21,7 +21,7 @@ GLuint Shader::CompileShader(GLenum shaderType, std::string fileName)
|
||||
return 0;
|
||||
|
||||
const GLchar* shaderFiles = shaderFile.c_str();
|
||||
const GLint length = shaderFile.length();
|
||||
const GLint length = static_cast<GLint>(shaderFile.length());
|
||||
glShaderSource(shader, 1, &shaderFiles, &length);
|
||||
if (GLERROR("glShaderSource"))
|
||||
return 0;
|
||||
|
||||
@@ -53,11 +53,11 @@ std::vector<glm::mat4> Skeleton::GetFrameBones(const Animation& animation, doubl
|
||||
|
||||
const Animation::Keyframe& currentFrame = animation.Keyframes[currentKeyframeIndex];
|
||||
const Animation::Keyframe& nextFrame = animation.Keyframes[(currentKeyframeIndex + 1) % animation.Keyframes.size()];
|
||||
float alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
double alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
|
||||
//auto animationFrame = Animations[""].Keyframes[frame];
|
||||
std::map<int, glm::mat4> frameBones;
|
||||
AccumulateBoneTransforms(noRootMotion, currentFrame, nextFrame, alpha, frameBones, RootBone, glm::mat4(1));
|
||||
AccumulateBoneTransforms(noRootMotion, currentFrame, nextFrame, static_cast<float>(alpha), frameBones, RootBone, glm::mat4(1));
|
||||
|
||||
std::vector<glm::mat4> finalMatrices;
|
||||
for (auto &kv : frameBones) {
|
||||
|
||||
@@ -64,7 +64,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
std::map<std::string, int> nextPossibleCapturePoint;
|
||||
nextPossibleCapturePoint["Red"] = -1;
|
||||
nextPossibleCapturePoint["Blue"] = -1;
|
||||
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
for (int i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
{
|
||||
if (m_CapturePointNumberToEntityMap[i].HasComponent("Team")) {
|
||||
continue;
|
||||
@@ -93,7 +93,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
|
||||
//reset timers and reset the bool that triggers this
|
||||
if (m_ResetTimers) {
|
||||
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
for (int i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
{
|
||||
ComponentWrapper& capturePoint = m_CapturePointNumberToEntityMap[i]["CapturePoint"];
|
||||
if ((int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Red"] &&
|
||||
|
||||
@@ -30,7 +30,7 @@ EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /
|
||||
if (spawnPoints.size() > 1) {
|
||||
static std::random_device randomDevice;
|
||||
static std::mt19937 randomGenerator(randomDevice());
|
||||
std::uniform_int_distribution<> distribution(0, std::distance(spawnPoints.begin(), spawnPoints.end()) - 1);
|
||||
std::uniform_int_distribution<> distribution(0, static_cast<int>(std::distance(spawnPoints.begin(), spawnPoints.end())) - 1);
|
||||
auto randomSpawnPointIt = spawnPoints.begin();
|
||||
std::advance(randomSpawnPointIt, distribution(randomGenerator));
|
||||
spawnPoint = *randomSpawnPointIt;
|
||||
|
||||
Reference in New Issue
Block a user