mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
Fix lighting defect and VS8 compiler warnings.
This commit is contained in:
parent
3c04479919
commit
3ed03fee2f
@ -11,8 +11,9 @@ namespace ESM {
|
||||
loading process, but are rather loaded later on demand when we are
|
||||
setting up a specific cell.
|
||||
*/
|
||||
struct CellRef
|
||||
class CellRef
|
||||
{
|
||||
public:
|
||||
int refnum; // Reference number
|
||||
std::string refID; // ID of object being referenced
|
||||
|
||||
|
@ -60,7 +60,7 @@ struct LeveledListBase
|
||||
// items. Also, some times we don't want to merge lists, just
|
||||
// overwrite. Figure out a way to give the user this option.
|
||||
|
||||
for(int i=0; i<list.size(); i++)
|
||||
for(size_t i=0; i<list.size(); i++)
|
||||
{
|
||||
LevelItem &li = list[i];
|
||||
li.id = esm.getHNString(recName);
|
||||
|
@ -67,7 +67,7 @@ struct Script
|
||||
// The tmp buffer is a null-byte separated string list, we
|
||||
// just have to pick out one string at a time.
|
||||
char* str = tmp;
|
||||
for(int i=0; i< varNames.size(); i++)
|
||||
for(size_t i=0; i< varNames.size(); i++)
|
||||
{
|
||||
varNames[i] = std::string(str);
|
||||
str += varNames[i].size()+1;
|
||||
|
@ -66,8 +66,9 @@ namespace ESMS
|
||||
};
|
||||
|
||||
/// A storage struct for one single cell reference.
|
||||
struct CellStore
|
||||
class CellStore
|
||||
{
|
||||
public:
|
||||
CellStore() : cell (0) {}
|
||||
|
||||
const ESM::Cell *cell;
|
||||
|
@ -29,13 +29,14 @@ void insertObj(CellRender& cellRender, const ESMS::LiveCellRef<ESM::Light>& live
|
||||
cellRender.insertBegin (liveRef.ref);
|
||||
|
||||
cellRender.insertMesh ("meshes\\" + model);
|
||||
|
||||
int color = liveRef.base->data.color;
|
||||
|
||||
cellRender.insertLight(color & 255,
|
||||
(color >> 8) & 255,
|
||||
(color >> 16) & 255,
|
||||
liveRef.base->data.radius);
|
||||
|
||||
// Extract the color and convert to floating point
|
||||
const int color = liveRef.base->data.color;
|
||||
const float r = ((color >> 0) & 0xFF) / 255.0f;
|
||||
const float g = ((color >> 8) & 0xFF) / 255.0f;
|
||||
const float b = ((color >> 16) & 0xFF) / 255.0f;
|
||||
const float radius = float(liveRef.base->data.radius);
|
||||
cellRender.insertLight(r, g, b, radius);
|
||||
|
||||
cellRender.insertEnd();
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ void InteriorCellRender::setAmbientMode()
|
||||
|
||||
case 1:
|
||||
|
||||
scene.getMgr()->setAmbientLight(0.7*ambientColor + 0.3*ColourValue(1,1,1));
|
||||
scene.getMgr()->setAmbientLight(0.7f*ambientColor + 0.3f*ColourValue(1,1,1));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -54,7 +54,8 @@ public:
|
||||
*/
|
||||
void bind(int index, Action action, const std::string &name="")
|
||||
{
|
||||
assert(index >= 0 && index < bindings.size());
|
||||
assert(index >= 0 && index < (int)bindings.size());
|
||||
|
||||
FuncBinding &fb = bindings[index];
|
||||
fb.action = action;
|
||||
fb.name = name;
|
||||
@ -65,7 +66,8 @@ public:
|
||||
*/
|
||||
void unbind(int index)
|
||||
{
|
||||
assert(index >= 0 && index < bindings.size());
|
||||
assert(index >= 0 && index < (int)bindings.size());
|
||||
|
||||
bindings[index] = FuncBinding();
|
||||
}
|
||||
|
||||
@ -75,7 +77,8 @@ public:
|
||||
*/
|
||||
void call(int index, const void *p=NULL) const
|
||||
{
|
||||
assert(index >= 0 && index < bindings.size());
|
||||
assert(index >= 0 && index < (int)bindings.size());
|
||||
|
||||
const FuncBinding &fb = bindings[index];
|
||||
if(fb.action) fb.action(index, p);
|
||||
}
|
||||
@ -83,14 +86,16 @@ public:
|
||||
/// Check if a given index is bound to anything
|
||||
bool isBound(int index) const
|
||||
{
|
||||
assert(index >= 0 && index < bindings.size());
|
||||
assert(index >= 0 && index < (int)bindings.size());
|
||||
|
||||
return !bindings[index].action.empty();
|
||||
}
|
||||
|
||||
/// Return the name associated with an action (empty if not bound)
|
||||
const std::string &getName(int index) const
|
||||
{
|
||||
assert(index >= 0 && index < bindings.size());
|
||||
assert(index >= 0 && index < (int)bindings.size());
|
||||
|
||||
return bindings[index].name;
|
||||
}
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ namespace Input
|
||||
assert(camera);
|
||||
|
||||
// Mouse sensitivity. Should be a config option later.
|
||||
const float MS = 0.2;
|
||||
const float MS = 0.2f;
|
||||
|
||||
float x = arg.state.X.rel * MS;
|
||||
float y = arg.state.Y.rel * MS;
|
||||
|
Loading…
Reference in New Issue
Block a user