Merge branch 'master' into console-func-refactor

Conflicts:
	Engine/source/app/net/net.cpp
	Engine/source/console/astNodes.cpp
	Engine/source/console/compiledEval.cpp
	Engine/source/console/console.h
	Engine/source/console/consoleInternal.h
	Engine/source/console/engineAPI.h
This commit is contained in:
Daniel Buckmaster 2014-10-14 14:40:17 +11:00
commit b507dc9555
6487 changed files with 315149 additions and 609761 deletions

View file

@ -242,7 +242,7 @@ void MatInstance::construct()
{
mUserObject = NULL;
mCurPass = -1;
mProcessedMaterial = false;
mProcessedMaterial = NULL;
mVertexFormat = NULL;
mMaxStages = 1;
mActiveParameters = NULL;

View file

@ -116,6 +116,7 @@ Material::Material()
mSpecular[i].set( 1.0f, 1.0f, 1.0f, 1.0f );
mSpecularPower[i] = 8.0f;
mSpecularStrength[i] = 1.0f;
mPixelSpecular[i] = false;
mParallaxScale[i] = 0.0f;
@ -239,7 +240,10 @@ void Material::initPersistFields()
"The color of the specular highlight when not using a specularMap." );
addField("specularPower", TypeF32, Offset(mSpecularPower, Material), MAX_STAGES,
"The intensity of the specular highlight when not using a specularMap." );
"The hardness of the specular highlight when not using a specularMap." );
addField("specularStrength", TypeF32, Offset(mSpecularStrength, Material), MAX_STAGES,
"The strength of the specular highlight when not using a specularMap." );
addField("pixelSpecular", TypeBool, Offset(mPixelSpecular, Material), MAX_STAGES,
"This enables per-pixel specular highlights controlled by the alpha channel of the "

View file

@ -223,6 +223,7 @@ public:
ColorF mSpecular[MAX_STAGES];
F32 mSpecularPower[MAX_STAGES];
F32 mSpecularStrength[MAX_STAGES];
bool mPixelSpecular[MAX_STAGES];
bool mVertLit[MAX_STAGES];

View file

@ -41,6 +41,7 @@ enum RegisterType
RT_NORMAL,
RT_BINORMAL,
RT_TANGENT,
RT_TANGENTW,
RT_COLOR,
RT_TEXCOORD,
RT_VPOS,

View file

@ -30,9 +30,9 @@
#include "materials/materialManager.h"
#include "scene/sceneRenderState.h"
#include "gfx/gfxPrimitiveBuffer.h"
#include "gfx/gfxTextureManager.h"
#include "gfx/sim/cubemapData.h"
RenderPassData::RenderPassData()
{
reset();
@ -41,7 +41,10 @@ RenderPassData::RenderPassData()
void RenderPassData::reset()
{
for( U32 i = 0; i < Material::MAX_TEX_PER_PASS; ++ i )
{
destructInPlace( &mTexSlot[ i ] );
mSamplerNames[ i ].clear();
}
dMemset( &mTexSlot, 0, sizeof(mTexSlot) );
dMemset( &mTexType, 0, sizeof(mTexType) );
@ -217,13 +220,13 @@ void ProcessedMaterial::_initPassStateBlock( RenderPassData *rpd, GFXStateBlockD
_setBlendState( rpd->mBlendOp, result );
}
if (mMaterial->isDoubleSided())
if (mMaterial && mMaterial->isDoubleSided())
{
result.cullDefined = true;
result.cullMode = GFXCullNone;
}
if(mMaterial->mAlphaTest)
if(mMaterial && mMaterial->mAlphaTest)
{
result.alphaDefined = true;
result.alphaTestEnable = mMaterial->mAlphaTest;
@ -235,7 +238,7 @@ void ProcessedMaterial::_initPassStateBlock( RenderPassData *rpd, GFXStateBlockD
NamedTexTarget *texTarget;
U32 maxAnisotropy = 1;
if ( mMaterial->mUseAnisotropic[ rpd->mStageNum ] )
if (mMaterial && mMaterial->mUseAnisotropic[ rpd->mStageNum ] )
maxAnisotropy = MATMGR->getDefaultAnisotropy();
for( U32 i=0; i < rpd->mNumTex; i++ )
@ -394,7 +397,7 @@ void ProcessedMaterial::_setStageData()
// Load a debug texture to make it clear to the user
// that the texture for this stage was missing.
mStages[i].setTex( MFT_DiffuseMap, _createTexture( "core/art/missingTexture", &GFXDefaultStaticDiffuseProfile ) );
mStages[i].setTex( MFT_DiffuseMap, _createTexture( GFXTextureManager::getMissingTexturePath().c_str(), &GFXDefaultStaticDiffuseProfile ) );
}
}

View file

@ -68,6 +68,7 @@ public:
} mTexSlot[Material::MAX_TEX_PER_PASS];
U32 mTexType[Material::MAX_TEX_PER_PASS];
String mSamplerNames[Material::MAX_TEX_PER_PASS];
/// The cubemap to use when the texture type is
/// set to Material::Cube.

View file

@ -54,6 +54,7 @@ void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/
mToneMapTexSC = shader->getShaderConstHandle(ShaderGenVars::toneMap);
mSpecularColorSC = shader->getShaderConstHandle(ShaderGenVars::specularColor);
mSpecularPowerSC = shader->getShaderConstHandle(ShaderGenVars::specularPower);
mSpecularStrengthSC = shader->getShaderConstHandle(ShaderGenVars::specularStrength);
mParallaxInfoSC = shader->getShaderConstHandle("$parallaxInfo");
mFogDataSC = shader->getShaderConstHandle(ShaderGenVars::fogData);
mFogColorSC = shader->getShaderConstHandle(ShaderGenVars::fogColor);
@ -284,7 +285,7 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
{
PROFILE_SCOPE( ProcessedShaderMaterial_DetermineFeatures );
const float shaderVersion = GFX->getPixelShaderVersion();
const F32 shaderVersion = GFX->getPixelShaderVersion();
AssertFatal(shaderVersion > 0.0 , "Cannot create a shader material if we don't support shaders");
bool lastStage = stageNum == (mMaxStages-1);
@ -993,6 +994,7 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
shaderConsts->setSafe(handles->mSpecularColorSC, mMaterial->mSpecular[stageNum]);
shaderConsts->setSafe(handles->mSpecularPowerSC, mMaterial->mSpecularPower[stageNum]);
shaderConsts->setSafe(handles->mSpecularStrengthSC, mMaterial->mSpecularStrength[stageNum]);
shaderConsts->setSafe(handles->mParallaxInfoSC, mMaterial->mParallaxScale[stageNum]);
shaderConsts->setSafe(handles->mMinnaertConstantSC, mMaterial->mMinnaertConstant[stageNum]);
@ -1198,6 +1200,7 @@ void ProcessedShaderMaterial::setBuffers( GFXVertexBufferHandleBase *vertBuffer,
GFXVertexBufferDataHandle instVB;
instVB.set( GFX, instFormat->getSizeInBytes(), instFormat, instCount, GFXBufferTypeVolatile );
U8 *dest = instVB.lock();
if(!dest) return;
dMemcpy( dest, mInstancingState->getBuffer(), instFormat->getSizeInBytes() * instCount );
instVB.unlock();
@ -1256,7 +1259,7 @@ MaterialParameterHandle* ProcessedShaderMaterial::getMaterialParameterHandle(con
/// This is here to deal with the differences between ProcessedCustomMaterials and ProcessedShaderMaterials.
GFXShaderConstBuffer* ProcessedShaderMaterial::_getShaderConstBuffer( const U32 pass )
{
if (pass < mPasses.size())
if (mCurrentParams && pass < mPasses.size())
{
return static_cast<ShaderMaterialParameters*>(mCurrentParams)->getBuffer(pass);
}

View file

@ -46,6 +46,7 @@ public:
GFXShaderConstHandle* mTexMatSC;
GFXShaderConstHandle* mSpecularColorSC;
GFXShaderConstHandle* mSpecularPowerSC;
GFXShaderConstHandle* mSpecularStrengthSC;
GFXShaderConstHandle* mParallaxInfoSC;
GFXShaderConstHandle* mFogDataSC;
GFXShaderConstHandle* mFogColorSC;