Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed cmake warnings and comment #2

Merged
merged 1 commit into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ set(BUILD_SHARED_LIBS TRUE)
find_package(PkgConfig REQUIRED)

# OpenGL
cmake_policy(SET CMP0072 NEW)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
set(OPENGL_LIBRARY ${OPENGL_opengl_LIBRARY})
Expand Down
132 changes: 132 additions & 0 deletions dep/Copyright.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
CMake - Cross Platform Makefile Generator
Copyright 2000-2021 Kitware, Inc. and Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of Kitware, Inc. nor the names of Contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

------------------------------------------------------------------------------

The following individuals and institutions are among the Contributors:

* Aaron C. Meadows <[email protected]>
* Adriaan de Groot <[email protected]>
* Aleksey Avdeev <[email protected]>
* Alexander Neundorf <[email protected]>
* Alexander Smorkalov <[email protected]>
* Alexey Sokolov <[email protected]>
* Alex Merry <[email protected]>
* Alex Turbov <[email protected]>
* Andreas Pakulat <[email protected]>
* Andreas Schneider <[email protected]>
* André Rigland Brodtkorb <[email protected]>
* Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
* Benjamin Eikel
* Bjoern Ricks <[email protected]>
* Brad Hards <[email protected]>
* Christopher Harvey
* Christoph Grüninger <[email protected]>
* Clement Creusot <[email protected]>
* Daniel Blezek <[email protected]>
* Daniel Pfeifer <[email protected]>
* Enrico Scholz <[email protected]>
* Eran Ifrah <[email protected]>
* Esben Mose Hansen, Ange Optimization ApS
* Geoffrey Viola <[email protected]>
* Google Inc
* Gregor Jasny
* Helio Chissini de Castro <[email protected]>
* Ilya Lavrenov <[email protected]>
* Insight Software Consortium <insightsoftwareconsortium.org>
* Jan Woetzel
* Julien Schueller
* Kelly Thompson <[email protected]>
* Laurent Montel <[email protected]>
* Konstantin Podsvirov <[email protected]>
* Mario Bensi <[email protected]>
* Martin Gräßlin <[email protected]>
* Mathieu Malaterre <[email protected]>
* Matthaeus G. Chajdas
* Matthias Kretz <[email protected]>
* Matthias Maennich <[email protected]>
* Michael Hirsch, Ph.D. <www.scivision.co>
* Michael Stürmer
* Miguel A. Figueroa-Villanueva
* Mike Jackson
* Mike McQuaid <[email protected]>
* Nicolas Bock <[email protected]>
* Nicolas Despres <[email protected]>
* Nikita Krupen'ko <[email protected]>
* NVIDIA Corporation <www.nvidia.com>
* OpenGamma Ltd. <opengamma.com>
* Patrick Stotko <[email protected]>
* Per Øyvind Karlsen <[email protected]>
* Peter Collingbourne <[email protected]>
* Petr Gotthard <[email protected]>
* Philip Lowman <[email protected]>
* Philippe Proulx <[email protected]>
* Raffi Enficiaud, Max Planck Society
* Raumfeld <raumfeld.com>
* Roger Leigh <[email protected]>
* Rolf Eike Beer <[email protected]>
* Roman Donchenko <[email protected]>
* Roman Kharitonov <[email protected]>
* Ruslan Baratov
* Sebastian Holtermann <[email protected]>
* Stephen Kelly <[email protected]>
* Sylvain Joubert <[email protected]>
* The Qt Company Ltd.
* Thomas Sondergaard <[email protected]>
* Tobias Hunger <[email protected]>
* Todd Gamblin <[email protected]>
* Tristan Carel
* University of Dundee
* Vadim Zhukov
* Will Dicharry <[email protected]>

See version control history for details of individual contributions.

The above copyright and license notice applies to distributions of
CMake in source and binary form. Third-party software packages supplied
with CMake under compatible licenses provide their own copyright notices
documented in corresponding subdirectories or source files.

------------------------------------------------------------------------------

CMake was initially developed by Kitware with the following sponsorship:

* National Library of Medicine at the National Institutes of Health
as part of the Insight Segmentation and Registration Toolkit (ITK).

* US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
Visualization Initiative.

* National Alliance for Medical Image Computing (NAMIC) is funded by the
National Institutes of Health through the NIH Roadmap for Medical Research,
Grant U54 EB005149.

* Kitware, Inc.
5 changes: 2 additions & 3 deletions dep/FindSDL2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
VERSION_VAR SDL2_VERSION_STRING)

VERSION_VAR SDL2_VERSION_STRING)
56 changes: 31 additions & 25 deletions engine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ ce::Vertex vertices[] = {
};
// clang-format on

/* 7-4
/*
7-4
6-5
3-0
2-1
3-0
2-1
*/
unsigned vertexCount = sizeof(vertices) / sizeof(ce::Vertex);
// 7<=>5
Expand Down Expand Up @@ -104,9 +105,9 @@ int main(int argc, char* argv[]) {

float mouseSensitivity = 0.1f;
ce::Camera* camera = new ce::Camera();
//Seperate so i can put in a player class later
// Seperate so i can put in a player class later
glm::vec3 cameraVelocity(0.0f);
camera->getTransform()->setPosition(0.0f,0.0f,3.0f);
camera->getTransform()->setPosition(0.0f, 0.0f, 3.0f);
camera->getTransform()->setYaw(-90.0f);
/*
* Game Loop
Expand Down Expand Up @@ -136,26 +137,31 @@ int main(int argc, char* argv[]) {
float cameraSpeed = 2.5f * time->getDeltaTime();
if (event.key.keysym.sym == SDLK_w)
cameraVelocity.z = cameraSpeed;
else if (event.key.keysym.sym == SDLK_s)
cameraVelocity.z =-cameraSpeed;
else if (event.key.keysym.sym == SDLK_s)
cameraVelocity.z = -cameraSpeed;
if (event.key.keysym.sym == SDLK_a)
cameraVelocity.x=-cameraSpeed;
cameraVelocity.x = -cameraSpeed;
else if (event.key.keysym.sym == SDLK_d)
cameraVelocity.x=cameraSpeed;
cameraVelocity.x = cameraSpeed;
if (event.key.keysym.sym == SDLK_SPACE)
cameraVelocity.y=cameraSpeed;
cameraVelocity.y = cameraSpeed;
else if (event.key.keysym.sym == SDLK_LSHIFT)
cameraVelocity.y=-cameraSpeed;
if(event.key.keysym.sym == SDLK_ESCAPE)
cameraVelocity.y = -cameraSpeed;
if (event.key.keysym.sym == SDLK_ESCAPE)
window->setMouseVisibility(true);
break;
}
case SDL_KEYUP: {
if ((event.key.keysym.sym == SDLK_w&&cameraVelocity.z>0)||(event.key.keysym.sym == SDLK_s&&cameraVelocity.z<0))
if ((event.key.keysym.sym == SDLK_w && cameraVelocity.z > 0) ||
(event.key.keysym.sym == SDLK_s && cameraVelocity.z < 0))
cameraVelocity.z = 0;
if ((event.key.keysym.sym == SDLK_a&&cameraVelocity.x<0)||(event.key.keysym.sym == SDLK_d&&cameraVelocity.x>0))
if ((event.key.keysym.sym == SDLK_a && cameraVelocity.x < 0) ||
(event.key.keysym.sym == SDLK_d && cameraVelocity.x > 0))
cameraVelocity.x = 0;
if ((event.key.keysym.sym == SDLK_SPACE&&cameraVelocity.y>0)||(event.key.keysym.sym == SDLK_LSHIFT&&cameraVelocity.y<0))
if ((event.key.keysym.sym == SDLK_SPACE &&
cameraVelocity.y > 0) ||
(event.key.keysym.sym == SDLK_LSHIFT &&
cameraVelocity.y < 0))
cameraVelocity.y = 0;
break;
}
Expand All @@ -172,25 +178,25 @@ int main(int argc, char* argv[]) {
}
}
}

material->update();

// Transform
transform.roll(25.0f * time->getDeltaTime());
transform.yaw(50.0f * time->getDeltaTime());
transform.pitch(100.0f * time->getDeltaTime());
transform.sendToShader(material->getShader());

// Camera
glm::vec3
cameraFront = camera->getTransform()->getForward(),
cameraRight = camera->getRight(),
cameraUp = ce::Transform::GetGlobalUp();
camera->getTransform()->translate((cameraFront * cameraVelocity.z)+(cameraRight * cameraVelocity.x)+(cameraUp * cameraVelocity.y));
material->getShader()->setMat4("transform.proj",proj);
glm::vec3 cameraFront = camera->getTransform()->getForward(),
cameraRight = camera->getRight(),
cameraUp = ce::Transform::GetGlobalUp();
camera->getTransform()->translate((cameraFront * cameraVelocity.z) +
(cameraRight * cameraVelocity.x) +
(cameraUp * cameraVelocity.y));
material->getShader()->setMat4("transform.proj", proj);
camera->sendToShader(material->getShader());



/* Render */
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Expand Down