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

test pr #5

Closed
wants to merge 17 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
codecov:
notify:
require_ci_to_pass: no
5 changes: 4 additions & 1 deletion cmake/modules/CodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ function(coverage_lcov_merge_files)
endfunction()

function(add_coverage_upload_target_codecov_io)
cmake_parse_arguments(CU "" "GITSHA1;GITBRANCH;NAME" "" ${ARGN})
cmake_parse_arguments(CU "" "GITSHA1;GITBRANCH;NAME;YAMLPATH" "" ${ARGN})
set(CAPTURE_FILES "${LCOV_DATA_PATH_INIT}/all_targets.info.upload" "${LCOV_DATA_PATH_CAPTURE}/all_targets.info.upload")

find_program(CURL_BIN curl)
Expand Down Expand Up @@ -443,6 +443,9 @@ function(add_coverage_upload_target_codecov_io)
if(CU_NAME)
list(APPEND EXTRA_ARGS -n "${CU_NAME}")
endif()
if(CU_YAMLPATH)
list(APPEND EXTRA_ARGS -y "${CU_YAMLPATH}")
endif()
foreach(CAPTURE_FILE ${CAPTURE_FILES})
list(APPEND EXTRA_ARGS -f "${CAPTURE_FILE}")
endforeach()
Expand Down
1 change: 1 addition & 0 deletions cmake_configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ if(TEST_COVERAGE)
GITSHA1 "${GIT_SHA1}"
GITBRANCH "${GIT_BRANCH}"
NAME "${CODECOV_NAME}"
YAMLPATH "${PROJECT_SOURCE_DIR}/.codecov.yml"
)
endif()

Expand Down
5 changes: 1 addition & 4 deletions rwcore/data/Clump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@

#include <glm/gtc/matrix_transform.hpp>

Geometry::Geometry() : EBO(0), flags(0) {
}

Geometry::~Geometry() {
if (EBO) {
if (EBO != 0u) {
glDeleteBuffers(1, &EBO);
}
}
Expand Down
8 changes: 4 additions & 4 deletions rwcore/data/Clump.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,20 @@ struct Geometry {
DrawBuffer dbuff;
GeometryBuffer gbuff;

GLuint EBO;
GLuint EBO = 0u;

RW::BSGeometryBounds geometryBounds;

uint32_t clumpNum;
uint32_t clumpNum = 0u;

FaceType facetype;

uint32_t flags;
uint32_t flags = 0u;

std::vector<Material> materials;
std::vector<SubGeometry> subgeom;

Geometry();
Geometry() = default;
~Geometry();
};

Expand Down
16 changes: 9 additions & 7 deletions rwcore/fonts/Unicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ size_t unicode_to_utf8(unicode_t unicode, char c[4]) {
if (unicode < 0x80) { // 7 bits
c[0] = static_cast<char>(unicode);
return 1;
} else if (unicode < 0x800) { // 11 bits
}
if (unicode < 0x800) { // 11 bits
c[0] = static_cast<char>(0xc0 | (unicode >> 6));
c[1] = static_cast<char>(0x80 | (unicode & 0x3f));
return 2;
} else if (unicode < 0x10000) { // 16 bits
}
if (unicode < 0x10000) { // 16 bits
c[0] = static_cast<char>(0xe0 | (unicode >> 12));
c[1] = static_cast<char>(0x80 | ((unicode >> 6) & 0x3f));
c[2] = static_cast<char>(0x80 | (unicode & 0x3f));
return 3;
} else if (unicode < 0x110000) { // 21 bits
}
if (unicode < 0x110000) { // 21 bits
c[0] = static_cast<char>(0xf0 | (unicode >> 18));
c[1] = static_cast<char>(0x80 | ((unicode >> 12) & 0x3f));
c[2] = static_cast<char>(0x80 | ((unicode >> 6) & 0x3f));
c[3] = static_cast<char>(0x80 | (unicode & 0x3f));
return 4;
} else {
return unicode_to_utf8(UnicodeValue::UNICODE_REPLACEMENT_CHARACTER, c);
}
return unicode_to_utf8(UnicodeValue::UNICODE_REPLACEMENT_CHARACTER, c);
}

Utf8UnicodeIterator::Utf8UnicodeIterator(std::istream &is) : m_is(&is), m_finished(false) {
Expand All @@ -36,7 +38,7 @@ void Utf8UnicodeIterator::next_unicode() {
m_finished = true;
return;
}
char cc = static_cast<char>(c);
auto cc = static_cast<char>(c);
unicode_t unicode;
unsigned nb_bytes;
if ((cc & 0x80) == 0x00) {
Expand Down Expand Up @@ -102,6 +104,6 @@ Utf8UnicodeIterator Utf8UnicodeIteratorWrapper::end() {
return Utf8UnicodeIterator();
}

bool Utf8UnicodeIterator::operator !=(const Utf8UnicodeIterator &) {
bool Utf8UnicodeIterator::operator!=(const Utf8UnicodeIterator & /*unused*/) {
return good();
}
2 changes: 1 addition & 1 deletion rwcore/fonts/Unicode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Utf8UnicodeIterator {
/**
* @brief m_unicode Current unicode point.
*/
unicode_t m_unicode;
unicode_t m_unicode = 0;

/**
* @brief next_unicode Move to the next unicode point.
Expand Down
7 changes: 2 additions & 5 deletions rwcore/gl/DrawBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
#include <gl/gl_core_3_3.h>
#include <gl/GeometryBuffer.hpp>

DrawBuffer::DrawBuffer() : vao(0) {
}

DrawBuffer::~DrawBuffer() {
if (vao) {
if (vao != 0u) {
glDeleteVertexArrays(1, &vao);
}
}

void DrawBuffer::addGeometry(GeometryBuffer* gbuff) {
if (vao == 0) {
if (vao == 0u) {
glGenVertexArrays(1, &vao);
}

Expand Down
6 changes: 3 additions & 3 deletions rwcore/gl/DrawBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class GeometryBuffer;
* DrawBuffer stores VAO state
*/
class DrawBuffer {
GLuint vao;
GLuint vao = 0u;

GLenum facetype;
GLenum facetype{};

public:
DrawBuffer();
DrawBuffer() = default;
~DrawBuffer();

GLuint getVAOName() const {
Expand Down
34 changes: 17 additions & 17 deletions rwcore/loaders/LoaderDFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <algorithm>
#include <cctype>
#include <cstdint>
#include <cstring>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <numeric>

Expand Down Expand Up @@ -38,9 +38,9 @@ enum DFFChunks {
// These structs are used to interpret raw bytes from the stream.
/// @todo worry about endianness.

typedef glm::vec3 BSTVector3;
typedef glm::mat3 BSTMatrix;
typedef glm::i8vec4 BSTColour;
using BSTVector3 = glm::vec3;
using BSTMatrix = glm::mat3;
using BSTColour = glm::i8vec4;

struct RWBSFrame {
BSTMatrix rotation;
Expand Down Expand Up @@ -125,7 +125,7 @@ LoaderDFF::GeometryList LoaderDFF::readGeometryList(const RWBStream &stream) {

char *headerPtr = listStream.getCursor();

unsigned int numGeometries = bit_cast<std::uint32_t>(*headerPtr);
auto numGeometries = bit_cast<std::uint32_t>(*headerPtr);
headerPtr += sizeof(std::uint32_t);

std::vector<GeometryPtr> geometrylist;
Expand Down Expand Up @@ -165,9 +165,9 @@ GeometryPtr LoaderDFF::readGeometry(const RWBStream &stream) {
/*unsigned short moreFlags = bit_cast<std::uint8_t>(*headerPtr);*/
headerPtr += sizeof(std::uint8_t);

unsigned int numTris = bit_cast<std::uint32_t>(*headerPtr);
auto numTris = bit_cast<std::uint32_t>(*headerPtr);
headerPtr += sizeof(std::uint32_t);
unsigned int numVerts = bit_cast<std::uint32_t>(*headerPtr);
auto numVerts = bit_cast<std::uint32_t>(*headerPtr);
headerPtr += sizeof(std::uint32_t);

/*unsigned int numFrames = bit_cast<std::uint32_t>(*headerPtr);*/
Expand Down Expand Up @@ -279,12 +279,12 @@ void LoaderDFF::readMaterialList(const GeometryPtr &geom, const RWBStream &strea
throw DFFLoaderException("MaterialList missing struct chunk");
}

unsigned int numMaterials = bit_cast<std::uint32_t>(*listStream.getCursor());
auto numMaterials = bit_cast<std::uint32_t>(*listStream.getCursor());

geom->materials.reserve(numMaterials);

RWBStream::ChunkID chunkID;
while ((chunkID = listStream.getNextChunk())) {
while ((chunkID = listStream.getNextChunk()) != 0u) {
switch (chunkID) {
case CHUNK_MATERIAL:
readMaterial(geom, listStream);
Expand Down Expand Up @@ -328,7 +328,7 @@ void LoaderDFF::readMaterial(const GeometryPtr &geom, const RWBStream &stream) {
material.flags = 0;

RWBStream::ChunkID chunkID;
while ((chunkID = materialStream.getNextChunk())) {
while ((chunkID = materialStream.getNextChunk()) != 0u) {
switch (chunkID) {
case CHUNK_TEXTURE:
readTexture(material, materialStream);
Expand Down Expand Up @@ -373,7 +373,7 @@ void LoaderDFF::readGeometryExtension(const GeometryPtr &geom,
auto extStream = stream.getInnerStream();

RWBStream::ChunkID chunkID;
while ((chunkID = extStream.getNextChunk())) {
while ((chunkID = extStream.getNextChunk()) != 0u) {
switch (chunkID) {
case CHUNK_BINMESHPLG:
readBinMeshPLG(geom, extStream);
Expand All @@ -390,7 +390,7 @@ void LoaderDFF::readBinMeshPLG(const GeometryPtr &geom, const RWBStream &stream)
geom->facetype = static_cast<Geometry::FaceType>(bit_cast<std::uint32_t>(*data));
data += sizeof(std::uint32_t);

unsigned int numSplits = bit_cast<std::uint32_t>(*data);
auto numSplits = bit_cast<std::uint32_t>(*data);
data += sizeof(std::uint32_t);

// Number of triangles.
Expand Down Expand Up @@ -429,13 +429,13 @@ AtomicPtr LoaderDFF::readAtomic(FrameList &framelist,
}

auto data = atomicStream.getCursor();
std::uint32_t frame = bit_cast<std::uint32_t>(*data);
auto frame = bit_cast<std::uint32_t>(*data);
data += sizeof(std::uint32_t);

std::uint32_t geometry = bit_cast<std::uint32_t>(*data);
auto geometry = bit_cast<std::uint32_t>(*data);
data += sizeof(std::uint32_t);

std::uint32_t flags = bit_cast<std::uint32_t>(*data);
auto flags = bit_cast<std::uint32_t>(*data);

// Verify the atomic's particulars
RW_CHECK(frame < framelist.size(), "atomic frame " << frame
Expand Down Expand Up @@ -473,15 +473,15 @@ ClumpPtr LoaderDFF::loadFromMemory(const FileContentsInfo& file) {
}

// There is only one value in the struct section.
std::uint32_t numAtomics = bit_cast<std::uint32_t>(*rootStream.getCursor());
auto numAtomics = bit_cast<std::uint32_t>(*rootStream.getCursor());
RW_UNUSED(numAtomics);

GeometryList geometrylist;
FrameList framelist;

// Process everything inside the clump stream.
RWBStream::ChunkID chunkID;
while ((chunkID = modelStream.getNextChunk())) {
while ((chunkID = modelStream.getNextChunk()) != 0u) {
switch (chunkID) {
case CHUNK_FRAMELIST:
framelist = readFrameList(modelStream);
Expand Down
Loading