forked from 0ad/0ad
fixed some signed/unsigned warnings
This was SVN commit r259.
This commit is contained in:
parent
df6fceba62
commit
d63248d276
@ -1,3 +1,5 @@
|
|||||||
|
#include "precompiled.h"
|
||||||
|
|
||||||
#include "EntityHandles.h"
|
#include "EntityHandles.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
|
|
||||||
|
@ -21,8 +21,13 @@
|
|||||||
#include "CStr.h"
|
#include "CStr.h"
|
||||||
#include "Vector3D.h"
|
#include "Vector3D.h"
|
||||||
|
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4996)
|
||||||
|
|
||||||
#include <hash_map>
|
#include <hash_map>
|
||||||
|
|
||||||
|
#pragma warning(pop)
|
||||||
|
|
||||||
class CGenericProperty
|
class CGenericProperty
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -38,7 +38,7 @@ void CFilePacker::Write(const char* filename,u32 version,const char magicstr[4])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get size of data
|
// get size of data
|
||||||
u32 datasize=m_Data.size();
|
u32 datasize=(u32)m_Data.size();
|
||||||
if (fwrite(&datasize,sizeof(datasize),1,fp)!=1) {
|
if (fwrite(&datasize,sizeof(datasize),1,fp)!=1) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
throw CFileWriteError();
|
throw CFileWriteError();
|
||||||
@ -59,7 +59,7 @@ void CFilePacker::Write(const char* filename,u32 version,const char magicstr[4])
|
|||||||
// PackRaw: pack given number of bytes onto the end of the data stream
|
// PackRaw: pack given number of bytes onto the end of the data stream
|
||||||
void CFilePacker::PackRaw(const void* rawdata,u32 rawdatalen)
|
void CFilePacker::PackRaw(const void* rawdata,u32 rawdatalen)
|
||||||
{
|
{
|
||||||
u32 start=m_Data.size();
|
u32 start=(u32)m_Data.size();
|
||||||
m_Data.resize(m_Data.size()+rawdatalen);
|
m_Data.resize(m_Data.size()+rawdatalen);
|
||||||
memcpy(&m_Data[start],rawdata,rawdatalen);
|
memcpy(&m_Data[start],rawdata,rawdatalen);
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ void CFilePacker::PackRaw(const void* rawdata,u32 rawdatalen)
|
|||||||
// PackString: pack a string onto the end of the data stream
|
// PackString: pack a string onto the end of the data stream
|
||||||
void CFilePacker::PackString(const CStr& str)
|
void CFilePacker::PackString(const CStr& str)
|
||||||
{
|
{
|
||||||
u32 len=str.Length();
|
u32 len=(u32)str.Length();
|
||||||
PackRaw(&len,sizeof(len));
|
PackRaw(&len,sizeof(len));
|
||||||
PackRaw((const char*) str,len);
|
PackRaw((const char*) str,len);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ void CFileUnpacker::Read(const char* filename,const char magicstr[4])
|
|||||||
// UnpackRaw: unpack given number of bytes from the input stream into the given array
|
// UnpackRaw: unpack given number of bytes from the input stream into the given array
|
||||||
// - throws CFileEOFError if the end of the data stream is reached before the given
|
// - throws CFileEOFError if the end of the data stream is reached before the given
|
||||||
// number of bytes have been read
|
// number of bytes have been read
|
||||||
void CFileUnpacker::UnpackRaw(void* rawdata,u32 rawdatalen)
|
void CFileUnpacker::UnpackRaw(void* rawdata,size_t rawdatalen)
|
||||||
{
|
{
|
||||||
// got enough data to unpack?
|
// got enough data to unpack?
|
||||||
if (m_UnpackPos+rawdatalen<=m_Data.size()) {
|
if (m_UnpackPos+rawdatalen<=m_Data.size()) {
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
// UnpackRaw: unpack given number of bytes from the input stream into the given array
|
// UnpackRaw: unpack given number of bytes from the input stream into the given array
|
||||||
// - throws CFileEOFError if the end of the data stream is reached before the given
|
// - throws CFileEOFError if the end of the data stream is reached before the given
|
||||||
// number of bytes have been read
|
// number of bytes have been read
|
||||||
void UnpackRaw(void* rawdata,u32 rawdatalen);
|
void UnpackRaw(void* rawdata,size_t rawdatalen);
|
||||||
// UnpackString: unpack a string from the raw data stream
|
// UnpackString: unpack a string from the raw data stream
|
||||||
void UnpackString(CStr& result);
|
void UnpackString(CStr& result);
|
||||||
|
|
||||||
|
@ -1,177 +1,177 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Name: HFTracer.cpp
|
// Name: HFTracer.cpp
|
||||||
// Author: Rich Cross
|
// Author: Rich Cross
|
||||||
// Contact: rich@wildfiregames.com
|
// Contact: rich@wildfiregames.com
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "HFTracer.h"
|
#include "HFTracer.h"
|
||||||
#include "terrain/Terrain.h"
|
#include "terrain/Terrain.h"
|
||||||
#include "terrain/Bound.h"
|
#include "terrain/Bound.h"
|
||||||
#include "terrain/Vector3D.h"
|
#include "terrain/Vector3D.h"
|
||||||
|
|
||||||
extern CTerrain g_Terrain;
|
extern CTerrain g_Terrain;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// CHFTracer constructor
|
// CHFTracer constructor
|
||||||
CHFTracer::CHFTracer(const u16* hf,u32 mapsize,float cellsize,float heightscale)
|
CHFTracer::CHFTracer(const u16* hf,u32 mapsize,float cellsize,float heightscale)
|
||||||
: m_Heightfield(hf), m_MapSize(mapsize), m_CellSize(cellsize),
|
: m_Heightfield(hf), m_MapSize(mapsize), m_CellSize(cellsize),
|
||||||
m_HeightScale(heightscale)
|
m_HeightScale(heightscale)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// RayTriIntersect: intersect a ray with triangle defined by vertices
|
// RayTriIntersect: intersect a ray with triangle defined by vertices
|
||||||
// v0,v1,v2; return true if ray hits triangle at distance less than dist,
|
// v0,v1,v2; return true if ray hits triangle at distance less than dist,
|
||||||
// or false otherwise
|
// or false otherwise
|
||||||
bool CHFTracer::RayTriIntersect(const CVector3D& v0,const CVector3D& v1,const CVector3D& v2,
|
bool CHFTracer::RayTriIntersect(const CVector3D& v0,const CVector3D& v1,const CVector3D& v2,
|
||||||
const CVector3D& origin,const CVector3D& dir,float& dist) const
|
const CVector3D& origin,const CVector3D& dir,float& dist) const
|
||||||
{
|
{
|
||||||
const float EPSILON=0.00001f;
|
const float EPSILON=0.00001f;
|
||||||
|
|
||||||
// calculate edge vectors
|
// calculate edge vectors
|
||||||
CVector3D edge0=v1-v0;
|
CVector3D edge0=v1-v0;
|
||||||
CVector3D edge1=v2-v0;
|
CVector3D edge1=v2-v0;
|
||||||
|
|
||||||
// begin calculating determinant - also used to calculate U parameter
|
// begin calculating determinant - also used to calculate U parameter
|
||||||
CVector3D pvec=dir.Cross(edge1);
|
CVector3D pvec=dir.Cross(edge1);
|
||||||
|
|
||||||
// if determinant is near zero, ray lies in plane of triangle
|
// if determinant is near zero, ray lies in plane of triangle
|
||||||
float det = edge0.Dot(pvec);
|
float det = edge0.Dot(pvec);
|
||||||
if (fabs(det)<EPSILON)
|
if (fabs(det)<EPSILON)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float inv_det = 1.0f/det;
|
float inv_det = 1.0f/det;
|
||||||
|
|
||||||
// calculate vector from vert0 to ray origin
|
// calculate vector from vert0 to ray origin
|
||||||
CVector3D tvec=origin-v0;
|
CVector3D tvec=origin-v0;
|
||||||
|
|
||||||
// calculate U parameter, test bounds
|
// calculate U parameter, test bounds
|
||||||
float u=tvec.Dot(pvec)*inv_det;
|
float u=tvec.Dot(pvec)*inv_det;
|
||||||
if (u<-0.01f || u>1.01f)
|
if (u<-0.01f || u>1.01f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// prepare to test V parameter
|
// prepare to test V parameter
|
||||||
CVector3D qvec=tvec.Cross(edge0);
|
CVector3D qvec=tvec.Cross(edge0);
|
||||||
|
|
||||||
// calculate V parameter and test bounds
|
// calculate V parameter and test bounds
|
||||||
float v=dir.Dot(qvec)*inv_det;
|
float v=dir.Dot(qvec)*inv_det;
|
||||||
if (v<0.0f || u+v>1.0f)
|
if (v<0.0f || u+v>1.0f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// calculate distance to intersection point from ray origin
|
// calculate distance to intersection point from ray origin
|
||||||
float d=edge1.Dot(qvec)*inv_det;
|
float d=edge1.Dot(qvec)*inv_det;
|
||||||
if (d>=0 && d<dist) {
|
if (d>=0 && d<dist) {
|
||||||
dist=d;
|
dist=d;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// CellIntersect: test if ray intersects either of the triangles in the given
|
// CellIntersect: test if ray intersects either of the triangles in the given
|
||||||
// cell - return hit result, and distance to hit, if hit occurred
|
// cell - return hit result, and distance to hit, if hit occurred
|
||||||
bool CHFTracer::CellIntersect(int cx,int cz,CVector3D& origin,CVector3D& dir,float& dist) const
|
bool CHFTracer::CellIntersect(int cx,int cz,CVector3D& origin,CVector3D& dir,float& dist) const
|
||||||
{
|
{
|
||||||
bool res=false;
|
bool res=false;
|
||||||
|
|
||||||
// get vertices for this cell
|
// get vertices for this cell
|
||||||
CVector3D vpos[4];
|
CVector3D vpos[4];
|
||||||
g_Terrain.CalcPosition(cx,cz,vpos[0]);
|
g_Terrain.CalcPosition(cx,cz,vpos[0]);
|
||||||
g_Terrain.CalcPosition(cx+1,cz,vpos[1]);
|
g_Terrain.CalcPosition(cx+1,cz,vpos[1]);
|
||||||
g_Terrain.CalcPosition(cx+1,cz+1,vpos[2]);
|
g_Terrain.CalcPosition(cx+1,cz+1,vpos[2]);
|
||||||
g_Terrain.CalcPosition(cx,cz+1,vpos[3]);
|
g_Terrain.CalcPosition(cx,cz+1,vpos[3]);
|
||||||
|
|
||||||
dist=1.0e30f;
|
dist=1.0e30f;
|
||||||
if (RayTriIntersect(vpos[0],vpos[1],vpos[2],origin,dir,dist)) {
|
if (RayTriIntersect(vpos[0],vpos[1],vpos[2],origin,dir,dist)) {
|
||||||
res=true;
|
res=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RayTriIntersect(vpos[0],vpos[2],vpos[3],origin,dir,dist)) {
|
if (RayTriIntersect(vpos[0],vpos[2],vpos[3],origin,dir,dist)) {
|
||||||
res=true;
|
res=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// RayIntersect: intersect ray with this heightfield; return true if
|
// RayIntersect: intersect ray with this heightfield; return true if
|
||||||
// intersection occurs (and fill in grid coordinates of intersection), or false
|
// intersection occurs (and fill in grid coordinates of intersection), or false
|
||||||
// otherwise
|
// otherwise
|
||||||
bool CHFTracer::RayIntersect(CVector3D& origin,CVector3D& dir,int& x,int& z,CVector3D& ipt) const
|
bool CHFTracer::RayIntersect(CVector3D& origin,CVector3D& dir,int& x,int& z,CVector3D& ipt) const
|
||||||
{
|
{
|
||||||
// intersect first against bounding box
|
// intersect first against bounding box
|
||||||
CBound bound;
|
CBound bound;
|
||||||
bound[0]=CVector3D(0,0,0);
|
bound[0]=CVector3D(0,0,0);
|
||||||
bound[1]=CVector3D(m_MapSize*m_CellSize,65535*m_HeightScale,m_MapSize*m_CellSize);
|
bound[1]=CVector3D(m_MapSize*m_CellSize,65535*m_HeightScale,m_MapSize*m_CellSize);
|
||||||
|
|
||||||
float tmin,tmax;
|
float tmin,tmax;
|
||||||
if (!bound.RayIntersect(origin,dir,tmin,tmax)) {
|
if (!bound.RayIntersect(origin,dir,tmin,tmax)) {
|
||||||
// ray missed world bounds; no intersection
|
// ray missed world bounds; no intersection
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// project origin onto grid, if necessary, to get starting point for traversal
|
// project origin onto grid, if necessary, to get starting point for traversal
|
||||||
CVector3D traversalPt;
|
CVector3D traversalPt;
|
||||||
if (tmin>0) {
|
if (tmin>0) {
|
||||||
traversalPt=origin+dir*tmin;
|
traversalPt=origin+dir*tmin;
|
||||||
} else {
|
} else {
|
||||||
traversalPt=origin;
|
traversalPt=origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup traversal variables
|
// setup traversal variables
|
||||||
int sx=dir.X<0 ? -1 : 1;
|
int sx=dir.X<0 ? -1 : 1;
|
||||||
int sz=dir.Z<0 ? -1 : 1;
|
int sz=dir.Z<0 ? -1 : 1;
|
||||||
|
|
||||||
float invCellSize=1.0f/float(m_CellSize);
|
float invCellSize=1.0f/float(m_CellSize);
|
||||||
|
|
||||||
float fcx=traversalPt.X*invCellSize;
|
float fcx=traversalPt.X*invCellSize;
|
||||||
int cx=int(fcx);
|
int cx=int(fcx);
|
||||||
|
|
||||||
float fcz=traversalPt.Z*invCellSize;
|
float fcz=traversalPt.Z*invCellSize;
|
||||||
int cz=int(fcz);
|
int cz=int(fcz);
|
||||||
|
|
||||||
float invdx=float(1.0/fabs(dir.X));
|
float invdx=float(1.0/fabs(dir.X));
|
||||||
float invdz=float(1.0/fabs(dir.Z));
|
float invdz=float(1.0/fabs(dir.Z));
|
||||||
|
|
||||||
float dist;
|
float dist;
|
||||||
do {
|
do {
|
||||||
// test current cell
|
// test current cell
|
||||||
if (cx>=0 && cx<int(m_MapSize-1) && cz>=0 && cz<int(m_MapSize-1)) {
|
if (cx>=0 && cx<int(m_MapSize-1) && cz>=0 && cz<int(m_MapSize-1)) {
|
||||||
if (CellIntersect(cx,cz,origin,dir,dist)) {
|
if (CellIntersect(cx,cz,origin,dir,dist)) {
|
||||||
x=cx;
|
x=cx;
|
||||||
z=cz;
|
z=cz;
|
||||||
ipt=origin+dir*dist;
|
ipt=origin+dir*dist;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get coords of current cell
|
// get coords of current cell
|
||||||
fcx=traversalPt.X*invCellSize;
|
fcx=traversalPt.X*invCellSize;
|
||||||
fcz=traversalPt.Z*invCellSize;
|
fcz=traversalPt.Z*invCellSize;
|
||||||
|
|
||||||
// get distance to next cell in x,z
|
// get distance to next cell in x,z
|
||||||
float dx=(sx==-1) ? fcx-float(cx) : 1-(fcx-float(cx));
|
float dx=(sx==-1) ? fcx-float(cx) : 1-(fcx-float(cx));
|
||||||
dx*=invdx;
|
dx*=invdx;
|
||||||
float dz=(sz==-1) ? fcz-float(cz) : 1-(fcz-float(cz));
|
float dz=(sz==-1) ? fcz-float(cz) : 1-(fcz-float(cz));
|
||||||
dz*=invdz;
|
dz*=invdz;
|
||||||
|
|
||||||
// advance ..
|
// advance ..
|
||||||
float dist;
|
float dist;
|
||||||
if (dx<dz) {
|
if (dx<dz) {
|
||||||
cx+=sx;
|
cx+=sx;
|
||||||
dist=dx;
|
dist=dx;
|
||||||
} else {
|
} else {
|
||||||
cz+=sz;
|
cz+=sz;
|
||||||
dist=dz;
|
dist=dz;
|
||||||
}
|
}
|
||||||
|
|
||||||
traversalPt+=dir*dist;
|
traversalPt+=dir*dist;
|
||||||
} while (traversalPt.Y>=0);
|
} while (traversalPt.Y>=0);
|
||||||
|
|
||||||
// fell off end of heightmap with no intersection; return a miss
|
// fell off end of heightmap with no intersection; return a miss
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,48 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Name: HFTracer.h
|
// Name: HFTracer.h
|
||||||
// Author: Rich Cross
|
// Author: Rich Cross
|
||||||
// Contact: rich@wildfiregames.com
|
// Contact: rich@wildfiregames.com
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _HFTRACER_H
|
#ifndef _HFTRACER_H
|
||||||
#define _HFTRACER_H
|
#define _HFTRACER_H
|
||||||
|
|
||||||
class CVector3D;
|
class CVector3D;
|
||||||
|
|
||||||
#include "res/res.h"
|
#include "res/res.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// CHFTracer: a class for determining ray intersections with a heightfield
|
// CHFTracer: a class for determining ray intersections with a heightfield
|
||||||
class CHFTracer
|
class CHFTracer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructor; setup data
|
// constructor; setup data
|
||||||
CHFTracer(const u16* hf,u32 mapsize,float cellsize,float heightscale);
|
CHFTracer(const u16* hf,u32 mapsize,float cellsize,float heightscale);
|
||||||
|
|
||||||
// intersect ray with this heightfield; return true if intersection
|
// intersect ray with this heightfield; return true if intersection
|
||||||
// occurs (and fill in grid coordinates and point of intersection), or false otherwise
|
// occurs (and fill in grid coordinates and point of intersection), or false otherwise
|
||||||
bool RayIntersect(CVector3D& origin,CVector3D& dir,int& x,int& z,CVector3D& ipt) const;
|
bool RayIntersect(CVector3D& origin,CVector3D& dir,int& x,int& z,CVector3D& ipt) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// intersect a ray with triangle defined by vertices
|
// intersect a ray with triangle defined by vertices
|
||||||
// v0,v1,v2; return true if ray hits triangle at distance less than dist,
|
// v0,v1,v2; return true if ray hits triangle at distance less than dist,
|
||||||
// or false otherwise
|
// or false otherwise
|
||||||
bool RayTriIntersect(const CVector3D& v0,const CVector3D& v1,const CVector3D& v2,
|
bool RayTriIntersect(const CVector3D& v0,const CVector3D& v1,const CVector3D& v2,
|
||||||
const CVector3D& origin,const CVector3D& dir,float& dist) const;
|
const CVector3D& origin,const CVector3D& dir,float& dist) const;
|
||||||
|
|
||||||
// test if ray intersects either of the triangles in the given
|
// test if ray intersects either of the triangles in the given
|
||||||
bool CellIntersect(int cx,int cz,CVector3D& origin,CVector3D& dir,float& dist) const;
|
bool CellIntersect(int cx,int cz,CVector3D& origin,CVector3D& dir,float& dist) const;
|
||||||
|
|
||||||
// the heightfield were tracing
|
// the heightfield were tracing
|
||||||
const u16* m_Heightfield;
|
const u16* m_Heightfield;
|
||||||
// size of the heightfield
|
// size of the heightfield
|
||||||
u32 m_MapSize;
|
u32 m_MapSize;
|
||||||
// cell size - size of each cell in x and z
|
// cell size - size of each cell in x and z
|
||||||
float m_CellSize;
|
float m_CellSize;
|
||||||
// vertical scale - size of each cell in y
|
// vertical scale - size of each cell in y
|
||||||
float m_HeightScale;
|
float m_HeightScale;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -5,6 +5,7 @@
|
|||||||
#include "MapReader.h"
|
#include "MapReader.h"
|
||||||
#include "UnitManager.h"
|
#include "UnitManager.h"
|
||||||
#include "ObjectManager.h"
|
#include "ObjectManager.h"
|
||||||
|
|
||||||
#include "BaseEntity.h"
|
#include "BaseEntity.h"
|
||||||
#include "BaseEntityCollection.h"
|
#include "BaseEntityCollection.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
|
@ -101,7 +101,8 @@ void CPatchRData::BuildBlends()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (neighbourTextures.size()>0) {
|
if (neighbourTextures.size()>0) {
|
||||||
u32 count=neighbourTextures.size();
|
// u32 count=neighbourTextures.size();
|
||||||
|
// janwas fixing warnings: not used?
|
||||||
// sort textures from lowest to highest priority
|
// sort textures from lowest to highest priority
|
||||||
std::sort(neighbourTextures.begin(),neighbourTextures.end());
|
std::sort(neighbourTextures.begin(),neighbourTextures.end());
|
||||||
|
|
||||||
@ -476,7 +477,7 @@ void CPatchRData::RenderStreams(u32 streamflags)
|
|||||||
if (streamflags & STREAM_UV0) glTexCoordPointer(2,GL_FLOAT,sizeof(SBaseVertex),base+offsetof(SBaseVertex,m_UVs));
|
if (streamflags & STREAM_UV0) glTexCoordPointer(2,GL_FLOAT,sizeof(SBaseVertex),base+offsetof(SBaseVertex,m_UVs));
|
||||||
|
|
||||||
// render all base splats at once
|
// render all base splats at once
|
||||||
glDrawElements(GL_QUADS,m_Indices.size(),GL_UNSIGNED_SHORT,&m_Indices[0]);
|
glDrawElements(GL_QUADS,(GLsizei)m_Indices.size(),GL_UNSIGNED_SHORT,&m_Indices[0]);
|
||||||
|
|
||||||
// bump stats
|
// bump stats
|
||||||
g_Renderer.m_Stats.m_DrawCalls++;
|
g_Renderer.m_Stats.m_DrawCalls++;
|
||||||
|
@ -24,7 +24,7 @@ void CTextureManager::AddTextureType(const char* name)
|
|||||||
m_TerrainTextures.resize(m_TerrainTextures.size()+1);
|
m_TerrainTextures.resize(m_TerrainTextures.size()+1);
|
||||||
STextureType& ttype=m_TerrainTextures.back();
|
STextureType& ttype=m_TerrainTextures.back();
|
||||||
ttype.m_Name=name;
|
ttype.m_Name=name;
|
||||||
ttype.m_Index=m_TerrainTextures.size()-1;
|
ttype.m_Index=(int)(m_TerrainTextures.size()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTextureEntry* CTextureManager::FindTexture(const char* filename)
|
CTextureEntry* CTextureManager::FindTexture(const char* filename)
|
||||||
|
@ -7,16 +7,10 @@
|
|||||||
#include "ObjectManager.h"
|
#include "ObjectManager.h"
|
||||||
#include "Prometheus.h"
|
#include "Prometheus.h"
|
||||||
|
|
||||||
#include "time.h"
|
|
||||||
#include "sdl.h"
|
#include "sdl.h"
|
||||||
#include "res/tex.h"
|
#include "res/tex.h"
|
||||||
#include "detect.h"
|
#include "detect.h"
|
||||||
|
|
||||||
#include <malloc.h>
|
|
||||||
|
|
||||||
// TODO: fix scrolling hack - framerate independent, use SDL
|
|
||||||
//#include "win.h" // REMOVEME
|
|
||||||
|
|
||||||
void InitScene ();
|
void InitScene ();
|
||||||
void InitResources ();
|
void InitResources ();
|
||||||
void RenderScene ();
|
void RenderScene ();
|
||||||
|
Loading…
Reference in New Issue
Block a user