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

Make rend2 build and work on linux #60

Merged
merged 9 commits into from
May 27, 2018
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
6 changes: 4 additions & 2 deletions codemp/rd-rend2/tr_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_cache.h"
#include <vector>

#include <cmath>

/*

Loads and prepares a map file for scene rendering.
Expand Down Expand Up @@ -3575,7 +3577,7 @@ static std::vector<sprite_t> R_CreateSurfaceSpritesVertexData(
const vec2_t p01 = {p1[0] - p0[0], p1[1] - p0[1]};
const vec2_t p02 = {p2[0] - p0[0], p2[1] - p0[1]};

const float zarea = std::fabsf(p02[0]*p01[1] - p02[1]*p01[0]);
const float zarea = std::fabs(p02[0]*p01[1] - p02[1]*p01[0]);
if ( zarea <= 1.0 )
{
// Triangle's area is too small to consider.
Expand Down Expand Up @@ -3610,7 +3612,7 @@ static std::vector<sprite_t> R_CreateSurfaceSpritesVertexData(
// => y*y = 1.0 - x*x
// => y = -/+sqrt(1.0 - x*x)
float nx = flrand(-1.0f, 1.0f);
float ny = std::sqrtf(1.0f - nx*nx);
float ny = std::sqrt(1.0f - nx*nx);
ny *= irand(0, 1) ? -1 : 1;

VectorSet(sprite.normal, nx, ny, 0.0f);
Expand Down
3 changes: 2 additions & 1 deletion codemp/rd-rend2/tr_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ static qboolean GetGLFunction ( GLFuncType& glFunction, const char *glFunctionSt
return qtrue;
}

static void __stdcall GLimp_OnError(GLenum source, GLenum type, GLuint id, GLenum severity,

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the extra empty line be removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ehh. Is this so important? :P

static void QCALL GLimp_OnError(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar *message, const void *userParam)
{
const char *severityText = "";
Expand Down
4 changes: 2 additions & 2 deletions codemp/rd-rend2/tr_ghoul2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3954,8 +3954,8 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean &
CModelCache->StoreShaderRequest(mod_name, &surfInfo->shader[0], &surfInfo->shaderIndex);

// find the next surface
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + offsetof (mdxmSurfHierarchy_t, childIndexes[surfInfo->numChildren]) );
}
surfInfo = (mdxmSurfHierarchy_t *)((byte *)surfInfo + offsetof(mdxmSurfHierarchy_t, childIndexes) + sizeof(int) * surfInfo->numChildren);
}

// swap all the LOD's (we need to do the middle part of this even for intel, because of shader reg and err-check)
lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs );
Expand Down
2 changes: 1 addition & 1 deletion codemp/rd-rend2/tr_glsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static size_t GLSL_GetShaderHeader(
// OK we added a lot of stuff but if we do something bad in the GLSL
// shaders then we want the proper line so we have to reset the line
// counting
Q_strcat(dest, size, va("#line %d\n", firstLineNumber - 1));
Q_strcat(dest, size, va("\n#line %d\n", firstLineNumber - 1));

return strlen(dest);
}
Expand Down
4 changes: 3 additions & 1 deletion codemp/rd-rend2/tr_glsl_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Block *FindBlock( const char *name, Block *blocks, size_t numBlocks )
return nullptr;
}

#if defined(__clang__)
// [M] strncpy_s is not present on linux and VS only function
#if !defined(_WIN32)
void strncpy_s( char *dest, size_t destSize, const char *src, size_t srcSize )
{
// This isn't really a safe version, but I know the inputs to expect.
Expand All @@ -52,6 +53,7 @@ void strncpy_s( char *dest, size_t destSize, const char *src, size_t srcSize )
}
#endif


}

GPUProgramDesc ParseProgramSource( Allocator& allocator, const char *text )
Expand Down
2 changes: 2 additions & 0 deletions codemp/rd-rend2/tr_weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "tr_local.h"
#include <utility>
#include <vector>
#include <cmath>


struct weatherSystem_t
{
Expand Down