GameServer - Pre-merge with graphic

This commit is contained in:
Dennis Andersen 2014-01-31 22:52:52 +01:00
parent 5aede62af6
commit a673e64694
22 changed files with 161 additions and 171 deletions

View File

@ -56,7 +56,8 @@ namespace DanBias
{
WindowShell::CreateConsoleWindow();
if(! m_data->window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT())))
//if(! m_data->window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT())))
if(! m_data->window->CreateWin(WindowShell::WINDOW_INIT_DESC()))
return DanBiasClientReturn_Error;
if( FAILED( InitDirect3D() ) )
@ -200,6 +201,8 @@ namespace DanBias
delete m_data->recieverObj;
delete m_data->inputObj;
delete m_data;
GameServerAPI::ServerStop();
Oyster::Graphics::API::Clean();

View File

@ -33,7 +33,8 @@ GameState::GameState(void)
GameState::~GameState(void)
{
delete this->camera;
delete this->privData;
}
bool GameState::Init(Oyster::Network::NetworkClient* nwClient)
{
@ -82,7 +83,7 @@ bool GameState::LoadModels(std::wstring mapFile)
C_Object* obj;
translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(0,0,0));
modelData.world = translate ;//modelData.world * translate
modelData.modelPath = L"world_earth.dan";
modelData.modelPath = L"..\\Content\\Models\\world_earth.dan";
modelData.id = 0;
obj = new C_Player();

View File

@ -93,7 +93,6 @@ void Game::CreateTeam()
bool Game::NewFrame()
{
for (unsigned int i = 0; i < this->players.Size(); i++)
{
if(this->players[i]->player) this->players[i]->player->BeginFrame();
@ -105,28 +104,7 @@ bool Game::NewFrame()
{
if(this->players[i]->player) this->players[i]->player->EndFrame();
}
for (unsigned int i = 0; i < this->players.Size(); i++)
{
if(this->players[i]->player) this->players[i]->player->BeginFrame();
}
API::Instance().Update();
for (unsigned int i = 0; i < this->players.Size(); i++)
{
if(this->players[i]->player) this->players[i]->player->EndFrame();
}
for (unsigned int i = 0; i < this->players.Size(); i++)
{
if(this->players[i]->player) this->players[i]->player->BeginFrame();
}
API::Instance().Update();
for (unsigned int i = 0; i < this->players.Size(); i++)
{
if(this->players[i]->player) this->players[i]->player->EndFrame();
}
gameInstance.onMoveFnc(this->level);
@ -161,6 +139,7 @@ bool Game::Initiate()
{
API::Instance().Init((int)pow(2u, 9u), 1u, Oyster::Math::Float3());
API::Instance().SetSubscription(Game::PhysicsOnDestroy);
API::Instance().SetFrameTimeLength(1.0f/120.0f);
this->initiated = true;
return true;
}

View File

@ -36,11 +36,11 @@ namespace GameLogic
this->status = state;
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = status;
return &protocol;
return protocol;
}
private:
@ -59,12 +59,12 @@ namespace GameLogic
destination = p.Get(1).value.netInt;
text = p.Get(2).value.netCharPtr;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol.Set(0, protocol_General_Text, Oyster::Network::NetAttributeType_Short);
this->protocol.Set(1, destination, Oyster::Network::NetAttributeType_Int);
this->protocol.Set(2, text);
return &protocol;
return protocol;
}
private:

View File

@ -33,7 +33,7 @@ namespace GameLogic
mapName = o[1].value.netCharPtr;
gameId = o[2].value.netChar;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
protocol[1].value = mapName;
protocol[2].value = gameId;
@ -59,10 +59,10 @@ namespace GameLogic
{
gameId = o[1].value.netInt;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
protocol[1].value = gameId;
return &protocol;
return protocol;
}
private:
@ -83,9 +83,9 @@ namespace GameLogic
{
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
return &protocol;
return protocol;
}
private:
@ -109,7 +109,7 @@ namespace GameLogic
// this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
// value = p[1].value.netShort;
// }
// Oyster::Network::CustomNetProtocol* GetProtocol() override
// Oyster::Network::CustomNetProtocol GetProtocol() override
// {
// protocol[1].value = value;
// return &protocol;
@ -130,8 +130,8 @@ namespace GameLogic
{
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
{ return &protocol; }
Oyster::Network::CustomNetProtocol GetProtocol() override
{ return protocol; }
private:
Oyster::Network::CustomNetProtocol protocol;
@ -175,7 +175,7 @@ namespace GameLogic
list.Push(d);
}
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = list.Size();
@ -195,7 +195,7 @@ namespace GameLogic
this->protocol.Set(a++, list[i].ip);
}
return &protocol;
return protocol;
}
private:
@ -223,13 +223,13 @@ namespace GameLogic
minorVersion = (int)p.Get(2).value.netInt;
mapName = p.Get(3).value.netCharPtr;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = majorVersion;
this->protocol[2].value = minorVersion;
this->protocol.Set(3, mapName.c_str());
return &protocol;
return protocol;
}
private:
@ -254,7 +254,7 @@ namespace GameLogic
// {
//
// }
// Oyster::Network::CustomNetProtocol* GetProtocol() override
// Oyster::Network::CustomNetProtocol GetProtocol() override
// {
// return &protocol;
// }

View File

@ -39,11 +39,11 @@ namespace GameLogic
pickup_ID = pickupID;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
this->protocol[2].value = pickup_ID;
return &protocol;
return protocol;
}
private:
@ -80,11 +80,11 @@ namespace GameLogic
object_ID = id;
health = hp;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
this->protocol[2].value = health;
return &protocol;
return protocol;
}
private:
@ -129,14 +129,14 @@ namespace GameLogic
object_ID = id;
memcpy(&worldMatrix[0], &m[0], sizeof(float)*16);
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
for (int i = 2; i <= 17; i++)
{
this->protocol[i].value = worldMatrix[i-2];
}
return &protocol;
return protocol;
}
private:
@ -179,14 +179,14 @@ namespace GameLogic
object_ID = id;
memcpy(&worldMatrix[0], &m[0], sizeof(float)*16);
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
for (int i = 2; i <= 17; i++)
{
this->protocol[i].value = worldMatrix[i-2];
}
return &protocol;
return protocol;
}
private:
@ -221,11 +221,11 @@ namespace GameLogic
object_ID = id;
timer = time;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
this->protocol[2].value = timer;
return &protocol;
return protocol;
}
private:
@ -272,7 +272,7 @@ namespace GameLogic
this->name = path;
memcpy(&worldMatrix[0], &m[0], sizeof(float)*16);
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
@ -297,7 +297,7 @@ namespace GameLogic
return &protocol;
return protocol;
}
private:

View File

@ -49,14 +49,14 @@ namespace GameLogic
return *this;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = bForward;
this->protocol[2].value = bBackward;
this->protocol[3].value = bLeft;
this->protocol[4].value = bRight;
return &protocol;
return protocol;
}
private:
@ -94,13 +94,13 @@ namespace GameLogic
return *this;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = lookDirX;
this->protocol[2].value = lookDirY;
this->protocol[3].value = lookDirZ;
return &protocol;
return protocol;
}
private:
@ -125,9 +125,9 @@ namespace GameLogic
{
return *this;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
return &protocol;
return protocol;
}
private:
@ -154,10 +154,10 @@ namespace GameLogic
hasShot = val[1].value.netBool;
return *this;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = hasShot;
return &protocol;
return protocol;
}
private:
@ -184,10 +184,10 @@ namespace GameLogic
hasJumped = val[1].value.netBool;
return *this;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = hasJumped;
return &protocol;
return protocol;
}
private:

View File

@ -52,6 +52,7 @@ namespace DanBias
private:
Utility::WinTimer timer;
float refreshFrequency;
GameSession gameSession;
LobbyLevelData description;
};

View File

@ -55,6 +55,7 @@ namespace DanBias
inline bool IsCreated() const { return this->isCreated; }
inline bool IsRunning() const { return this->isRunning; }
operator bool() { return (this->isCreated && this->isCreated); }
//Private member functions
private:
@ -97,7 +98,9 @@ namespace DanBias
NetworkSession* owner;
bool isCreated;
bool isRunning;
Utility::WinTimer timer;
float logicDeltaTime;
Utility::WinTimer logicTimer;
Utility::WinTimer networkTimer;
GameDescription description;
//TODO: Remove this uggly hax

View File

@ -17,7 +17,9 @@ namespace DanBias
{ }
GameLobby::~GameLobby()
{ }
{
this->clients.Clear();
}
void GameLobby::Release()
{
@ -27,7 +29,7 @@ namespace DanBias
void GameLobby::Update()
{
if(GetAsyncKeyState(VK_DOWN)) //TODO: Dont forget to remove this...
this->Send(*GameLogic::Protocol_General_Status().GetProtocol());
this->Send(GameLogic::Protocol_General_Status().GetProtocol());
this->ProcessClients();
}
@ -85,29 +87,36 @@ namespace DanBias
void GameLobby::ClientConnectedEvent(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client)
{
printf("New client(%i) connected - %s \n", client->GetID(), client->GetIpAddress().c_str());
Attach(client);
Protocol_LobbyClientData p1;
Protocol_LobbyGameData p2;
for (unsigned int i = 0; i < this->clients.Size(); i++)
if(this->gameSession)
{
if(this->clients[i])
{
Protocol_LobbyClientData::PlayerData t;
t.id = this->clients[i]->GetID();
t.ip = this->clients[i]->GetIpAddress();
t.team = 0;
t.name = "DennisÄrKung";
p1.list.Push(t);
}
this->gameSession.ClientConnectedEvent(client);
}
p2.majorVersion = 1;
p2.minorVersion = 0;
p2.mapName = "BetsMap";
else
{
Attach(client);
Protocol_LobbyClientData p1;
Protocol_LobbyGameData p2;
for (unsigned int i = 0; i < this->clients.Size(); i++)
{
if(this->clients[i])
{
Protocol_LobbyClientData::PlayerData t;
t.id = this->clients[i]->GetID();
t.ip = this->clients[i]->GetIpAddress();
t.team = 0;
t.name = "Dennis är kung tycker Erik!";
p1.list.Push(t);
}
}
p2.majorVersion = 1;
p2.minorVersion = 0;
p2.mapName = "Dennis är kung tycker Erik!";
client->Send(p1.GetProtocol());
client->Send(p2.GetProtocol());
client->Send(p1.GetProtocol());
client->Send(p2.GetProtocol());
}
}
}//End namespace DanBias

View File

@ -53,6 +53,7 @@ void GameServerAPI::ServerStart()
}
void GameServerAPI::ServerStop()
{
if(!server.IsStarted()) return;
lobby.Release();
server.Shutdown();

View File

@ -29,16 +29,15 @@ namespace DanBias
{
if(this->isRunning)
{
double dt = this->timer.getElapsedSeconds();
gameInstance.SetFrameTimeLength((float)dt);
if(dt >= DELTA_TIME_20)
float dt = (float)this->logicTimer.getElapsedSeconds();
this->logicDeltaTime += dt;
this->logicTimer.reset();
while( logicDeltaTime >= DELTA_TIME_120 )
{
this->ProcessClients();
this->gameInstance.NewFrame();
this->timer.reset();
logicDeltaTime -= DELTA_TIME_120;
}
}
@ -72,7 +71,7 @@ namespace DanBias
break;
case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend:
printf("\t(%i : %s) - EventType_ProtocolFailedToSend\n", e.sender->GetID(), e.sender->GetIpAddress().c_str());
this->Detach(e.sender)->Disconnect();
this->Detach(e.sender);
break;
case NetworkClient::ClientEventArgs::EventType_ProtocolRecieved:
printf("\t(%i : %s) - EventType_ProtocolRecieved\n", e.sender->GetID(), e.sender->GetIpAddress().c_str());
@ -83,43 +82,48 @@ namespace DanBias
void GameSession::ObjectMove(GameLogic::IObjectData* movedObject)
{
if(dynamic_cast<IPlayerData*> (movedObject))
if(gameSession->networkTimer.getElapsedSeconds() >= DELTA_TIME_60)
{
IPlayerData* temp = (IPlayerData*)movedObject;
gameSession->networkTimer.reset();
if(dynamic_cast<IPlayerData*> (movedObject))
{
IPlayerData* temp = (IPlayerData*)movedObject;
int id = temp->GetID();
Oyster::Math::Float4x4 world = temp->GetOrientation();
int id = temp->GetID();
Oyster::Math::Float4x4 world = temp->GetOrientation();
Protocol_ObjectPosition p(world, id);
GameSession::gameSession->Send(*p.GetProtocol());
Protocol_ObjectPosition p(world, id);
GameSession::gameSession->Send(*p.GetProtocol());
}
if(dynamic_cast<GameLogic::ILevelData*>(movedObject))
{
GameLogic::IObjectData* obj = NULL;
obj = ((GameLogic::ILevelData*)movedObject)->GetObjectAt(0);
if(obj)
{
if(obj->GetObjectType() == OBJECT_TYPE_WORLD)
GameLogic::IObjectData* obj = NULL;
obj = ((GameLogic::ILevelData*)movedObject)->GetObjectAt(0);
if(obj)
{
int id = obj->GetID();
Oyster::Math::Float4x4 world =obj->GetOrientation();
if(obj->GetObjectType() == OBJECT_TYPE_WORLD)
{
int id = obj->GetID();
Oyster::Math::Float4x4 world =obj->GetOrientation();
Protocol_ObjectPosition p(world, id);
GameSession::gameSession->Send(*p.GetProtocol());
Protocol_ObjectPosition p(world, id);
gameSession->Send(p.GetProtocol());
}
}
}
obj = NULL;
obj =((GameLogic::ILevelData*)movedObject)->GetObjectAt(1);
if(obj)
{
if(obj->GetObjectType() == OBJECT_TYPE_BOX)
obj = NULL;
obj =((GameLogic::ILevelData*)movedObject)->GetObjectAt(1);
if(obj)
{
int id = obj->GetID();
Oyster::Math::Float4x4 world = obj->GetOrientation();
Protocol_ObjectPosition p(world, id);
GameSession::gameSession->Send(*p.GetProtocol());
if(obj->GetObjectType() == OBJECT_TYPE_BOX)
{
int id = obj->GetID();
Oyster::Math::Float4x4 world = obj->GetOrientation();
Protocol_ObjectPosition p(world, id);
gameSession->Send(p.GetProtocol());
}
}
}
}

View File

@ -28,6 +28,7 @@ namespace DanBias
this->isCreated = false;
this->isRunning = false;
this->gameSession = this;
this->logicDeltaTime = 0.0f;
memset(&this->description, 0, sizeof(GameDescription));
}

View File

@ -284,7 +284,7 @@ HRESOURCE ResourceManager::LoadResource(const wchar_t filename[], LoadFunction l
{
return 0;
}
if(!loadFnc)
if(!loadFnc || !unloadFnc)
{
return 0;
}
@ -292,6 +292,8 @@ HRESOURCE ResourceManager::LoadResource(const wchar_t filename[], LoadFunction l
ResourceData *t = FindResource(this->resources, filename);
if(t)
{
t->loadFnc = loadFnc;
t->unloadFnc = unloadFnc;
if(force)
{
return ResourceManager::ReloadResource(filename);

View File

@ -40,6 +40,7 @@ namespace Utility
public:
Type item;
Node *next;
Node(){ this->next = NULL; };
Node(Type item){ this->item = item; this->next = NULL; };
~Node() {};
};

View File

@ -4,7 +4,6 @@
#include "CustomNetProtocol.h"
#include <map>
#include "Translator.h"
#include "Utilities.h"
using namespace Oyster::Network;
using namespace Utility::DynamicMemory;
@ -12,23 +11,17 @@ using namespace Utility::DynamicMemory;
struct CustomNetProtocol::PrivateData
{
std::map<int, NetAttributeContainer> attributes; //...Im an idiot
Utility::DynamicMemory::ReferenceCount *c;
PrivateData()
{
//this->attributes = new std::map<int, NetAttributeContainer>();
this->c = new ReferenceCount();
c->Incref();
}
{ }
~PrivateData()
{
delete c;
c = 0;
for (auto i = attributes.begin(); i != attributes.end(); i++)
{
RemoveAttribute(i->first);
}
attributes.clear();
}
void RemoveAttribute(int ID)
@ -55,39 +48,14 @@ CustomNetProtocol::CustomNetProtocol()
CustomNetProtocol::CustomNetProtocol(const CustomNetProtocol& o)
{
this->privateData = o.privateData;
if(this->privateData)
{
this->privateData->c = o.privateData->c;
this->privateData->c->Incref();
}
}
const CustomNetProtocol& CustomNetProtocol::operator=(const CustomNetProtocol& o)
{
if(this->privateData && this->privateData->c)
{
if(this->privateData->c->Decref() == 0)
{
delete this->privateData;
}
}
this->privateData = o.privateData;
if(this->privateData)
{
this->privateData->c = o.privateData->c;
this->privateData->c->Incref();
}
return *this;
}
CustomNetProtocol::~CustomNetProtocol()
{
if(this->privateData && this->privateData->c)
{
if(this->privateData->c->Decref() == 0)
{
delete this->privateData;
}
}
}
NetAttributeContainer& CustomNetProtocol::operator[](int ID)
{

View File

@ -4,7 +4,11 @@
#ifndef NETWORK_CUSTOM_NETWORK_PROTOCOL_H
#define NETWORK_CUSTOM_NETWORK_PROTOCOL_H
//needs to have dll-interface to be used by clients of class 'Oyster::Network::NetworkSession'
#pragma warning(disable : 4251)
#include <string>
#include "Utilities.h"
//#include <vld.h>
#include "NetworkAPI_Preprocessor.h"
@ -70,7 +74,7 @@ namespace Oyster
class CustomNetProtocol;
struct CustomProtocolObject
{
virtual CustomNetProtocol* GetProtocol() = 0;
virtual CustomNetProtocol GetProtocol() = 0;
};
class NET_API_EXPORT CustomNetProtocol
@ -88,7 +92,7 @@ namespace Oyster
private:
struct PrivateData;
PrivateData* privateData;
Utility::DynamicMemory::SmartPointer<PrivateData> privateData;
friend class Translator;
};

View File

@ -19,6 +19,7 @@
#include "../../Misc/Packing/Packing.h"
#include <queue>
#include <WinSock2.h>
using namespace Oyster::Network;
using namespace Oyster::Thread;
@ -83,12 +84,12 @@ struct NetworkClient::PrivateData : public IThreadObject
if(!this->sendQueue.IsEmpty())
{
SmartPointer<OysterByte> temp = new OysterByte();
OysterByte temp;
CustomNetProtocol p = this->sendQueue.Pop();
this->translator.Pack(temp, p);
errorCode = this->connection.Send(temp);
if(errorCode != 0)
if(errorCode != 0 && errorCode != WSAEWOULDBLOCK)
{
CEA parg;
parg.type = CEA::EventType_ProtocolFailedToSend;
@ -299,12 +300,12 @@ void NetworkClient::Disconnect()
void NetworkClient::Send(CustomProtocolObject& protocol)
{
this->privateData->sendQueue.Push(*protocol.GetProtocol());
this->privateData->sendQueue.Push(protocol.GetProtocol());
}
void NetworkClient::Send(CustomNetProtocol* protocol)
void NetworkClient::Send(CustomNetProtocol protocol)
{
this->privateData->sendQueue.Push(*protocol);
this->privateData->sendQueue.Push(protocol);
}
void NetworkClient::SetOwner(NetworkSession* owner)

View File

@ -75,7 +75,7 @@ namespace Oyster
/**
*
*/
void Send(CustomNetProtocol* protocol);
void Send(CustomNetProtocol protocol);
/**
*

View File

@ -26,7 +26,15 @@ struct NetworkSession::PrivateSessionData
{}
};
int FindClient(NetClientList& list, NetClient c)
{
for (unsigned int i = 0; i < list.Size(); i++)
{
if(c == list[i])
return i;
}
return -1;
}
NetworkSession::NetworkSession()
: data(new PrivateSessionData())
@ -188,7 +196,7 @@ bool NetworkSession::Send(Oyster::Network::CustomNetProtocol& protocol)
{
if(this->clients[i])
{
this->clients[i]->Send(&protocol);
this->clients[i]->Send(protocol);
returnValue = true;
}
}
@ -202,7 +210,7 @@ bool NetworkSession::Send(Oyster::Network::CustomNetProtocol& protocol, int ID)
{
if(this->clients[i] && this->clients[i]->GetID() == ID)
{
this->clients[i]->Send(&protocol);
this->clients[i]->Send(protocol);
return true;
}
}
@ -237,5 +245,8 @@ void NetworkSession::SetOwner(NetworkSession* owner)
void NetworkSession::ClientConnectedEvent(NetClient client)
{
this->Attach(client);
if(FindClient(this->clients, client) == -1)
NetworkSession::Attach(client);
}

View File

@ -15,10 +15,11 @@ using namespace ::Messages;
using namespace Utility::DynamicMemory;
using namespace std;
//TODO: Fix this uggly hack
struct MyCastingStruct
{
std::map<int, NetAttributeContainer> attributes;
Utility::DynamicMemory::ReferenceCount *c;
};
// TODO: Check if the package has been packed correctly.
@ -33,8 +34,8 @@ struct Translator::PrivateData
//Packages a header with a size(int) and a string of characters(char)
void PackHeader(OysterByte &bytes, CustomNetProtocol& protocol)
{
auto it = ((MyCastingStruct*)protocol.privateData)->attributes.begin();
auto end = ((MyCastingStruct*)protocol.privateData)->attributes.end();
auto it = ((MyCastingStruct*)protocol.privateData.Get())->attributes.begin();
auto end = ((MyCastingStruct*)protocol.privateData.Get())->attributes.end();
size = 4; //size(int)
message.SetSize(0);
@ -60,8 +61,8 @@ struct Translator::PrivateData
void PackMessage(OysterByte &bytes, CustomNetProtocol& protocol)
{
auto it = ((MyCastingStruct*)protocol.privateData)->attributes.begin();
auto end = ((MyCastingStruct*)protocol.privateData)->attributes.end();
auto it = ((MyCastingStruct*)protocol.privateData.Get())->attributes.begin();
auto end = ((MyCastingStruct*)protocol.privateData.Get())->attributes.end();
for(int i = 0; i < (int)headerString.size(); i++, it++)
{

View File

@ -7,7 +7,7 @@ RWTexture2D<float4> Output;
[numthreads(16, 16, 1)]
void main( uint3 DTid : SV_DispatchThreadID )
{
Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/4].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW
Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy];// + Diffuse[DTid.xy] * Ambient[DTid.xy/4].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW
//Output[DTid.xy] = Diffuse[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/4].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW
//Output[DTid.xy] = Diffuse[DTid.xy];