@@ -20,25 +20,25 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#include "platform/platform.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include "core/strings/stringFunctions.h"
#import "platform/platform.h"
#import <stdlib.h>
#import <stdarg.h>
#import <string.h>
#import <ctype.h>
#import <stdio.h>
#import "core/strings/stringFunctions.h"

char *dStrnew(const char *src)
{
char *buffer = new char[dStrlen(src) + 1];
dStrcpy(buffer, src);
return buffer;
}
}

char* dStrstr(char *str1, char *str2)
{
return strstr(str1,str2);
}
}

int dSprintf(char *buffer, dsize_t /*bufferSize*/, const char *format, ...)
{
@@ -47,15 +47,15 @@ int dSprintf(char *buffer, dsize_t /*bufferSize*/, const char *format, ...)
S32 len = vsprintf(buffer, format, args);
va_end(args);
return (len);
}
}


int dVsprintf(char *buffer, dsize_t /*bufferSize*/, const char *format, void *arglist)
int dVsprintf(char *buffer, dsize_t /*bufferSize*/, const char *format, va_list arglist)
{
S32 len = vsprintf(buffer, format, (char*)arglist);

S32 len = vsprintf(buffer, format, arglist);
return (len);
}
}

int dFflushStdout()
{
@@ -20,10 +20,11 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#include <CoreServices/CoreServices.h>
#include "platform/platformTimer.h"
#include <time.h>
#include <unistd.h>
#import <CoreServices/CoreServices.h>
#import <mach/mach_time.h>
#import "platform/platformTimer.h"
#import <time.h>
#import <unistd.h>

//--------------------------------------

@@ -81,18 +82,17 @@ U32 Platform::getTime()
/// Storing milliseconds in a U32 overflows every 49.71 days
U32 Platform::getRealMilliseconds()
{
// Duration is a S32 value.
// if negative, it is in microseconds.
// if positive, it is in milliseconds.
Duration durTime = AbsoluteToDuration(UpTime());
U32 ret;
if( durTime < 0 )
ret = durTime / -1000;
else
ret = durTime;

return ret;
}
const uint32_t oneMillion = 1000000;
static mach_timebase_info_data_t s_timebase_info;

if (s_timebase_info.denom == 0) {
(void) mach_timebase_info(&s_timebase_info);
}

// mach_absolute_time() returns billionth of seconds,
// so divide by one million to get milliseconds
return (U32)((mach_absolute_time() * s_timebase_info.numer) / (oneMillion * s_timebase_info.denom));
}

U32 Platform::getVirtualMilliseconds()
{
@@ -23,13 +23,8 @@
#ifndef _MACCARBVOLUME_H_
#define _MACCARBVOLUME_H_

#ifndef _POSIXVOLUME_H_
#include "platformPOSIX/posixVolume.h"
#endif
#ifndef _TVECTOR_H_
#include "core/util/tVector.h"
#endif

#import "platformPOSIX/posixVolume.h"
#import "core/util/tVector.h"

class MacFileSystem;

@@ -20,16 +20,11 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#include <CoreServices/CoreServices.h>

#include "platform/platform.h"
#include "platformMac/macCarbVolume.h"
#include "platform/platformVolume.h"
#include "console/console.h"


//#define DEBUG_SPEW

#import <CoreServices/CoreServices.h>
#import "platform/platform.h"
#import "platformMac/macVolume.h"
#import "platform/platformVolume.h"
#import "console/console.h"

struct MacFileSystemChangeNotifier::Event
{
@@ -38,7 +33,6 @@ struct MacFileSystemChangeNotifier::Event
bool mHasChanged;
};


static void fsNotifyCallback(
ConstFSEventStreamRef stream,
void* callbackInfo,

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
@@ -11,12 +11,6 @@ namespace PlatformGL

void init()
{
static bool inited = false;

if(inited)
return;

inited = true;
const U32 majorOGL = 3;
const U32 minorOGL = 2;
U32 debugFlag = 0;
@@ -28,6 +22,9 @@ namespace PlatformGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minorOGL);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, debugFlag);
#ifdef TORQUE_GL_SOFTWARE
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 0);
#endif

SDL_ClearError();
}
@@ -20,19 +20,48 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

//
// macApplication.h
// T3D
//
// Created by admin account on 2/1/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#include "console/console.h"
#include "platform/threads/mutex.h"
#include "core/util/safeDelete.h"

#include <SDL.h>
#include <SDL_thread.h>

struct PlatformMutexData
{
SDL_mutex *mutex;
};

#import <Cocoa/Cocoa.h>
Mutex::Mutex()
{
mData = new PlatformMutexData;
mData->mutex = SDL_CreateMutex();
}

Mutex::~Mutex()
{
AssertFatal(mData, "Mutex::destroyMutex: invalid mutex");
SDL_DestroyMutex(mData->mutex);
SAFE_DELETE(mData);
}

@interface macApplication : NSApplication
bool Mutex::lock(bool block)
{
if(mData == NULL)
return false;
if(block)
{
return SDL_LockMutex(mData->mutex) == 0;
}
else
{
return SDL_TryLockMutex(mData->mutex) == 0;
}
}

@end
void Mutex::unlock()
{
if(mData == NULL)
return;
SDL_UnlockMutex(mData->mutex);
}
@@ -0,0 +1,87 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#include "platform/platformAssert.h"
#include "platform/threads/semaphore.h"
#include <SDL.h>
#include <SDL_thread.h>

struct PlatformSemaphore
{
SDL_sem *semaphore;

PlatformSemaphore(S32 initialCount)
{
semaphore = SDL_CreateSemaphore(initialCount);
AssertFatal(semaphore, "PlatformSemaphore constructor - Failed to create SDL Semaphore.");
}

~PlatformSemaphore()
{
SDL_DestroySemaphore(semaphore);
}
};

Semaphore::Semaphore(S32 initialCount)
{
mData = new PlatformSemaphore(initialCount);
}

Semaphore::~Semaphore()
{
AssertFatal(mData, "Semaphore destructor - Invalid semaphore.");
delete mData;
}

bool Semaphore::acquire(bool block, S32 timeoutMS)
{
AssertFatal(mData && mData->semaphore, "Semaphore::acquire - Invalid semaphore.");
if (block)
{
// Semaphore acquiring is different from the MacOS/Win realization because SDL_SemWaitTimeout() with "infinite" timeout can be too heavy on some platforms.
// (see "man SDL_SemWaitTimeout(3)" for more info)
// "man" states to avoid the use of SDL_SemWaitTimeout at all, but at current stage this looks like a valid and working solution, so keeping it this way.
// [bank / Feb-2010]
if (timeoutMS == -1)
{
if (SDL_SemWait(mData->semaphore) < 0)
AssertFatal(false, "Semaphore::acquie - Wait failed.");
}
else
{
if (SDL_SemWaitTimeout(mData->semaphore, timeoutMS) < 0)
AssertFatal(false, "Semaphore::acquie - Wait with timeout failed.");
}
return (true);
}
else
{
int res = SDL_SemTryWait(mData->semaphore);
return (res == 0);
}
}

void Semaphore::release()
{
AssertFatal(mData, "Semaphore::releaseSemaphore - Invalid semaphore.");
SDL_SemPost(mData->semaphore);
}
@@ -20,11 +20,12 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#include <pthread.h>
#include "platform/threads/thread.h"
#include "platform/threads/semaphore.h"
#include "platform/threads/mutex.h"
#include <stdlib.h>
#include <SDL.h>
#include <SDL_thread.h>

class PlatformThreadData
{
@@ -33,7 +34,8 @@ class PlatformThreadData
void* mRunArg;
Thread* mThread;
Semaphore mGateway; // default count is 1
U32 mThreadID;
SDL_threadID mThreadID;
SDL_Thread* mSdlThread;
bool mDead;
};

@@ -45,16 +47,12 @@ ThreadManager::MainThreadId ThreadManager::smMainThreadId;
// Neccesary because Thread::run() is provided as a non-threaded
// way to execute the thread's run function. So we have to keep
// track of the thread's lock here.
static void *ThreadRunHandler(void * arg)
static int ThreadRunHandler(void * arg)
{
PlatformThreadData *mData = reinterpret_cast<PlatformThreadData*>(arg);
Thread *thread = mData->mThread;

// mThreadID is filled in twice, once here and once in pthread_create().
// We fill in mThreadID here as well as in pthread_create() because addThread()
// can execute before pthread_create() returns and sets mThreadID.
// The value from pthread_create() and pthread_self() are guaranteed to be equivalent (but not identical)
mData->mThreadID = ThreadManager::getCurrentThreadId();
mData->mThreadID = SDL_ThreadID();

ThreadManager::addThread(thread);
thread->run(mData->mRunArg);
@@ -69,9 +67,7 @@ static void *ThreadRunHandler(void * arg)
if( autoDelete )
delete thread;

// return value for pthread lib's benefit
return NULL;
// the end of this function is where the created pthread will die.
return 0;
}

//-----------------------------------------------------------------------------
@@ -85,6 +81,7 @@ Thread::Thread(ThreadRunFunction func, void* arg, bool start_thread, bool autode
mData->mThread = this;
mData->mThreadID = 0;
mData->mDead = false;
mData->mSdlThread = NULL;
autoDelete = autodelete;
}

@@ -94,6 +91,7 @@ Thread::~Thread()
if( isAlive() )
join();


delete mData;
}

@@ -111,14 +109,12 @@ void Thread::start( void* arg )
if( !mData->mRunArg )
mData->mRunArg = arg;

pthread_create((pthread_t*)(&mData->mThreadID), NULL, ThreadRunHandler, mData);
mData->mSdlThread = SDL_CreateThread(ThreadRunHandler,NULL,mData);

}

bool Thread::join()
{
// not using pthread_join here because pthread_join cannot deal
// with multiple simultaneous calls.

{
mData->mGateway.acquire();
AssertFatal( !isAlive(), "Thread::join() - thread not dead after join()" );
mData->mGateway.release();
@@ -139,7 +135,7 @@ bool Thread::isAlive()

U32 Thread::getId()
{
return mData->mThreadID;
return (U32)mData->mThreadID;
}

void Thread::_setName( const char* )
@@ -150,10 +146,10 @@ void Thread::_setName( const char* )

U32 ThreadManager::getCurrentThreadId()
{
return (U32)pthread_self();
return (U32)SDL_ThreadID();
}

bool ThreadManager::compare(U32 threadId_1, U32 threadId_2)
{
return pthread_equal((_opaque_pthread_t*)threadId_1, (_opaque_pthread_t*)threadId_2);
return (threadId_1 == threadId_2);
}
File renamed without changes.
@@ -245,11 +245,6 @@ void PostEffectManager::renderEffects( const SceneRenderState *state,
const PFXRenderTime effectTiming,
const String &binName )
{
// MACHAX - The proper fix is to ensure that PostFX do not get rendered if
// their shader failed to load.
#ifdef TORQUE_OS_MAC
return;
#endif

// Check the global render effect state as
// well as the
@@ -61,7 +61,8 @@ SFXALDevice::SFXALDevice( SFXProvider *provider,
AssertFatal( mDevice != NULL && mContext != NULL, "Failed to create OpenAL device and/or context!" );

// Start the update thread.
#ifndef TORQUE_OS_LINUX
// TODO AsyncPeriodicUpdateThread support for Linux/Mac
#ifdef TORQUE_OS_WIN
if( !Con::getBoolVariable( "$_forceAllMainThread" ) )
{
SFXInternal::gUpdateThread = new AsyncPeriodicUpdateThread
@@ -468,12 +468,11 @@ GFXShader* ShaderGen::getShader( const MaterialFeatureData &featureData, const G
// Don't get paranoid! This has 1 in 18446744073709551616
// chance for collision... it won't happen in this lifetime.
//
U32 hash = Torque::hash( (const U8*)shaderDescription.c_str(), shaderDescription.length(), 0 );
U64 hash = Torque::hash64( (const U8*)shaderDescription.c_str(), shaderDescription.length(), 0 );
hash = convertHostToLEndian(hash);
//U32 high = (U32)( hash >> 32 );
//U32 low = (U32)( hash & 0x00000000FFFFFFFF );
//String cacheKey = String::ToString( "%x%x", high, low );
String cacheKey = String::ToString("%x", hash);
U32 high = (U32)( hash >> 32 );
U32 low = (U32)( hash & 0x00000000FFFFFFFF );
String cacheKey = String::ToString( "%x%x", high, low );
// return shader if exists
GFXShader *match = mProcShaders[cacheKey];
if ( match )
Binary file not shown.
@@ -0,0 +1 @@
/procedural/
@@ -31,8 +31,6 @@ in vec4 mieColor;
#define IN_mieColor mieColor
in vec3 v3Direction;
#define IN_v3Direction v3Direction
in float zPosition;
#define IN_zPosition zPosition
in vec3 pos;
#define IN_pos pos

@@ -65,12 +63,6 @@ void main()
float fac = dot( normalize( pos ), sunDir );
fac = max( nightInterpAndExposure.y, pow( clamp( fac, 0.0, 1.0 ), 2 ) );
OUT_col = mix( color, nightSkyColor, nightInterpAndExposure.y );

// Clip based on the camera-relative
// z position of the vertex, passed through
// from the vertex position.
if(zPosition < 0.0)
discard;

OUT_col.a = 1;

@@ -47,8 +47,6 @@ out vec4 mieColor;
#define OUT_mieColor mieColor
out vec3 v3Direction;
#define OUT_v3Direction v3Direction
out float zPosition;
#define OUT_zPosition zPosition
out vec3 pos;
#define OUT_pos pos

@@ -47,8 +47,8 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
colorBuffer *= (1.0 - colorBuffer.a);
}

colorBuffer *= float4(lightBuffer.rgb, 1.0);
colorBuffer += float4(specular, specular, specular, 1.0);
colorBuffer *= float4(lightBuffer.rgb, 1.0);

return hdrEncode( float4(colorBuffer.rgb, 1.0) );
}
@@ -21,13 +21,13 @@
//-----------------------------------------------------------------------------

#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"

in vec2 uv0;
uniform sampler2D colorBufferTex;

out vec4 OUT_FragColor0;

void main()
{
OUT_FragColor0 = vec4(texture( colorBufferTex, uv0 ).rgb, 1.0);
{
OUT_FragColor0 = vec4(texture( colorBufferTex, uv0 ).rgb, 1.0);
}
@@ -33,4 +33,4 @@ void main()
{
float depth = prepassUncondition( prepassTex, uv0 ).w;
OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 );
}
}
@@ -21,14 +21,13 @@
//-----------------------------------------------------------------------------

#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../../postFx/gl/postFX.glsl"

in vec2 uv0;
uniform sampler2D glowBuffer;

out vec4 OUT_FragColor0;

void main()
{
{
OUT_FragColor0 = texture(glowBuffer, uv0);
}
@@ -21,15 +21,14 @@
//-----------------------------------------------------------------------------

#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"

in vec2 uv0;
uniform sampler2D lightPrePassTex;

out vec4 OUT_col;

void main()
{
{
vec4 lightColor = texture( lightPrePassTex, uv0 );
OUT_col = vec4( lightColor.rgb, 1.0 );
}
OUT_col = vec4( lightColor.rgb, 1.0 );
}
@@ -21,15 +21,14 @@
//-----------------------------------------------------------------------------

#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"

in vec2 uv0;
uniform sampler2D lightPrePassTex;

out vec4 OUT_col;

void main()
{
{
float specular = texture( lightPrePassTex, uv0 ).a;
OUT_col = vec4( specular, specular, specular, 1.0 );
}
}
@@ -20,14 +20,14 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"

in vec2 uv0;
uniform sampler2D matinfoTex;

out vec4 OUT_FragColor0;

void main()
{
{
float specular = texture( matinfoTex, uv0 ).a;
OUT_FragColor0 = vec4( specular, specular, specular, 1.0 );
}
@@ -52,8 +52,8 @@ void main()
colorBuffer *= (1.0 - colorBuffer.a);
}

colorBuffer *= vec4(lightBuffer.rgb, 1.0);
colorBuffer += vec4(specular, specular, specular, 1.0);
colorBuffer *= vec4(lightBuffer.rgb, 1.0);

OUT_col = hdrEncode( vec4(colorBuffer.rgb, 1.0) );
}
@@ -147,6 +147,17 @@ void main()
return;
}

vec4 colorSample = texture( colorBuffer, uvScene );
vec3 subsurface = vec3(0.0,0.0,0.0);
if (getFlag( matInfo.r, 1 ))
{
subsurface = colorSample.rgb;
if (colorSample.r>colorSample.g)
subsurface = vec3(0.772549, 0.337255, 0.262745);
else
subsurface = vec3(0.337255, 0.772549, 0.262745);
}

// Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene );
vec3 normal = prepassSample.rgb;
@@ -258,6 +269,5 @@ void main()
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
}

vec4 colorSample = texture( colorBuffer, uvScene );
OUT_col = AL_DeferredOutput(lightColorOut, colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
}
@@ -89,6 +89,17 @@ void main()
return;
}

vec4 colorSample = texture( colorBuffer, uvScene );
vec3 subsurface = vec3(0.0,0.0,0.0);
if (getFlag( matInfo.r, 1 ))
{
subsurface = colorSample.rgb;
if (colorSample.r>colorSample.g)
subsurface = vec3(0.772549, 0.337255, 0.262745);
else
subsurface = vec3(0.337255, 0.772549, 0.262745);
}

// Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene );
vec3 normal = prepassSample.rgb;
@@ -195,6 +206,5 @@ void main()
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
}

vec4 colorSample = texture( colorBuffer, uvScene );
OUT_col = AL_DeferredOutput(lightColorOut, colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
}
@@ -202,6 +202,17 @@ void main()
return;
}

vec4 colorSample = texture( colorBuffer, uv0 );
vec3 subsurface = vec3(0.0,0.0,0.0);
if (getFlag( matInfo.r, 1 ))
{
subsurface = colorSample.rgb;
if (colorSample.r>colorSample.g)
subsurface = vec3(0.772549, 0.337255, 0.262745);
else
subsurface = vec3(0.337255, 0.772549, 0.262745);
}

// Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uv0 );
vec3 normal = prepassSample.rgb;
@@ -312,6 +323,5 @@ void main()
lightColorOut = debugColor;
#endif

vec4 colorSample = texture( colorBuffer, uv0 );
OUT_col = AL_DeferredOutput(lightColorOut, colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
}
@@ -149,6 +149,16 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
{
return float4(0.0, 0.0, 0.0, 0.0);
}
float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene );
float3 subsurface = float3(0.0,0.0,0.0);
if (getFlag( matInfo.r, 1 ))
{
subsurface = colorSample.rgb;
if (colorSample.r>colorSample.g)
subsurface = float3(0.772549, 0.337255, 0.262745);
else
subsurface = float3(0.337255, 0.772549, 0.262745);
}

// Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
@@ -263,6 +273,5 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
}

float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene );
return AL_DeferredOutput(lightColorOut, colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
}
@@ -87,6 +87,17 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
return float4(0.0, 0.0, 0.0, 0.0);
}

float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene );
float3 subsurface = float3(0.0,0.0,0.0);
if (getFlag( matInfo.r, 1 ))
{
subsurface = colorSample.rgb;
if (colorSample.r>colorSample.g)
subsurface = float3(0.772549, 0.337255, 0.262745);
else
subsurface = float3(0.337255, 0.772549, 0.262745);
}

// Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
float3 normal = prepassSample.rgb;
@@ -194,6 +205,5 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
}

float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene );
return AL_DeferredOutput(lightColorOut, colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
}
@@ -202,6 +202,16 @@ float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0
return float4(1.0, 1.0, 1.0, 0.0);
}

float4 colorSample = TORQUE_TEX2D( colorBuffer, IN.uv0 );
float3 subsurface = float3(0.0,0.0,0.0);
if (getFlag( matInfo.r, 1 ))
{
subsurface = colorSample.rgb;
if (colorSample.r>colorSample.g)
subsurface = float3(0.772549, 0.337255, 0.262745);
else
subsurface = float3(0.337255, 0.772549, 0.262745);
}
// Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, IN.uv0 );
float3 normal = prepassSample.rgb;
@@ -314,6 +324,5 @@ float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0
lightColorOut = debugColor;
#endif

float4 colorSample = TORQUE_TEX2D( colorBuffer, IN.uv0 );
return AL_DeferredOutput(lightColorOut, colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
}
@@ -43,5 +43,5 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
fogData.y,
fogData.z );

return hdrEncode( float4( fogColor.rgb, 1.0 - saturate( factor ) ) );
return hdrEncode( float4( toLinear(fogColor.rgb), 1.0 - saturate( factor ) ) );
}
@@ -48,5 +48,5 @@ void main()
fogData.y,
fogData.z );

OUT_col = hdrEncode( vec4( fogColor.rgb, 1.0 - saturate( factor ) ) );
OUT_col = hdrEncode( vec4( toLinear(fogColor.rgb), 1.0 - saturate( factor ) ) );
}

This file was deleted.

@@ -31,8 +31,6 @@ in vec4 mieColor;
#define IN_mieColor mieColor
in vec3 v3Direction;
#define IN_v3Direction v3Direction
in float zPosition;
#define IN_zPosition zPosition
in vec3 pos;
#define IN_pos pos

@@ -65,12 +63,6 @@ void main()
float fac = dot( normalize( pos ), sunDir );
fac = max( nightInterpAndExposure.y, pow( clamp( fac, 0.0, 1.0 ), 2 ) );
OUT_col = mix( color, nightSkyColor, nightInterpAndExposure.y );

// Clip based on the camera-relative
// z position of the vertex, passed through
// from the vertex position.
if(zPosition < 0.0)
discard;

OUT_col.a = 1;

@@ -47,8 +47,6 @@ out vec4 mieColor;
#define OUT_mieColor mieColor
out vec3 v3Direction;
#define OUT_v3Direction v3Direction
out float zPosition;
#define OUT_zPosition zPosition
out vec3 pos;
#define OUT_pos pos

@@ -21,13 +21,13 @@
//-----------------------------------------------------------------------------

#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"

in vec2 uv0;
uniform sampler2D colorBufferTex;

out vec4 OUT_FragColor0;

void main()
{
OUT_FragColor0 = vec4(texture( colorBufferTex, uv0 ).rgb, 1.0);
{
OUT_FragColor0 = vec4(texture( colorBufferTex, uv0 ).rgb, 1.0);
}
@@ -33,4 +33,4 @@ void main()
{
float depth = prepassUncondition( prepassTex, uv0 ).w;
OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 );
}
}
@@ -21,14 +21,13 @@
//-----------------------------------------------------------------------------

#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../../postFx/gl/postFX.glsl"

in vec2 uv0;
uniform sampler2D glowBuffer;

out vec4 OUT_FragColor0;

void main()
{
{
OUT_FragColor0 = texture(glowBuffer, uv0);
}
@@ -21,15 +21,14 @@
//-----------------------------------------------------------------------------

#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"

in vec2 uv0;
uniform sampler2D lightPrePassTex;

out vec4 OUT_col;

void main()
{
{
vec4 lightColor = texture( lightPrePassTex, uv0 );
OUT_col = vec4( lightColor.rgb, 1.0 );
}
OUT_col = vec4( lightColor.rgb, 1.0 );
}
@@ -21,15 +21,14 @@
//-----------------------------------------------------------------------------

#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"

in vec2 uv0;
uniform sampler2D lightPrePassTex;

out vec4 OUT_col;

void main()
{
{
float specular = texture( lightPrePassTex, uv0 ).a;
OUT_col = vec4( specular, specular, specular, 1.0 );
}
}
@@ -20,14 +20,14 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"

in vec2 uv0;
uniform sampler2D matinfoTex;

out vec4 OUT_FragColor0;

void main()
{
{
float specular = texture( matinfoTex, uv0 ).a;
OUT_FragColor0 = vec4( specular, specular, specular, 1.0 );
}
@@ -7,20 +7,14 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>torqueDemo</string>
<string>torque</string>
<key>CFBundleIdentifier</key>
<string>com.garagegames.${EXECUTABLE_NAME}</string>
<string>com.torque3d.${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>GG3d</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>mainMenu</string>
<key>NSPrincipalClass</key>
<string>macApplication</string>
</dict>
</plist>
@@ -64,11 +64,16 @@ macro(addPath dir)
if(${ARGC} GREATER 1 AND "${ARGV1}" STREQUAL "REC")
set(glob_config GLOB_RECURSE)
endif()
set(mac_files "")
if(APPLE)
set(mac_files ${dir}/*.mm ${dir}/*.m)
endif()
file(${glob_config} tmp_files
${dir}/*.cpp
${dir}/*.c
${dir}/*.cc
${dir}/*.h
${mac_files}
#${dir}/*.asm
)
foreach(entry ${BLACKLIST})
@@ -167,6 +172,13 @@ macro(_process_libs)
endif()
endmacro()

# apple frameworks
macro(addFramework framework)
if (APPLE)
addLib("-framework ${framework}")
endif()
endmacro()

###############################################################################
### Include Handling
###############################################################################
@@ -298,7 +310,13 @@ macro(finishExecutable)
set_source_files_properties(${${PROJECT_NAME}_files} PROPERTIES COMPILE_FLAGS "${TORQUE_CXX_FLAGS_EXECUTABLES}")
endif()

add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files})
if (APPLE)
set(ICON_FILE "${projectSrcDir}/torque.icns")
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable("${PROJECT_NAME}" MACOSX_BUNDLE ${ICON_FILE} ${${PROJECT_NAME}_files})
else()
add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files})
endif()
addInclude("${firstDir}")

_postTargetProcess()
@@ -352,7 +370,7 @@ if(WIN32)
set(TORQUE_CXX_FLAGS_COMMON_DEFAULT "${TORQUE_CXX_FLAGS_COMMON_DEFAULT} /arch:SSE2")
endif()
set(TORQUE_CXX_FLAGS_COMMON ${TORQUE_CXX_FLAGS_COMMON_DEFAULT} CACHE TYPE STRING)

mark_as_advanced(TORQUE_CXX_FLAGS_COMMON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORQUE_CXX_FLAGS_COMMON}")
@@ -387,13 +405,20 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
endif()

if(UNIX)
if(UNIX AND NOT APPLE)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${projectOutDir}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${projectOutDir}")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${projectOutDir}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${projectOutDir}")
endif()

if(APPLE)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${projectOutDir}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${projectOutDir}")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${projectOutDir}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${projectOutDir}")
endif()

# fix the debug/release subfolders on windows
if(MSVC)
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY" "${projectOutDir}")
@@ -28,9 +28,9 @@ addPath("${libDir}/epoxy/src")
if (WIN32)
addPath("${libDir}/epoxy/src/wgl")
addDef(BUILD_WGL)
else()
elseif(UNIX AND NOT APPLE)
addPath("${libDir}/epoxy/src/glx")
addDef(BUILD_GLX)
addDef(BUILD_GLX)
endif()

addInclude("${libDir}/epoxy/include")
File renamed without changes.

Large diffs are not rendered by default.