add linux support
This commit is contained in:
parent
6f51630bcd
commit
4d84fc1079
|
|
@ -17,7 +17,7 @@
|
|||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
#[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
|
|
@ -361,3 +361,36 @@ MigrationBackup/
|
|||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
intermediate-files/
|
||||
|
||||
.cache/
|
||||
.vscode/
|
||||
*.json
|
||||
*.make
|
||||
Makefile
|
||||
*.sublime-*
|
||||
|
||||
*.vcxproj
|
||||
|
||||
*.sln
|
||||
|
||||
*.vcxproj.filters
|
||||
|
||||
*.code-workspace
|
||||
|
||||
*.o
|
||||
|
||||
*.d
|
||||
|
||||
*.ninja*
|
||||
|
||||
.idea/
|
||||
|
||||
Engine-Core/lib
|
||||
Engine-Core/intermediate-files
|
||||
Editor/bin
|
||||
Editor/intermediate-files
|
||||
Game/bin
|
||||
|
||||
imgui.ini
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) [year] [fullname]
|
||||
Copyright (c) 2025 Joseph Aquino
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
192
Light.cpp
192
Light.cpp
|
|
@ -1,192 +0,0 @@
|
|||
#include "Light.h"
|
||||
|
||||
void Light::draw(sf::RenderWindow& window)
|
||||
{
|
||||
if (hasFlags(Flags::visibility))
|
||||
{
|
||||
window.draw(m_light.data(), m_light.size(), sf::PrimitiveType::TriangleFan);
|
||||
}
|
||||
|
||||
if (hasFlags(Flags::drawRays))
|
||||
{
|
||||
sf::VertexArray tempRay(sf::PrimitiveType::Lines, 2);
|
||||
tempRay[start].position = m_origin;
|
||||
tempRay[start].color = m_rayColor;
|
||||
tempRay[end].color = m_rayColor;
|
||||
|
||||
for (auto& ray : m_rays)
|
||||
{
|
||||
tempRay[end].position = ray.position;
|
||||
window.draw(tempRay);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasFlags(Flags::drawEndPoints))
|
||||
{
|
||||
sf::CircleShape endPoint(5.f, 20u);
|
||||
endPoint.setOrigin({ 5, 5 });
|
||||
endPoint.setFillColor(m_endPointColor);
|
||||
|
||||
for (auto& ray : m_rays)
|
||||
{
|
||||
endPoint.setPosition(ray.position);
|
||||
window.draw(endPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Light::processRays(const std::vector<sf::VertexArray>& polygons)
|
||||
{
|
||||
m_light[0].position = m_origin;
|
||||
if (m_center and m_offset)
|
||||
{
|
||||
constructPartialLight(polygons);
|
||||
}
|
||||
else
|
||||
{
|
||||
constructFullLight(polygons);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Light::constructFullLight(const std::vector<sf::VertexArray>& polygons)
|
||||
{
|
||||
createAndSortRays(polygons);
|
||||
|
||||
calculateIntersects(polygons);
|
||||
|
||||
for (auto& ray : m_rays)
|
||||
{
|
||||
m_light.emplace_back(ray);
|
||||
}
|
||||
|
||||
m_light.emplace_back(m_rays.front());//fully connect the triangle fan
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Light::constructPartialLight(const std::vector<sf::VertexArray>& polygons)
|
||||
{
|
||||
createAndSortRays(polygons, m_center.value() - m_offset.value(), m_center.value() + m_offset.value());
|
||||
|
||||
calculateIntersects(polygons);
|
||||
|
||||
for (auto& ray : m_rays)
|
||||
{
|
||||
m_light.emplace_back(ray);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Light::createAndSortRays(const std::vector<sf::VertexArray>& polygons)
|
||||
{
|
||||
|
||||
if (not hasFlags(Flags::infiniteLength))
|
||||
{
|
||||
if (m_rayCount > 0)
|
||||
{
|
||||
float angleIncrement = 360.f / (float)m_rayCount;
|
||||
for (int i = 0; i < m_rayCount; i++) m_rays.emplace_back(sf::Vertex{ constructVector( m_origin, sf::degrees(angleIncrement * i), m_rayLength ), m_lightColor });
|
||||
}
|
||||
}
|
||||
|
||||
sf::Angle angle;
|
||||
const float infiniteLength = 5000.f * hasFlags(Flags::infiniteLength);
|
||||
|
||||
for (auto& poly : polygons)
|
||||
{
|
||||
for (std::size_t i = 0; i < poly.getVertexCount() - 1; i++)
|
||||
{
|
||||
if (hasFlags(Flags::infiniteLength) ? false : distanceBetween(m_origin, poly[i].position) >= m_rayLength) continue;
|
||||
|
||||
angle = sf::radians(std::atan2f(poly[i].position.y - m_origin.y, poly[i].position.x - m_origin.x));
|
||||
|
||||
m_rays.emplace_back(sf::Vertex{ poly[i].position, m_lightColor });
|
||||
m_rays.emplace_back(sf::Vertex{ constructVector( m_origin, angle + sf::radians(.00001f), m_rayLength + infiniteLength), m_lightColor });
|
||||
m_rays.emplace_back(sf::Vertex{ constructVector( m_origin, angle - sf::radians(.00001f), m_rayLength + infiniteLength), m_lightColor });
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(m_rays.begin(), m_rays.end(), [&](const auto& lhs, const auto& rhs) { return (lhs.position - m_origin).angle().wrapUnsigned().asRadians() < (rhs.position - m_origin).angle().wrapUnsigned().asRadians(); });
|
||||
}
|
||||
|
||||
// overload for bounded light
|
||||
void Light::createAndSortRays(const std::vector<sf::VertexArray>& polygons, sf::Angle lowerAngleBounds, sf::Angle upperAngleBounds)
|
||||
{
|
||||
const float infiniteLength = 5000.f * hasFlags(Flags::infiniteLength);
|
||||
sf::Vertex lowerBound{ constructVector( m_origin, lowerAngleBounds, m_rayLength + infiniteLength), m_lightColor };
|
||||
sf::Vertex upperBound{ constructVector( m_origin, upperAngleBounds, m_rayLength + infiniteLength), m_lightColor };
|
||||
auto lowerBoundVector = lowerBound.position - m_origin;
|
||||
auto upperBoundVector = upperBound.position - m_origin;
|
||||
|
||||
if (not hasFlags(Flags::infiniteLength))
|
||||
{
|
||||
sf::Vertex temp;
|
||||
float angleIncrement = 360.f / (float)m_rayCount;
|
||||
for (int i = 0; i < m_rayCount; i++)
|
||||
{
|
||||
temp = sf::Vertex{ constructVector(m_origin, sf::degrees(angleIncrement * i), m_rayLength), m_lightColor };
|
||||
|
||||
if (withinBounds(temp.position - m_origin, lowerBoundVector, upperBoundVector)) m_rays.emplace_back(temp);
|
||||
}
|
||||
}
|
||||
|
||||
sf::Angle angle;
|
||||
|
||||
for (auto& poly : polygons)
|
||||
{
|
||||
for (std::size_t i = 0; i < poly.getVertexCount() - 1; i++)
|
||||
{
|
||||
if (poly[i].position == m_origin) continue;// cannot pass zero vector to sf::Vector2::angleTo()
|
||||
|
||||
if (hasFlags(Flags::infiniteLength) ? false : distanceBetween(m_origin, poly[i].position) >= m_rayLength) continue;
|
||||
|
||||
if (not withinBounds(poly[i].position - m_origin, lowerBoundVector, upperBoundVector)) continue;
|
||||
|
||||
angle = sf::radians(std::atan2f(poly[i].position.y - m_origin.y, poly[i].position.x - m_origin.x));
|
||||
|
||||
m_rays.emplace_back(sf::Vertex{ poly[i].position, m_lightColor });
|
||||
m_rays.emplace_back(sf::Vertex{ constructVector( m_origin, angle + sf::radians(.00001f), m_rayLength + infiniteLength), m_lightColor });
|
||||
m_rays.emplace_back(sf::Vertex{ constructVector( m_origin, angle - sf::radians(.00001f), m_rayLength + infiniteLength), m_lightColor });
|
||||
}
|
||||
}
|
||||
|
||||
m_rays.emplace_back(lowerBound);
|
||||
m_rays.emplace_back(upperBound);
|
||||
|
||||
std::sort(m_rays.begin(), m_rays.end(), [&](const auto& lhs, const auto& rhs) { return (lhs.position - m_origin).angleTo(upperBoundVector).wrapUnsigned().asRadians() < (rhs.position - m_origin).angleTo(upperBoundVector).wrapUnsigned().asRadians(); });
|
||||
}
|
||||
|
||||
void Light::calculateIntersects(const std::vector<sf::VertexArray>& polygons)
|
||||
{
|
||||
std::optional<sf::Vector2f> currentIntersect{};
|
||||
|
||||
for (auto& ray : m_rays)
|
||||
{
|
||||
sf::Vector2f closestIntersection = ray.position;
|
||||
currentIntersect.reset();
|
||||
|
||||
for (auto& poly : polygons)
|
||||
{
|
||||
for (std::size_t i = 1; i <= poly.getVertexCount() - 1; i++)
|
||||
{
|
||||
currentIntersect = lineIntersect({ m_origin, ray.position }, { poly[i - 1].position , poly[i].position });
|
||||
|
||||
if (not currentIntersect) continue;
|
||||
if ((closestIntersection - m_origin).length() < (currentIntersect.value() - m_origin).length()) continue;
|
||||
|
||||
closestIntersection = currentIntersect.value();
|
||||
}
|
||||
}
|
||||
|
||||
ray.position = closestIntersection;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Light::withinBounds(sf::Vector2f point, sf::Vector2f lower, sf::Vector2f upper)
|
||||
{
|
||||
return point.angleTo(upper).wrapUnsigned().asRadians() < (lower).angleTo(upper).wrapUnsigned().asRadians();
|
||||
}
|
||||
117
Light.h
117
Light.h
|
|
@ -1,117 +0,0 @@
|
|||
#pragma once
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <imgui-SFML.h>
|
||||
#include <imgui.h>
|
||||
|
||||
#include "Utility.hpp"
|
||||
|
||||
class Light
|
||||
{
|
||||
public:
|
||||
Light() = default;
|
||||
|
||||
Light(sf::Vector2f origin, bool visible = true)
|
||||
: m_origin(origin)
|
||||
{
|
||||
m_light.push_back(sf::Vertex{ m_origin, m_lightColor});
|
||||
visible ? setFlags(Flags::visibility) : unsetFlags(Flags::visibility);
|
||||
}
|
||||
|
||||
Light(sf::Vector2f origin, sf::Angle center, sf::Angle offset, bool visible = true)
|
||||
: m_center(center)
|
||||
, m_offset(offset)
|
||||
, m_origin(origin)
|
||||
{
|
||||
m_light.push_back(sf::Vertex{ m_origin, m_lightColor });
|
||||
visible ? setFlags(Flags::visibility) : unsetFlags(Flags::visibility);
|
||||
}
|
||||
|
||||
public:
|
||||
enum class Flags
|
||||
{
|
||||
visibility = 1 << 0,
|
||||
infiniteLength = 1 << 1,
|
||||
drawRays = 1 << 2,
|
||||
drawEndPoints = 1 << 3
|
||||
};
|
||||
|
||||
void addAngleBounds(sf::Angle center, sf::Angle offset)
|
||||
{
|
||||
m_center = center;
|
||||
m_offset = offset;
|
||||
}
|
||||
|
||||
void removeAngleBounds()
|
||||
{
|
||||
m_center.reset();
|
||||
m_offset.reset();
|
||||
}
|
||||
|
||||
void setFlags(Flags flags) { m_flags |= (int)flags; }
|
||||
void unsetFlags(Flags flags) { m_flags &= ~(int)flags; }
|
||||
void toggleFlags(Flags flags) { m_flags ^= (int)flags; }
|
||||
bool hasFlags(Flags flags) const { return (m_flags & (int)flags) == (int)flags; }
|
||||
|
||||
void setCenterAngle(sf::Angle center) { m_center = center; }
|
||||
std::optional<sf::Angle> getCenterAngle() const { return m_center; }
|
||||
|
||||
void setOffsetAngle(sf::Angle offset) { m_offset = offset; }
|
||||
std::optional<sf::Angle> getOffsetAngle() const { return m_offset; }
|
||||
|
||||
void setOrigin(sf::Vector2f point) { m_origin = point; }
|
||||
sf::Vector2f getOrigin() const { return m_origin; }
|
||||
|
||||
void setRayCount(int input) { m_rayCount = input; }
|
||||
int getRayCount() const { return m_rayCount; };
|
||||
|
||||
float getRayLength() { return m_rayLength; }
|
||||
void setRayLength(float input) { m_rayLength = input; }
|
||||
|
||||
void draw(sf::RenderWindow& window);
|
||||
|
||||
void clearRays() { m_rays.clear(); m_light.clear(); m_light.push_back(sf::Vertex{ {0.f,0.f}, m_lightColor }); }
|
||||
|
||||
void changeLightColor(sf::Color color) { m_lightColor = color; }
|
||||
void changeEndPointColor(sf::Color color) { m_endPointColor = color; }
|
||||
void changeRayColor(sf::Color color) { m_rayColor = color; }
|
||||
|
||||
void processRays(const std::vector<sf::VertexArray>& polygons);
|
||||
|
||||
private:
|
||||
std::vector<sf::Vertex> m_light{};
|
||||
std::vector<sf::Vertex> m_rays{};
|
||||
std::optional<sf::Angle> m_center{};
|
||||
std::optional<sf::Angle> m_offset{};
|
||||
sf::Vector2f m_origin{};
|
||||
sf::Color m_lightColor{ sf::Color::Yellow };
|
||||
sf::Color m_endPointColor{ sf::Color::Magenta };
|
||||
sf::Color m_rayColor{ sf::Color::Red };
|
||||
|
||||
float m_rayLength{ 500.f };
|
||||
int m_rayCount{ 500 };
|
||||
int m_flags{};
|
||||
|
||||
enum
|
||||
{
|
||||
start,
|
||||
end
|
||||
};//used for sf::VertexArray index
|
||||
|
||||
private:
|
||||
void constructFullLight(const std::vector<sf::VertexArray>& polygons);
|
||||
void constructPartialLight(const std::vector<sf::VertexArray>& polygons);
|
||||
|
||||
void createAndSortRays(const std::vector<sf::VertexArray>& polygons);
|
||||
void createAndSortRays(const std::vector<sf::VertexArray>& polygons, sf::Angle lowerAngleBounds, sf::Angle upperAngleBounds);// for bounded light
|
||||
|
||||
void calculateIntersects(const std::vector<sf::VertexArray>& polygons);
|
||||
|
||||
bool withinBounds(sf::Vector2f point, sf::Vector2f lower, sf::Vector2f upper);
|
||||
};
|
||||
|
||||
77
Random.h
77
Random.h
|
|
@ -1,77 +0,0 @@
|
|||
#pragma once
|
||||
#ifndef RANDOM_MT_H
|
||||
#define RANDOM_MT_H
|
||||
|
||||
#include <chrono>
|
||||
#include <random>
|
||||
|
||||
// This header-only Random namespace implements a self-seeding Mersenne Twister
|
||||
// It can be included into as many code files as needed (The inline keyword avoids ODR violations)
|
||||
// Freely redistributable, courtesy of learncpp.com
|
||||
namespace Random
|
||||
{
|
||||
// Returns a seeded Mersenne Twister
|
||||
// Note: we'd prefer to return a std::seed_seq (to initialize a std::mt19937), but std::seed can't be copied, so it can't be returned by value.
|
||||
// Instead, we'll create a std::mt19937, seed it, and then return the std::mt19937 (which can be copied).
|
||||
inline std::mt19937 generate()
|
||||
{
|
||||
std::random_device rd{};
|
||||
|
||||
// Create seed_seq with clock and 7 random numbers from std::random_device
|
||||
std::seed_seq ss{
|
||||
static_cast<std::seed_seq::result_type>(std::chrono::steady_clock::now().time_since_epoch().count()),
|
||||
rd(), rd(), rd(), rd(), rd(), rd(), rd() };
|
||||
|
||||
return std::mt19937{ ss };
|
||||
}
|
||||
|
||||
// Here's our global std::mt19937 object.
|
||||
// The inline keyword means we only have one global instance for our whole program.
|
||||
inline std::mt19937 mt{ generate() }; // generates a seeded std::mt19937 and copies it into our global object
|
||||
|
||||
// Generate a random int between [min, max] (inclusive)
|
||||
inline int get(int min, int max)
|
||||
{
|
||||
return std::uniform_int_distribution{ min, max }(mt);
|
||||
}
|
||||
|
||||
// The following function templates can be used to generate random numbers
|
||||
// when min and/or max are not type int
|
||||
// See https://www.learncpp.com/cpp-tutorial/function-template-instantiation/
|
||||
// You can ignore these if you don't understand them
|
||||
|
||||
// Generate a random value between [min, max] (inclusive)
|
||||
// * min and max have same type
|
||||
// * Return value has same type as min and max
|
||||
// * Supported types:
|
||||
// * short, int, long, long long
|
||||
// * unsigned short, unsigned int, unsigned long, or unsigned long long
|
||||
// Sample call: Random::get(1L, 6L); // returns long
|
||||
// Sample call: Random::get(1u, 6u); // returns unsigned int
|
||||
template <typename T>
|
||||
T get(T min, T max)
|
||||
{
|
||||
return std::uniform_int_distribution<T>{min, max}(mt);
|
||||
}
|
||||
|
||||
// Generate a random value between [min, max] (inclusive)
|
||||
// * min and max can have different types
|
||||
// * Must explicitly specify return type as template type argument
|
||||
// * min and max will be converted to the return type
|
||||
// Sample call: Random::get<std::size_t>(0, 6); // returns std::size_t
|
||||
// Sample call: Random::get<std::size_t>(0, 6u); // returns std::size_t
|
||||
// Sample call: Random::get<std::int>(0, 6u); // returns int
|
||||
template <typename R, typename S, typename T>
|
||||
R get(S min, T max)
|
||||
{
|
||||
return get<R>(static_cast<R>(min), static_cast<R>(max));
|
||||
}
|
||||
|
||||
template<typename T, typename U, typename V>
|
||||
T getRandomNumber(U min, V max)
|
||||
{
|
||||
return static_cast<T>(get(min, max));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
147
Utility.hpp
147
Utility.hpp
|
|
@ -1,147 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <tuple>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <imgui-SFML.h>
|
||||
#include <imgui.h>
|
||||
|
||||
#include "Random.h"
|
||||
|
||||
|
||||
|
||||
template<typename T, typename U, typename V>
|
||||
inline T getRandomNumber(U min, V max)
|
||||
{
|
||||
return static_cast<T>(Random::get(min, max));
|
||||
}
|
||||
|
||||
template<typename T, typename U, typename V, typename W>
|
||||
inline sf::Color createColor(T r, U g, V b, W a)
|
||||
{
|
||||
return sf::Color(static_cast<std::uint8_t>(r), static_cast<std::uint8_t>(g), static_cast<std::uint8_t>(b), static_cast<std::uint8_t>(a));
|
||||
}
|
||||
|
||||
template<typename T, typename U, typename V>
|
||||
inline sf::Color createColor(T r, U g, V b, std::uint8_t a = 255u)
|
||||
{
|
||||
return sf::Color(static_cast<std::uint8_t>(r), static_cast<std::uint8_t>(g), static_cast<std::uint8_t>(b), a);
|
||||
}
|
||||
|
||||
inline sf::Color getRandomColor()
|
||||
{
|
||||
return sf::Color(getRandomNumber<std::uint8_t>(0u, 255u), getRandomNumber<std::uint8_t>(0u, 255u), getRandomNumber<std::uint8_t>(0u, 255u));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T signage(T in)
|
||||
{
|
||||
T zero{};
|
||||
if (in > zero) return ++zero;
|
||||
if (in < zero) return --zero;
|
||||
return zero;
|
||||
}
|
||||
|
||||
struct LineSegment
|
||||
{
|
||||
sf::Vector2f startPoint{};
|
||||
|
||||
sf::Vector2f endPoint{};
|
||||
};
|
||||
|
||||
struct imguiColor
|
||||
{
|
||||
float r{};
|
||||
float g{};
|
||||
float b{};
|
||||
float a{ 1.f };
|
||||
|
||||
sf::Color asSfColor()
|
||||
{
|
||||
return sf::Color(std::uint8_t(r * 255.f), std::uint8_t(g * 255.f), std::uint8_t(b * 255.f), std::uint8_t(a * 255.f));
|
||||
}
|
||||
};
|
||||
|
||||
inline imguiColor constructImguiColor(sf::Color color)
|
||||
{
|
||||
return imguiColor((float)color.r / 255.f, (float)color.g / 255.f, (float)color.b / 255.f, (float)color.a / 255.f);
|
||||
}
|
||||
|
||||
inline std::optional<sf::Vector2f> lineIntersect(LineSegment first, LineSegment second)
|
||||
{
|
||||
sf::Vector2f firstVector = (first.endPoint - first.startPoint);
|
||||
sf::Vector2f secondVector = (second.endPoint - second.startPoint);
|
||||
|
||||
float lengthCrossProduct = firstVector.cross(secondVector);
|
||||
|
||||
sf::Vector2f fms = second.startPoint - first.startPoint; //first line start point minus second
|
||||
|
||||
float firstScalar = fms.cross(secondVector) / lengthCrossProduct;
|
||||
float secondScalar = fms.cross(firstVector) / lengthCrossProduct;
|
||||
|
||||
if ((firstScalar >= 0 and firstScalar <= 1) and (secondScalar >= 0 and secondScalar <= 1))
|
||||
return sf::Vector2f(first.startPoint.x + (firstScalar * firstVector.x), first.startPoint.y + (firstScalar * firstVector.y));
|
||||
else
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
inline sf::VertexArray constructRectangle(sf::Vector2f center, sf::Vector2f size, sf::Color color = sf::Color::Black)
|
||||
{
|
||||
sf::VertexArray rectangle(sf::PrimitiveType::LineStrip, 5);
|
||||
rectangle[0].color = color;
|
||||
rectangle[1].color = color;
|
||||
rectangle[2].color = color;
|
||||
rectangle[3].color = color;
|
||||
rectangle[4].color = color;
|
||||
|
||||
rectangle[0].position = { center.x - size.x, center.y - size.y };
|
||||
rectangle[1].position = { center.x + size.x, center.y - size.y };
|
||||
rectangle[2].position = { center.x + size.x, center.y + size.y };
|
||||
rectangle[3].position = { center.x - size.x, center.y + size.y };
|
||||
rectangle[4].position = rectangle[0].position;
|
||||
|
||||
return rectangle;
|
||||
}
|
||||
|
||||
inline sf::Vector2f constructVector(sf::Vector2f startPoint, sf::Angle angle, float length)
|
||||
{
|
||||
return { startPoint.x + (length * std::cos(angle.asRadians())), startPoint.y + (length * std::sin(angle.asRadians())) };
|
||||
}
|
||||
|
||||
inline sf::VertexArray constructRandomPolygon(sf::Vector2f center, int vertexLowerBound, int vertexUpperBound, int averageSize, sf::Color color = sf::Color::Black)
|
||||
{
|
||||
std::size_t vertexCount = getRandomNumber<std::size_t>(vertexLowerBound, vertexUpperBound);
|
||||
sf::VertexArray polygon(sf::PrimitiveType::LineStrip, vertexCount);
|
||||
|
||||
float angleIncrement = 360.f / (float)(vertexCount - 1);
|
||||
float angleStart = getRandomNumber<float>(0, 360);
|
||||
|
||||
for (int i = 0; i < vertexCount - 1; i++)
|
||||
{
|
||||
float angleOffset = getRandomNumber<float>(-(90 / (int)vertexCount), (90 / (int)vertexCount));
|
||||
polygon[i].color = color;
|
||||
polygon[i].position = constructVector(center, sf::degrees(angleStart + (angleIncrement * i) + angleOffset), getRandomNumber<float>((averageSize - 50), (averageSize + 50)));
|
||||
}
|
||||
polygon[vertexCount - 1].position = polygon[0].position;
|
||||
polygon[vertexCount - 1].color = color;
|
||||
return polygon;
|
||||
}
|
||||
|
||||
inline float distanceBetween(sf::Vector2f startPoint, sf::Vector2f endPoint)
|
||||
{
|
||||
return sqrtf(powf(endPoint.x - startPoint.x, 2) + powf(endPoint.y - startPoint.y, 2));
|
||||
}
|
||||
|
||||
inline sf::VertexArray constructVertexArray(sf::Shape& shape)
|
||||
{
|
||||
sf::VertexArray result(sf::PrimitiveType::LineStrip);
|
||||
auto& transform = shape.getTransform();
|
||||
|
||||
for (int i = 0; i < shape.getPointCount(); i++)
|
||||
{
|
||||
result.append(sf::Vertex{ transform.transformPoint(shape.getPoint(i)), sf::Color::Black });
|
||||
}
|
||||
|
||||
result.append(result[0]);
|
||||
return result;
|
||||
}
|
||||
278
main.cpp
278
main.cpp
|
|
@ -1,278 +0,0 @@
|
|||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <imgui-SFML.h>
|
||||
#include <imgui.h>
|
||||
|
||||
#include "Utility.hpp"
|
||||
#include "Light.h"
|
||||
|
||||
|
||||
auto window = sf::RenderWindow(sf::VideoMode({ 1920u, 1080u }), "Ray Casting Test");
|
||||
|
||||
Light light;
|
||||
std::vector<sf::VertexArray> polygons;
|
||||
sf::CircleShape circle{};
|
||||
|
||||
sf::Vector2f mousePos{};
|
||||
sf::Vector2f center{ 1920.f / 2.f, 1080.f / 2.f };
|
||||
|
||||
//imGui Variables
|
||||
constexpr int numRaysBounds[2] = { 5, 500 };
|
||||
constexpr float rayLengthBounds[2] = {5.f, 5000.f};
|
||||
constexpr float offsetAngleBounds[2] = { 5.f, 175.f };
|
||||
constexpr int vertexMin{ 3 };
|
||||
constexpr int vertexMax{ 20 };
|
||||
constexpr float rotationSpeedScale{ 3.f };
|
||||
float polySize[2] = { 100.f, 100.f };
|
||||
int numRays{ 500 };
|
||||
int vertexBounds[2] = { 3, 10 };
|
||||
int averageSize{ 100 };
|
||||
float rayLength{ 500.f };
|
||||
imguiColor rayColor = constructImguiColor(sf::Color::Red);
|
||||
imguiColor lightColor = constructImguiColor(sf::Color::Yellow);
|
||||
imguiColor endPointColor = constructImguiColor(sf::Color::Magenta);
|
||||
bool drawRays{ false };
|
||||
bool drawLight{ true };
|
||||
bool drawEndPoints{ false };
|
||||
bool boundedLight{ false };
|
||||
bool infiniteRayLength{ false };
|
||||
float lightCenterAngle{ 0.f };
|
||||
float lightOffsetAngle{ 45.f };
|
||||
|
||||
void GUI();
|
||||
void userInput();
|
||||
void render();
|
||||
|
||||
int main()
|
||||
{
|
||||
//configure light with default imgui vatiables
|
||||
drawRays ? light.setFlags(Light::Flags::drawRays) : light.unsetFlags(Light::Flags::drawRays);
|
||||
drawLight ? light.setFlags(Light::Flags::visibility) : light.unsetFlags(Light::Flags::visibility);
|
||||
boundedLight ? light.addAngleBounds(sf::degrees(lightCenterAngle), sf::degrees(lightOffsetAngle)) : light.removeAngleBounds();
|
||||
drawEndPoints ? light.setFlags(Light::Flags::drawEndPoints) : light.unsetFlags(Light::Flags::drawEndPoints);
|
||||
infiniteRayLength ? light.setFlags(Light::Flags::infiniteLength) : light.unsetFlags(Light::Flags::infiniteLength);
|
||||
|
||||
//sfml setup
|
||||
sf::Clock clock;
|
||||
window.setFramerateLimit(144);
|
||||
if (!ImGui::SFML::Init(window))
|
||||
return -1;
|
||||
|
||||
mousePos = center;
|
||||
|
||||
polygons.emplace_back(constructRectangle(center, center));
|
||||
|
||||
circle.setOrigin({0,0});
|
||||
circle.setPosition(center);
|
||||
circle.setRadius(200.f);
|
||||
circle.setPointCount(30u);
|
||||
polygons.emplace_back(constructVertexArray(circle));
|
||||
|
||||
//main game loop
|
||||
while (window.isOpen())
|
||||
{
|
||||
ImGui::SFML::Update(window, clock.restart());
|
||||
|
||||
light.clearRays();
|
||||
|
||||
userInput();
|
||||
|
||||
GUI();
|
||||
|
||||
light.setOrigin(mousePos);
|
||||
light.processRays(polygons);
|
||||
|
||||
render();
|
||||
|
||||
}
|
||||
|
||||
ImGui::SFML::Shutdown();
|
||||
}
|
||||
|
||||
void GUI()
|
||||
{
|
||||
ImGui::Begin("Config");
|
||||
ImGui::Text("Controls:");
|
||||
ImGui::Indent();
|
||||
ImGui::Text("Right Click: place rectangle at mouse position");
|
||||
ImGui::Text("R: place a randomly sized polygon at mouse position");
|
||||
ImGui::Text("C: clear all polygons");
|
||||
ImGui::Text("Scroll wheel: increase/decrease light direction (if light is bounded)");
|
||||
ImGui::Unindent();
|
||||
if (ImGui::Checkbox("Render rays", &drawRays))
|
||||
{
|
||||
light.toggleFlags(Light::Flags::drawRays);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Checkbox("Render end points", &drawEndPoints))
|
||||
{
|
||||
light.toggleFlags(Light::Flags::drawEndPoints);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Checkbox("Render light", &drawLight))
|
||||
{
|
||||
light.toggleFlags(Light::Flags::visibility);
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Infinite ray length", &infiniteRayLength))
|
||||
{
|
||||
light.toggleFlags(Light::Flags::infiniteLength);
|
||||
}
|
||||
|
||||
if (not infiniteRayLength)
|
||||
{
|
||||
ImGui::SliderInt("number of rays", &numRays, numRaysBounds[0], numRaysBounds[1]);
|
||||
light.setRayCount(numRays);
|
||||
|
||||
if (ImGui::InputFloat("Ray Length", &rayLength))
|
||||
{
|
||||
rayLength = std::clamp(rayLength, rayLengthBounds[0], rayLengthBounds[1]);
|
||||
}
|
||||
light.setRayLength(rayLength);
|
||||
}
|
||||
|
||||
if (drawRays)
|
||||
{
|
||||
ImGui::ColorEdit4("Ray color", &rayColor.r);
|
||||
}
|
||||
|
||||
if (drawLight)
|
||||
{
|
||||
ImGui::ColorEdit4("Light color", &lightColor.r);
|
||||
}
|
||||
|
||||
if (drawEndPoints)
|
||||
{
|
||||
ImGui::ColorEdit4("End point color", &endPointColor.r);
|
||||
}
|
||||
|
||||
light.changeLightColor(lightColor.asSfColor());
|
||||
light.changeEndPointColor(endPointColor.asSfColor());
|
||||
light.changeRayColor(rayColor.asSfColor());
|
||||
|
||||
if(ImGui::Checkbox("Light is bounded", &boundedLight))
|
||||
{
|
||||
boundedLight ? light.addAngleBounds(sf::degrees(lightCenterAngle), sf::degrees(lightOffsetAngle)) : light.removeAngleBounds();
|
||||
}
|
||||
|
||||
if (boundedLight)
|
||||
{
|
||||
ImGui::SliderFloat("Light direction", &lightCenterAngle, 0.f, 359.f, "%.0f", ImGuiSliderFlags_::ImGuiSliderFlags_AlwaysClamp);
|
||||
light.setCenterAngle(sf::degrees(lightCenterAngle));
|
||||
|
||||
ImGui::SliderFloat("Offset size", &lightOffsetAngle, offsetAngleBounds[0], offsetAngleBounds[1], "%.0f", ImGuiSliderFlags_::ImGuiSliderFlags_AlwaysClamp);
|
||||
light.setOffsetAngle(sf::degrees(lightOffsetAngle));
|
||||
}
|
||||
|
||||
ImGui::InputFloat2("rectangle Size (X,Y)", polySize, "%.1f");
|
||||
ImGui::Text("Random polygon config: ");
|
||||
if (ImGui::SliderInt2("vertex count lower/upper bounds", vertexBounds, vertexMin, vertexMax))
|
||||
{
|
||||
if (vertexBounds[0] > vertexBounds[1])
|
||||
vertexBounds[0] = vertexBounds[1];
|
||||
|
||||
if (vertexBounds[1] < vertexBounds[0])
|
||||
vertexBounds[0] = vertexBounds[1];
|
||||
}
|
||||
|
||||
if (ImGui::InputInt("Average size", &averageSize))
|
||||
{
|
||||
if (averageSize < 20)
|
||||
{
|
||||
averageSize = 20;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void userInput()
|
||||
{
|
||||
while (const std::optional event = window.pollEvent())
|
||||
{
|
||||
ImGui::SFML::ProcessEvent(window, *event);
|
||||
|
||||
if (event->is<sf::Event::Closed>())
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
|
||||
if (const auto* buttonPressed = event->getIf<sf::Event::KeyPressed>())
|
||||
{
|
||||
switch (buttonPressed->scancode)
|
||||
{
|
||||
case sf::Keyboard::Scancode::C:
|
||||
polygons.clear();
|
||||
polygons.emplace_back(constructRectangle(center, center));
|
||||
break;
|
||||
|
||||
case sf::Keyboard::Scancode::R:
|
||||
polygons.emplace_back(constructRandomPolygon(mousePos, vertexBounds[0] + 1, vertexBounds[1] + 1, averageSize));
|
||||
break;
|
||||
|
||||
case sf::Keyboard::Scancode::Escape:
|
||||
window.close();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto* mousePressed = event->getIf<sf::Event::MouseButtonPressed>())
|
||||
{
|
||||
switch (mousePressed->button)
|
||||
{
|
||||
case sf::Mouse::Button::Right:
|
||||
polygons.emplace_back(constructRectangle((sf::Vector2f)mousePressed->position, { polySize[0], polySize[1] }, sf::Color::Black));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto* mouseWheelScrolled = event->getIf<sf::Event::MouseWheelScrolled>())
|
||||
{
|
||||
switch (mouseWheelScrolled->wheel)
|
||||
{
|
||||
case sf::Mouse::Wheel::Vertical:
|
||||
if (boundedLight)
|
||||
{
|
||||
lightCenterAngle += mouseWheelScrolled->delta * rotationSpeedScale;
|
||||
if (lightCenterAngle > 359.f) lightCenterAngle = 0.f;
|
||||
if (lightCenterAngle < 0.f) lightCenterAngle = 359.f;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto* mouseMoved = event->getIf<sf::Event::MouseMoved>())
|
||||
{
|
||||
mousePos = (sf::Vector2f)mouseMoved->position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void render()
|
||||
{
|
||||
window.clear(sf::Color::White);
|
||||
|
||||
light.draw(window);
|
||||
|
||||
for (auto& poly : polygons) window.draw(poly);
|
||||
|
||||
ImGui::SFML::Render(window);
|
||||
|
||||
window.display();
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.13.35919.96 d17.13
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ray-casting-demos", "ray-casting-demos.vcxproj", "{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}.Debug|x64.Build.0 = Debug|x64
|
||||
{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}.Debug|x86.Build.0 = Debug|Win32
|
||||
{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}.Release|x64.ActiveCfg = Release|x64
|
||||
{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}.Release|x64.Build.0 = Release|x64
|
||||
{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}.Release|x86.ActiveCfg = Release|Win32
|
||||
{87FCE63B-6FB0-41AF-9DDA-1D3A9D26BA8A}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2124D0EB-5864-4A34-B80A-25A316955369}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{87fce63b-6fb0-41af-9dda-1d3a9d26ba8a}</ProjectGuid>
|
||||
<RootNamespace>ray_casting_demos</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SFML_DIR)\include;$(IMGUI_SFML_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AssemblerOutput>AssemblyCode</AssemblerOutput>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SFML_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>sfml-graphics-d.lib;sfml-system-d.lib;sfml-window-d.lib;sfml-audio-d.lib;sfml-network-d.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(IMGUI_SFML_DIR);$(SFML_DIR)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SFML_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>sfml-graphics.lib;sfml-system.lib;sfml-window.lib;sfml-audio.lib;sfml-network.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui-SFML.cpp" />
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui.cpp" />
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui_draw.cpp" />
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui_tables.cpp" />
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui_widgets.cpp" />
|
||||
<ClCompile Include="Light.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Light.h" />
|
||||
<ClInclude Include="Utility.hpp" />
|
||||
<ClInclude Include="Random.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Imgui-sfml Files">
|
||||
<UniqueIdentifier>{20b9a3b4-eb7c-4baa-be0b-c6e0d295c347}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Classes">
|
||||
<UniqueIdentifier>{fe3c7015-3de6-4e35-adea-c623dcb78c0a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Classes">
|
||||
<UniqueIdentifier>{a5f9e058-615a-4f77-a4a5-50a0c3ab5cd7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui.cpp">
|
||||
<Filter>Source Files\Imgui-sfml Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui_draw.cpp">
|
||||
<Filter>Source Files\Imgui-sfml Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui_tables.cpp">
|
||||
<Filter>Source Files\Imgui-sfml Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui_widgets.cpp">
|
||||
<Filter>Source Files\Imgui-sfml Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\dev\libraries\imgui\imgui-SFML.cpp">
|
||||
<Filter>Source Files\Imgui-sfml Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Light.cpp">
|
||||
<Filter>Source Files\Classes</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Utility.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Random.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Light.h">
|
||||
<Filter>Header Files\Classes</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Reference in New Issue