Skip to content

Commit

Permalink
Fix xrLC compilation, a bit tweaked Shader_xrLC.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Aug 4, 2017
1 parent 29ad349 commit e3cc304
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
32 changes: 19 additions & 13 deletions src/utils/Shader_xrLC.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef SHADER_XRLC_H
#define SHADER_XRLC_H
#pragma once

struct Shader_xrLC
{
Expand Down Expand Up @@ -57,7 +57,7 @@ class Shader_xrLC_LIB
public:
void Load(LPCSTR name)
{
IReader* fs = FS.r_open(name);
auto fs = FS.r_open(name);
if (NULL == fs)
{
string256 inf;
Expand All @@ -77,40 +77,43 @@ class Shader_xrLC_LIB
}
bool Save(LPCSTR name)
{
IWriter* F = FS.w_open(name);
auto F = FS.w_open(name);
if (F)
{
F->w(&*library.begin(), (u32)library.size() * sizeof(Shader_xrLC));
FS.w_close(F);
return true;
}
else
{
return false;
}
return false;
}
void Unload() { library.clear(); }

u32 GetID(LPCSTR name) const
{
for (auto it = library.begin(); it != library.end(); it++)
if (0 == stricmp(name, it->Name))
return u32(it - library.begin());
return u32(-1);
}

Shader_xrLC* Get(LPCSTR name)
{
for (auto it = library.begin(); it != library.end(); it++)
if (0 == stricmp(name, it->Name))
return &(*it);
return NULL;
for (auto& shader : library)
if (0 == stricmp(name, shader.Name))
return &shader;
return nullptr;
}
IC Shader_xrLC* Get(int id) { return &library[id]; }
IC const Shader_xrLC* Get(int id) const { return &library[id]; }

Shader_xrLC* Get(int id) { return &library[id]; }

const Shader_xrLC* Get(int id) const { return &library[id]; }

Shader_xrLC* Append(Shader_xrLC* parent = 0)
{
library.push_back(parent ? Shader_xrLC(*parent) : Shader_xrLC());
return &library.back();
}

void Remove(LPCSTR name)
{
for (auto it = library.begin(); it != library.end(); it++)
Expand All @@ -120,8 +123,11 @@ class Shader_xrLC_LIB
break;
}
}

void Remove(int id) { library.erase(library.begin() + id); }

Shader_xrLCVec& Library() { return library; }

const Shader_xrLCVec& Library() const { return library; }
};

Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrLC/NvMender2002/NVMeshMender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ bool NVMeshMender::Munge(const NVMeshMender::VAVector& input, NVMeshMender::VAVe
pPositions = (vec3*)(&(positions[0]));
tex = (vec3*)(&(output[(*texIter).second].floatVector_[0]));

double _eps = type_epsilon(double) * 10;
double _eps = type_epsilon<double> * 10;
double a, b, c;
vec3d sxt;

Expand Down

0 comments on commit e3cc304

Please sign in to comment.