mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 04:43:58 +02:00
Some final fixed related to combined cross platform socket code
This commit is contained in:
Binary file not shown.
@@ -133,7 +133,7 @@
|
|||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
AdditionalIncludeDirectories="../../../deps/include/lua;../../../deps/include;../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/platform/win32;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/shared_lib/include/tinyxml;../../source/glest_game/ai;../../source/glest_game/facilities;../../source/glest_game/game;../../source/glest_game/global;../../source/glest_game/graphics;../../source/glest_game/gui;../../source/glest_game/main;../../source/glest_game/menu;../../source/glest_game/network;../../source/glest_game/sound;../../source/glest_game/type_instances;../../source/glest_game/types;../../source/glest_game/world;../../source/win32_deps/include;"../../source/win32_deps/xerces-c-3.0.1/src";"../../source/win32_deps/SDL-1.2.14/include";../../source/shared_lib/include/platform/sdl;../../source/shared_lib/include/sound/openal;"../../source/win32_deps/openal-soft-1.12.854/include""
|
AdditionalIncludeDirectories="../../../deps/include/lua;../../../deps/include;../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/platform/win32;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/shared_lib/include/tinyxml;../../source/glest_game/ai;../../source/glest_game/facilities;../../source/glest_game/game;../../source/glest_game/global;../../source/glest_game/graphics;../../source/glest_game/gui;../../source/glest_game/main;../../source/glest_game/menu;../../source/glest_game/network;../../source/glest_game/sound;../../source/glest_game/type_instances;../../source/glest_game/types;../../source/glest_game/world;../../source/win32_deps/include;"../../source/win32_deps/xerces-c-3.0.1/src";"../../source/win32_deps/SDL-1.2.14/include";../../source/shared_lib/include/platform/sdl;../../source/shared_lib/include/sound/openal;"../../source/win32_deps/openal-soft-1.12.854/include";../../source/shared_lib/include/platform/posix"
|
||||||
AdditionalUsingDirectories=""
|
AdditionalUsingDirectories=""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;XML_LIBRARY;USE_PCH=1;_CRT_SECURE_NO_WARNINGS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;XML_LIBRARY;USE_PCH=1;_CRT_SECURE_NO_WARNINGS"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
|
@@ -113,7 +113,7 @@
|
|||||||
InlineFunctionExpansion="2"
|
InlineFunctionExpansion="2"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="../../../deps/include/lua;../../../deps/include;../../source/shared_lib/include;../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/platform/win32;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/win32_deps/include;"../../source/win32_deps/xerces-c-3.0.1/src";"../../source/win32_deps/xerces-c-3.0.1/src/xercesc/xinclude";../../source/win32_deps/libpng141;"../../source/win32_deps/jpeg-8a";"../../source/win32_deps/SDL-1.2.14/include";../../source/shared_lib/include/platform/sdl;"../../source/win32_deps/openal-soft-1.12.854/include";../../source/shared_lib/include/sound/openal"
|
AdditionalIncludeDirectories="../../../deps/include/lua;../../../deps/include;../../source/shared_lib/include;../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/platform/win32;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/win32_deps/include;"../../source/win32_deps/xerces-c-3.0.1/src";"../../source/win32_deps/xerces-c-3.0.1/src/xercesc/xinclude";../../source/win32_deps/libpng141;"../../source/win32_deps/jpeg-8a";"../../source/win32_deps/SDL-1.2.14/include";../../source/shared_lib/include/platform/sdl;"../../source/win32_deps/openal-soft-1.12.854/include";../../source/shared_lib/include/sound/openal;../../source/shared_lib/include/platform/posix"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;USE_PCH=1"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;USE_PCH=1"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="true"
|
||||||
@@ -379,6 +379,10 @@
|
|||||||
RelativePath="..\..\source\shared_lib\sources\platform\sdl\gl_wrap.cpp"
|
RelativePath="..\..\source\shared_lib\sources\platform\sdl\gl_wrap.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\sources\platform\posix\socket.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\platform\sdl\window.cpp"
|
RelativePath="..\..\source\shared_lib\sources\platform\sdl\window.cpp"
|
||||||
>
|
>
|
||||||
@@ -398,10 +402,6 @@
|
|||||||
RelativePath="..\..\source\shared_lib\sources\platform\win32\platform_util.cpp"
|
RelativePath="..\..\source\shared_lib\sources\platform\win32\platform_util.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\source\shared_lib\sources\platform\win32\socket.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\sources\platform\win32\thread.cpp"
|
RelativePath="..\..\source\shared_lib\sources\platform\win32\thread.cpp"
|
||||||
>
|
>
|
||||||
@@ -661,6 +661,10 @@
|
|||||||
RelativePath="..\..\source\shared_lib\include\platform\sdl\sdl_private.h"
|
RelativePath="..\..\source\shared_lib\include\platform\sdl\sdl_private.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\source\shared_lib\include\platform\posix\socket.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\include\platform\sdl\window.h"
|
RelativePath="..\..\source\shared_lib\include\platform\sdl\window.h"
|
||||||
>
|
>
|
||||||
@@ -684,10 +688,6 @@
|
|||||||
RelativePath="..\..\source\shared_lib\include\platform\win32\platform_util.h"
|
RelativePath="..\..\source\shared_lib\include\platform\win32\platform_util.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\source\shared_lib\include\platform\win32\socket.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\source\shared_lib\include\platform\win32\thread.h"
|
RelativePath="..\..\source\shared_lib\include\platform\win32\thread.h"
|
||||||
>
|
>
|
||||||
|
@@ -98,7 +98,7 @@ int ServerInterface::getConnectedSlotCount(){
|
|||||||
|
|
||||||
void ServerInterface::update()
|
void ServerInterface::update()
|
||||||
{
|
{
|
||||||
std::map<int,bool> socketTriggeredList;
|
std::map<PLATFORM_SOCKET,bool> socketTriggeredList;
|
||||||
//update all slots
|
//update all slots
|
||||||
for(int i= 0; i < GameConstants::maxPlayers; ++i)
|
for(int i= 0; i < GameConstants::maxPlayers; ++i)
|
||||||
{
|
{
|
||||||
|
@@ -14,13 +14,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -29,11 +24,14 @@
|
|||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock.h>
|
||||||
typedef SOCKET PLATFORM_SOCKET;
|
typedef SOCKET PLATFORM_SOCKET;
|
||||||
|
|
||||||
const char* WSAGetLastErrorMessage(const char* pcMessagePrefix,int nErrorID = 0);
|
|
||||||
#else
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
|
||||||
typedef int PLATFORM_SOCKET;
|
typedef int PLATFORM_SOCKET;
|
||||||
|
|
||||||
@@ -88,7 +86,7 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
PLATFORM_SOCKET sock;
|
PLATFORM_SOCKET sock;
|
||||||
long lastDebugEvent;
|
time_t lastDebugEvent;
|
||||||
static int broadcast_portno;
|
static int broadcast_portno;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -1,189 +0,0 @@
|
|||||||
// ==============================================================
|
|
||||||
// This file is part of Glest Shared Library (www.glest.org)
|
|
||||||
//
|
|
||||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
|
||||||
//
|
|
||||||
// You can redistribute this code and/or modify it under
|
|
||||||
// the terms of the GNU General Public License as published
|
|
||||||
// by the Free Software Foundation; either version 2 of the
|
|
||||||
// License, or (at your option) any later version
|
|
||||||
// ==============================================================
|
|
||||||
|
|
||||||
#ifndef _SHARED_PLATFORM_SOCKET_H_
|
|
||||||
#define _SHARED_PLATFORM_SOCKET_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <winsock.h>
|
|
||||||
#include <map>
|
|
||||||
#include <vector>
|
|
||||||
#include "thread.h"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
const char* WSAGetLastErrorMessage(const char* pcMessagePrefix,int nErrorID = 0);
|
|
||||||
|
|
||||||
namespace Shared{ namespace Platform{
|
|
||||||
//
|
|
||||||
// This interface describes the methods a callback object must implement
|
|
||||||
// when signalled with detected servers
|
|
||||||
//
|
|
||||||
class DiscoveredServersInterface {
|
|
||||||
public:
|
|
||||||
virtual void DiscoveredServers(std::vector<string> serverList) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// class IP
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
class Ip{
|
|
||||||
private:
|
|
||||||
unsigned char bytes[4];
|
|
||||||
|
|
||||||
public:
|
|
||||||
Ip();
|
|
||||||
Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3);
|
|
||||||
Ip(const string& ipString);
|
|
||||||
|
|
||||||
unsigned char getByte(int byteIndex) {return bytes[byteIndex];}
|
|
||||||
string getString() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// class Socket
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
class Socket{
|
|
||||||
private:
|
|
||||||
class SocketManager{
|
|
||||||
public:
|
|
||||||
SocketManager();
|
|
||||||
~SocketManager();
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static SocketManager socketManager;
|
|
||||||
SOCKET sock;
|
|
||||||
static int broadcast_portno;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Socket(SOCKET sock);
|
|
||||||
Socket();
|
|
||||||
virtual ~Socket();
|
|
||||||
|
|
||||||
static int getBroadCastPort() { return broadcast_portno; }
|
|
||||||
static void setBroadCastPort(int value) { broadcast_portno = value; }
|
|
||||||
static std::vector<std::string> getLocalIPAddressList();
|
|
||||||
|
|
||||||
// Int lookup is socket fd while bool result is whether or not that socket was signalled for reading
|
|
||||||
static bool hasDataToRead(std::map<int,bool> &socketTriggeredList);
|
|
||||||
static bool hasDataToRead(int socket);
|
|
||||||
bool hasDataToRead();
|
|
||||||
void disconnectSocket();
|
|
||||||
|
|
||||||
int getSocketId() const { return sock; }
|
|
||||||
|
|
||||||
int getDataToRead();
|
|
||||||
int send(const void *data, int dataSize);
|
|
||||||
int receive(void *data, int dataSize);
|
|
||||||
int peek(void *data, int dataSize);
|
|
||||||
|
|
||||||
void setBlock(bool block);
|
|
||||||
static void setBlock(bool block, SOCKET socket);
|
|
||||||
bool isReadable();
|
|
||||||
bool isWritable(bool waitOnDelayedResponse);
|
|
||||||
bool isConnected();
|
|
||||||
|
|
||||||
static string getHostName();
|
|
||||||
static string getIp();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static void throwException(const string &str);
|
|
||||||
};
|
|
||||||
|
|
||||||
class BroadCastClientSocketThread : public Thread
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Mutex mutexRunning;
|
|
||||||
Mutex mutexQuit;
|
|
||||||
|
|
||||||
bool quit;
|
|
||||||
bool running;
|
|
||||||
|
|
||||||
DiscoveredServersInterface *discoveredServersCB;
|
|
||||||
|
|
||||||
void setRunningStatus(bool value);
|
|
||||||
void setQuitStatus(bool value);
|
|
||||||
|
|
||||||
public:
|
|
||||||
BroadCastClientSocketThread(DiscoveredServersInterface *cb);
|
|
||||||
virtual void execute();
|
|
||||||
void signalQuit();
|
|
||||||
bool getQuitStatus();
|
|
||||||
bool getRunningStatus();
|
|
||||||
};
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// class ClientSocket
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
class ClientSocket: public Socket{
|
|
||||||
public:
|
|
||||||
ClientSocket();
|
|
||||||
virtual ~ClientSocket();
|
|
||||||
|
|
||||||
void connect(const Ip &ip, int port);
|
|
||||||
static void discoverServers(DiscoveredServersInterface *cb);
|
|
||||||
|
|
||||||
static void stopBroadCastClientThread();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
static BroadCastClientSocketThread *broadCastClientThread;
|
|
||||||
static void startBroadCastClientThread(DiscoveredServersInterface *cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
class BroadCastSocketThread : public Thread
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Mutex mutexRunning;
|
|
||||||
Mutex mutexQuit;
|
|
||||||
|
|
||||||
bool quit;
|
|
||||||
bool running;
|
|
||||||
|
|
||||||
void setRunningStatus(bool value);
|
|
||||||
void setQuitStatus(bool value);
|
|
||||||
|
|
||||||
public:
|
|
||||||
BroadCastSocketThread();
|
|
||||||
virtual void execute();
|
|
||||||
void signalQuit();
|
|
||||||
bool getQuitStatus();
|
|
||||||
bool getRunningStatus();
|
|
||||||
};
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// class ServerSocket
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
class ServerSocket: public Socket{
|
|
||||||
public:
|
|
||||||
ServerSocket();
|
|
||||||
virtual ~ServerSocket();
|
|
||||||
void bind(int port);
|
|
||||||
void listen(int connectionQueueSize= SOMAXCONN);
|
|
||||||
Socket *accept();
|
|
||||||
void stopBroadCastThread();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
BroadCastSocketThread *broadCastThread;
|
|
||||||
void startBroadCastThread();
|
|
||||||
bool isBroadCastThreadRunning();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}}//end namespace
|
|
||||||
|
|
||||||
#endif
|
|
@@ -147,7 +147,7 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
|||||||
memcpy(pixels+location,row_pointer[0],cinfo.output_width*cinfo.num_components);
|
memcpy(pixels+location,row_pointer[0],cinfo.output_width*cinfo.num_components);
|
||||||
} else {
|
} else {
|
||||||
int r,g,b,a,l;
|
int r,g,b,a,l;
|
||||||
for (int xPic = 0, xFile = 0; xPic < cinfo.output_width*picComponents; xPic+= picComponents, xFile+= cinfo.num_components) {
|
for (unsigned int xPic = 0, xFile = 0; xPic < cinfo.output_width*picComponents; xPic+= picComponents, xFile+= cinfo.num_components) {
|
||||||
switch(cinfo.num_components) {
|
switch(cinfo.num_components) {
|
||||||
case 3:
|
case 3:
|
||||||
r = row_pointer[0][xFile];
|
r = row_pointer[0][xFile];
|
||||||
|
75
source/shared_lib/sources/graphics/font.cpp
Normal file
75
source/shared_lib/sources/graphics/font.cpp
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2007 Marti<74>o Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class FontMetrics
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
FontMetrics::FontMetrics(){
|
||||||
|
widths= new float[Font::charCount];
|
||||||
|
height= 0;
|
||||||
|
|
||||||
|
for(int i=0; i<Font::charCount; ++i){
|
||||||
|
widths[i]= 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FontMetrics::~FontMetrics(){
|
||||||
|
delete [] widths;
|
||||||
|
}
|
||||||
|
|
||||||
|
float FontMetrics::getTextWidth(const string &str) const{
|
||||||
|
float width= 0.f;
|
||||||
|
for(unsigned int i=0; i<str.size(); ++i){
|
||||||
|
width+= widths[str[i]];
|
||||||
|
}
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
float FontMetrics::getHeight() const{
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===============================================
|
||||||
|
// class Font
|
||||||
|
// ===============================================
|
||||||
|
|
||||||
|
const int Font::charCount= 256;
|
||||||
|
|
||||||
|
Font::Font(){
|
||||||
|
inited= false;
|
||||||
|
type= "Times New Roman";
|
||||||
|
width= 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===============================================
|
||||||
|
// class Font2D
|
||||||
|
// ===============================================
|
||||||
|
|
||||||
|
Font2D::Font2D(){
|
||||||
|
size= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===============================================
|
||||||
|
// class Font3D
|
||||||
|
// ===============================================
|
||||||
|
|
||||||
|
Font3D::Font3D(){
|
||||||
|
depth= 10.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}}//end namespace
|
@@ -177,7 +177,7 @@ void Mesh::loadV3(const string &dir, FILE *f, TextureManager *textureManager){
|
|||||||
readBytes = fread(vertices, sizeof(Vec3f)*frameCount*vertexCount, 1, f);
|
readBytes = fread(vertices, sizeof(Vec3f)*frameCount*vertexCount, 1, f);
|
||||||
readBytes = fread(normals, sizeof(Vec3f)*frameCount*vertexCount, 1, f);
|
readBytes = fread(normals, sizeof(Vec3f)*frameCount*vertexCount, 1, f);
|
||||||
if(textures[mtDiffuse]!=NULL){
|
if(textures[mtDiffuse]!=NULL){
|
||||||
for(int i=0; i<meshHeader.texCoordFrameCount; ++i){
|
for(unsigned int i=0; i<meshHeader.texCoordFrameCount; ++i){
|
||||||
readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f);
|
readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,11 +278,11 @@ void Mesh::save(const string &dir, FILE *f){
|
|||||||
void Mesh::computeTangents(){
|
void Mesh::computeTangents(){
|
||||||
delete [] tangents;
|
delete [] tangents;
|
||||||
tangents= new Vec3f[vertexCount];
|
tangents= new Vec3f[vertexCount];
|
||||||
for(int i=0; i<vertexCount; ++i){
|
for(unsigned int i=0; i<vertexCount; ++i){
|
||||||
tangents[i]= Vec3f(0.f);
|
tangents[i]= Vec3f(0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<indexCount; i+=3){
|
for(unsigned int i=0; i<indexCount; i+=3){
|
||||||
for(int j=0; j<3; ++j){
|
for(int j=0; j<3; ++j){
|
||||||
uint32 i0= indices[i+j];
|
uint32 i0= indices[i+j];
|
||||||
uint32 i1= indices[i+(j+1)%3];
|
uint32 i1= indices[i+(j+1)%3];
|
||||||
@@ -306,7 +306,7 @@ void Mesh::computeTangents(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<vertexCount; ++i){
|
for(unsigned int i=0; i<vertexCount; ++i){
|
||||||
/*Vec3f binormal= normals[i].cross(tangents[i]);
|
/*Vec3f binormal= normals[i].cross(tangents[i]);
|
||||||
tangents[i]+= binormal.cross(normals[i]);*/
|
tangents[i]+= binormal.cross(normals[i]);*/
|
||||||
tangents[i].normalize();
|
tangents[i].normalize();
|
||||||
@@ -332,19 +332,19 @@ Model::~Model(){
|
|||||||
// ==================== data ====================
|
// ==================== data ====================
|
||||||
|
|
||||||
void Model::buildInterpolationData() const{
|
void Model::buildInterpolationData() const{
|
||||||
for(int i=0; i<meshCount; ++i){
|
for(unsigned int i=0; i<meshCount; ++i){
|
||||||
meshes[i].buildInterpolationData();
|
meshes[i].buildInterpolationData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::updateInterpolationData(float t, bool cycle) const{
|
void Model::updateInterpolationData(float t, bool cycle) const{
|
||||||
for(int i=0; i<meshCount; ++i){
|
for(unsigned int i=0; i<meshCount; ++i){
|
||||||
meshes[i].updateInterpolationData(t, cycle);
|
meshes[i].updateInterpolationData(t, cycle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::updateInterpolationVertices(float t, bool cycle) const{
|
void Model::updateInterpolationVertices(float t, bool cycle) const{
|
||||||
for(int i=0; i<meshCount; ++i){
|
for(unsigned int i=0; i<meshCount; ++i){
|
||||||
meshes[i].updateInterpolationVertices(t, cycle);
|
meshes[i].updateInterpolationVertices(t, cycle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
#include <sys/filio.h>
|
#include <sys/filio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <net/if.h>
|
|
||||||
|
|
||||||
#include "conversion.h"
|
#include "conversion.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@@ -34,7 +33,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#include <iphlpapi.h>
|
#include <iphlpapi.h>
|
||||||
//#include <strstream>
|
#include <strstream>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
//#include <net/if.h>
|
#include <net/if.h>
|
||||||
//#include <sys/ioctl.h>
|
//#include <sys/ioctl.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -164,7 +163,7 @@ namespace Shared{ namespace Platform{
|
|||||||
// must copy the data from this function before you call it again. It
|
// must copy the data from this function before you call it again. It
|
||||||
// follows that this function is also not thread-safe.
|
// follows that this function is also not thread-safe.
|
||||||
const char* WSAGetLastErrorMessage(const char* pcMessagePrefix,
|
const char* WSAGetLastErrorMessage(const char* pcMessagePrefix,
|
||||||
int nErrorID /* = 0 */)
|
int nErrorID = 0 )
|
||||||
{
|
{
|
||||||
// Build basic error string
|
// Build basic error string
|
||||||
static char acErrorBuffer[256];
|
static char acErrorBuffer[256];
|
||||||
@@ -232,12 +231,12 @@ int getLastSocketError() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char * getLastSocketErrorText(int *errNumber=NULL) {
|
const char * getLastSocketErrorText(int *errNumber=NULL) {
|
||||||
int errId = (errNumber != NULL ? *errNumber : getLastSocketError());
|
int errId = (errNumber != NULL ? *errNumber : getLastSocketError());
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
return strerror(errId);
|
return strerror(errId);
|
||||||
#else
|
#else
|
||||||
return WSAGetLastErrorMessage(errId);
|
return WSAGetLastErrorMessage("",errId);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1680,8 +1679,8 @@ void BroadCastSocketThread::execute() {
|
|||||||
char myhostname[100]; // hostname of local machine
|
char myhostname[100]; // hostname of local machine
|
||||||
char subnetmask[MAX_NIC_COUNT][100]; // Subnet mask to broadcast to
|
char subnetmask[MAX_NIC_COUNT][100]; // Subnet mask to broadcast to
|
||||||
struct hostent* myhostent;
|
struct hostent* myhostent;
|
||||||
char * ptr; // some transient vars
|
//char * ptr; // some transient vars
|
||||||
int len,i;
|
//int len,i;
|
||||||
|
|
||||||
/* get my host name */
|
/* get my host name */
|
||||||
gethostname(myhostname,100);
|
gethostname(myhostname,100);
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user