Skip to content

Commit

Permalink
Merge pull request #3 from AsulconS/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
AsulconS authored Jun 24, 2022
2 parents 7fe0501 + c08e28c commit 159f3fe
Show file tree
Hide file tree
Showing 33 changed files with 1,595 additions and 405 deletions.
28 changes: 19 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# Folders
.vscode
.VSCodeCounter
other/misc
doc
build
# Root directories to ignore
/[Bb]uild/
/[Dd]oc/
/[Oo]ther/[Mm]isc/

# Files
.priv
# Visual Studio cache directory
.vs/

# Visual Studio Code configuration directory
.vscode/

# Visual Studio Code counter extension directory
.VSCodeCounter/

# Utility files
*.priv
*.bat

# OS generated files
desktop.ini

# Excecutables, pdbs and dlls
# Builds
*.dll
*.lib
*.pdb
*.exe
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ endif()
# Get Source Files
set(HSGIL_SOURCES
external/src/glad/glad.c
src/system/time.cpp
src/system/timer.cpp
src/system/dstr/vector.cpp
src/system/${HSGIL_PLATFORM}/timerPlatform.cpp
src/graphics/gUtils.cpp
src/graphics/mesh.cpp
Expand Down Expand Up @@ -73,15 +71,15 @@ if(HSGIL_BUILD_SHARED)
GLAD_GLAPI_EXPORT
PRIVATE
__STDC_LIB_EXT1__
__HSGIL_COMPILING
__HSGIL_SHARED_LIB
C__HSGIL_COMPILING
C__HSGIL_SHARED_LIB
GLAD_GLAPI_EXPORT_BUILD
)
else()
target_compile_definitions(${HSGIL_LIB_NAME}
PRIVATE
__STDC_LIB_EXT1__
__HSGIL_COMPILING
C__HSGIL_COMPILING
)
endif()
target_include_directories(${HSGIL_LIB_NAME} PRIVATE include)
Expand Down
80 changes: 0 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,3 @@
## What is HSGIL?

HSGIL is an OpenSource Graphics Library written in C++ designed for a simple and handy graphics rendering. It's constantly developing and updating to improve its mechanics and features. This is also aimed at the development of the Spectrum Game Engine.

## Test & Analysis instructions
---
To do this process, you may follow these steps:

1. Install Jenkins and deploy it at localhost.
2. Integrate SonarQube with Jenkins.
3. Check if SonarQube has been successfully integrated (look a the 2 following pictures):

<img src="other/res/test/1.jpg?raw=true" width="75%"><br>

<img src="other/res/test/2.jpg?raw=true" width="75%"><br>

4. Go to Administrar Jenkins / System Configuration (Spanish installation):

<img src="other/res/test/3.jpg?raw=true" width="75%"><br>

5. Create the SonarQube server:

<img src="other/res/test/4.jpg?raw=true" width="75%"><br>

6. At Global Tool Configuration, add a Sonnar Scanner:

<img src="other/res/test/5.jpg?raw=true" width="75%"><br>

7. Now, it's time to configure the Pipeline:
```
pipeline {
agent any
stages {
stage('clonacion') {
steps {
git 'https://github.com/AsulconS/HSGIL.git'
}
}
stage('construccion') {
steps {
sh 'sudo make'
}
}
stage('construccion 2') {
steps {
sh 'sudo make finn'
}
}
stage('SonarQube analysis') {
steps{
sh "pwd"
sh "ls"
script{
def scannerHome = tool 'SonarQube Scanner';
withSonarQubeEnv('Sonar') { // If you have configured more than one global server connection, you can specify its name
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=HSGIL-sonar -Dsonar.sources=./src -Dsonar.language=c++"
}
}
}
}
stage('Tests'){
steps{
sh "sudo make test"
sh "./run_unit_tests"
sh "./run_functional_tests"
}
}
}
}
```

8. Then, we can run the pipeline and check for the results at each stage:

<img src="other/res/test/6.jpg?raw=true" width="75%"><br>

9. Here we are the SonarQube's Results:

<img src="other/res/test/7.jpg?raw=true" width="75%"><br>

<img src="other/res/test/8.jpg?raw=true" width="75%"><br>
5 changes: 4 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ macro(build_cpp_source filename)
add_executable(${filename} ${filename}.cpp)
target_include_directories(${filename} PRIVATE ../include)
target_include_directories(${filename} PRIVATE ../include/HSGIL/external)
target_link_libraries(${filename} LINK_PUBLIC ${HSGIL_LIB_NAME} opengl32)
target_include_directories(${filename} PRIVATE "C:/Program Files (x86)/Visual Leak Detector/include")
target_link_directories(${filename} PRIVATE "C:/Program Files (x86)/Visual Leak Detector/lib/Win64")
target_link_libraries(${filename} LINK_PUBLIC ${HSGIL_LIB_NAME} opengl32 vld)
add_custom_command(TARGET ${filename} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:${HSGIL_LIB_NAME}>
${CMAKE_SOURCE_DIR}/examples
)
endmacro(build_cpp_source)

build_cpp_source(map)
build_cpp_source(finn)
build_cpp_source(ball)
34 changes: 17 additions & 17 deletions examples/ball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ void Ball::generateBallVerticesAndIndices()
// vertex position (x, y, z)
z = zx * cosf(sectorAngle); // r * cos(u) * cos(v)
x = zx * sinf(sectorAngle); // r * cos(u) * sin(v)
m_vertexData.push_back(x);
m_vertexData.push_back(y);
m_vertexData.push_back(z);
m_vertexData->push_back(x);
m_vertexData->push_back(y);
m_vertexData->push_back(z);

// normalized vertex normal (nx, ny, nz)
nx = x * radiusInvLen;
ny = y * radiusInvLen;
nz = z * radiusInvLen;
m_vertexData.push_back(nx);
m_vertexData.push_back(ny);
m_vertexData.push_back(nz);
m_vertexData->push_back(nx);
m_vertexData->push_back(ny);
m_vertexData->push_back(nz);

// 0.0f UV coords
m_vertexData.push_back(0.0f);
m_vertexData.push_back(0.0f);
m_vertexData->push_back(0.0f);
m_vertexData->push_back(0.0f);
}
}

Expand All @@ -77,23 +77,23 @@ void Ball::generateBallVerticesAndIndices()
// k1 => k2 => k1+1
if(i != 0)
{
m_indices.push_back(k1 + j);
m_indices.push_back(k2 + j);
m_indices.push_back(k1 + j + 1);
m_indices->push_back(k1 + j);
m_indices->push_back(k2 + j);
m_indices->push_back(k1 + j + 1);
}
else if(j == m_segmentCount - 1)
{
m_indices.push_back(k1 + j);
m_indices.push_back(k2 + j);
m_indices.push_back(k2 + j + 1);
m_indices->push_back(k1 + j);
m_indices->push_back(k2 + j);
m_indices->push_back(k2 + j + 1);
}

// k1+1 => k2 => k2+1
if(i != (m_ringCount - 1))
{
m_indices.push_back(k1 + j + 1);
m_indices.push_back(k2 + j);
m_indices.push_back(k2 + j + 1);
m_indices->push_back(k1 + j + 1);
m_indices->push_back(k2 + j);
m_indices->push_back(k2 + j + 1);
}
}
}
Expand Down
33 changes: 33 additions & 0 deletions examples/map.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <vld.h>
#include <HSGIL/system/dstr/map.hpp>

#include <iostream>

template <typename T>
void value(T&)
{
std::cout << "lvalue" << std::endl;
}

template <typename T>
void value(T&&)
{
std::cout << "rvalue" << std::endl;
}

template <typename T>
void foo(T&& arg)
{
value(gil::hsgil_forward<T>(arg));
}

int main()
{
int x;
foo(x);
foo(std::move(x));
foo(gil::hsgil_move(x));
foo(4);

return 0;
}
2 changes: 1 addition & 1 deletion include/HSGIL/config/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <cstdint>

#define MAX_PATH_LENGTH 260
#define HSGIL_MAX_PATH_LENGTH 260

namespace gil
{
Expand Down
28 changes: 14 additions & 14 deletions include/HSGIL/config/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@
* Details: Deals with dynamic linking semantics
*/
#if defined(_WIN32) || defined(WIN32) || defined(_MSC_VER)
#define HSGIL_OS_WINDOWS
#define HSGIL_DLL_EXPORT __declspec(dllexport)
#define HSGIL_DLL_IMPORT __declspec(dllimport)
#define CF__HSGIL_OS_WINDOWS
#define CF__HSGIL_DLL_EXPORT __declspec(dllexport)
#define CF__HSGIL_DLL_IMPORT __declspec(dllimport)
#elif defined(__unix__) || defined(linux) || defined(__GNUC__)
#define HSGIL_OS_LINUX
#define HSGIL_DLL_EXPORT __attribute__((visibility("default")))
#define HSGIL_DLL_IMPORT
#define CF__HSGIL_OS_LINUX
#define CF__HSGIL_DLL_EXPORT __attribute__((visibility("default")))
#define CF__HSGIL_DLL_IMPORT
#else
#define HSGIL_OS_UNKNOWN
#define HSGIL_DLL_EXPORT
#define HSGIL_DLL_IMPORT
#pragma warning Unknow semantics for dynamic linking
#define CF__HSGIL_OS_UNKNOWN
#define CF__HSGIL_DLL_EXPORT
#define CF__HSGIL_DLL_IMPORT
#pragma warning Unknown semantics for dynamic linking
#error HSGIL has no support for this OS
#endif

#if defined(__HSGIL_SHARED_LIB)
#if defined(__HSGIL_COMPILING)
#define HSGIL_API HSGIL_DLL_EXPORT
#if defined(C__HSGIL_SHARED_LIB)
#if defined(C__HSGIL_COMPILING)
#define HSGIL_API CF__HSGIL_DLL_EXPORT
#else
#define HSGIL_API HSGIL_DLL_IMPORT
#define HSGIL_API CF__HSGIL_DLL_IMPORT
#endif
#else
#define HSGIL_API
Expand Down
65 changes: 65 additions & 0 deletions include/HSGIL/exception/system/dstrException.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/********************************************************************************
* *
* HSGIL - Handy Scalable Graphics Integration Library *
* Copyright (c) 2019-2021 Adrian Bedregal *
* *
* This software is provided 'as-is', without any express or implied *
* warranty. In no event will the authors be held liable for any damages *
* arising from the use of this software. *
* *
* Permission is granted to anyone to use this software for any purpose, *
* including commercial applications, and to alter it and redistribute it *
* freely, subject to the following restrictions: *
* *
* 1. The origin of this software must not be misrepresented; you must not *
* claim that you wrote the original software. If you use this software *
* in a product, an acknowledgment in the product documentation would be *
* appreciated but is not required. *
* 2. Altered source versions must be plainly marked as such, and must not be *
* misrepresented as being the original software. *
* 3. This notice may not be removed or altered from any source distribution. *
* *
********************************************************************************/

#ifndef HSGIL_DSTR_EXCEPTION_HPP
#define HSGIL_DSTR_EXCEPTION_HPP

#include <HSGIL/exception/genericException.hpp>

namespace gil
{
/**
* @brief DStr Generic Exception
*
*/
class DStrException : public GenericException
{
public:
/**
* @brief Overridden method to know why exactly the DStr Exception was thrown
*
* @return const char*
*/
virtual const char* what() const throw() override;
};

/**
* @brief Window Exception that is thrown when a Window can't initialize
*
*/
class KeyNotFoundException : public DStrException
{
public:
/**
* @brief Overridden method to know why exactly the Exception was thrown
*
* @return const char*
*/
virtual const char* what() const throw() override;
};

} // namespace gil

#include <HSGIL/exception/system/dstrException.inl>

#endif // HSGIL_DSTR_EXCEPTION_HPP
Loading

0 comments on commit 159f3fe

Please sign in to comment.