mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-09 21:44:54 +00:00
Windows compile fixes
This commit is contained in:
parent
10c1d78c38
commit
d37f5b3052
@ -177,9 +177,13 @@ static void createMaterial(const String &name,
|
|||||||
// make sure that all materials are given unique names.
|
// make sure that all materials are given unique names.
|
||||||
static String getUniqueName(const String &input)
|
static String getUniqueName(const String &input)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
static int addon = 0;
|
static int addon = 0;
|
||||||
static char buf[8];
|
static char buf[8];
|
||||||
snprintf(buf,8,"_%d", addon++);
|
sprintf(buf, "_%d", addon++);
|
||||||
|
|
||||||
// Don't overflow the buffer
|
// Don't overflow the buffer
|
||||||
if(addon > 999999) addon = 0;
|
if(addon > 999999) addon = 0;
|
||||||
@ -248,8 +252,8 @@ static void createOgreMesh(Mesh *mesh, NiTriShape *shape, const String &material
|
|||||||
{
|
{
|
||||||
const float *colors = data->colors.ptr;
|
const float *colors = data->colors.ptr;
|
||||||
RenderSystem* rs = Root::getSingleton().getRenderSystem();
|
RenderSystem* rs = Root::getSingleton().getRenderSystem();
|
||||||
RGBA colorsRGB[numVerts];
|
std::vector<RGBA> colorsRGB(numVerts);
|
||||||
RGBA *pColour = colorsRGB;
|
RGBA *pColour = &colorsRGB.front();
|
||||||
for(int i=0; i<numVerts; i++)
|
for(int i=0; i<numVerts; i++)
|
||||||
{
|
{
|
||||||
rs->convertColourValue(ColourValue(colors[0],colors[1],colors[2],
|
rs->convertColourValue(ColourValue(colors[0],colors[1],colors[2],
|
||||||
@ -260,7 +264,7 @@ static void createOgreMesh(Mesh *mesh, NiTriShape *shape, const String &material
|
|||||||
vbuf = HardwareBufferManager::getSingleton().createVertexBuffer(
|
vbuf = HardwareBufferManager::getSingleton().createVertexBuffer(
|
||||||
VertexElement::getTypeSize(VET_COLOUR),
|
VertexElement::getTypeSize(VET_COLOUR),
|
||||||
numVerts, HardwareBuffer::HBU_STATIC_WRITE_ONLY);
|
numVerts, HardwareBuffer::HBU_STATIC_WRITE_ONLY);
|
||||||
vbuf->writeData(0, vbuf->getSizeInBytes(), colorsRGB, true);
|
vbuf->writeData(0, vbuf->getSizeInBytes(), &colorsRGB.front(), true);
|
||||||
bind->setBinding(nextBuf++, vbuf);
|
bind->setBinding(nextBuf++, vbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user