mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-25 01:23:52 +00:00
Merge branch 'development' into EngineAPI-Refactor
This commit is contained in:
commit
3a71c75596
1937 changed files with 102332 additions and 70549 deletions
|
|
@ -347,8 +347,8 @@ bool VolumetricFog::LoadShape()
|
|||
return false;
|
||||
}
|
||||
|
||||
mObjBox = mShape->bounds;
|
||||
mRadius = mShape->radius;
|
||||
mObjBox = mShape->mBounds;
|
||||
mRadius = mShape->mRadius;
|
||||
resetWorldBox();
|
||||
|
||||
if (!isClientObject())
|
||||
|
|
@ -421,13 +421,13 @@ bool VolumetricFog::LoadShape()
|
|||
|
||||
det_size[i].indices = new Vector<U32>();
|
||||
|
||||
for (U32 k = 0; k < mesh->indices.size(); k++)
|
||||
det_size[i].indices->push_back(mesh->indices[k]);
|
||||
for (U32 k = 0; k < mesh->mIndices.size(); k++)
|
||||
det_size[i].indices->push_back(mesh->mIndices[k]);
|
||||
|
||||
U32 primitivesSize = mesh->primitives.size();
|
||||
U32 primitivesSize = mesh->mPrimitives.size();
|
||||
for (U32 k = 0; k < primitivesSize; k++)
|
||||
{
|
||||
const TSDrawPrimitive & draw = mesh->primitives[k];
|
||||
const TSDrawPrimitive & draw = mesh->mPrimitives[k];
|
||||
GFXPrimitiveType drawType = GFXdrawTypes[draw.matIndex >> 30];
|
||||
switch (drawType)
|
||||
{
|
||||
|
|
@ -436,7 +436,7 @@ bool VolumetricFog::LoadShape()
|
|||
pInfo.numPrimitives = draw.numElements / 3;
|
||||
pInfo.startIndex = draw.start;
|
||||
// Use the first index to determine which 16-bit address space we are operating in
|
||||
pInfo.startVertex = mesh->indices[draw.start] & 0xFFFF0000;
|
||||
pInfo.startVertex = mesh->mIndices[draw.start] & 0xFFFF0000;
|
||||
pInfo.minIndex = pInfo.startVertex;
|
||||
pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex);
|
||||
break;
|
||||
|
|
@ -445,7 +445,7 @@ bool VolumetricFog::LoadShape()
|
|||
pInfo.numPrimitives = draw.numElements - 2;
|
||||
pInfo.startIndex = draw.start;
|
||||
// Use the first index to determine which 16-bit address space we are operating in
|
||||
pInfo.startVertex = mesh->indices[draw.start] & 0xFFFF0000;
|
||||
pInfo.startVertex = mesh->mIndices[draw.start] & 0xFFFF0000;
|
||||
pInfo.minIndex = pInfo.startVertex;
|
||||
pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex);
|
||||
break;
|
||||
|
|
@ -560,8 +560,8 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
mShape = ResourceManager::get().load(mShapeName);
|
||||
if (bool(mShape) == false)
|
||||
return retMask;
|
||||
mObjBox = mShape->bounds;
|
||||
mRadius = mShape->radius;
|
||||
mObjBox = mShape->mBounds;
|
||||
mRadius = mShape->mRadius;
|
||||
resetWorldBox();
|
||||
mObjSize = mWorldBox.getGreatestDiagonalLength();
|
||||
mObjScale = getScale();
|
||||
|
|
@ -620,25 +620,20 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
stream->read(&mLightRayMod);
|
||||
if (isTicking())
|
||||
{
|
||||
char buf[20];
|
||||
dSprintf(buf, sizeof(buf), "%3.7f", mGlowStrength);
|
||||
Con::setVariable("$VolFogGlowPostFx::glowStrength", buf);
|
||||
char glowStrBuf[20];
|
||||
dSprintf(glowStrBuf, sizeof(glowStrBuf), "%3.7f", mGlowStrength);
|
||||
Con::setVariable("$VolFogGlowPostFx::glowStrength", glowStrBuf);
|
||||
if (mUseGlow && !glowFX->isEnabled())
|
||||
glowFX->enable();
|
||||
if (!mUseGlow && glowFX->isEnabled())
|
||||
glowFX->disable();
|
||||
if (mModifLightRays)
|
||||
{
|
||||
char buf[20];
|
||||
dSprintf(buf, sizeof(buf), "%3.7f", mOldLightRayStrength * mLightRayMod);
|
||||
Con::setVariable("$LightRayPostFX::brightScalar", buf);
|
||||
}
|
||||
if (!mModifLightRays)
|
||||
{
|
||||
char buf[20];
|
||||
dSprintf(buf, sizeof(buf), "%3.7f", mOldLightRayStrength);
|
||||
Con::setVariable("$LightRayPostFX::brightScalar", buf);
|
||||
}
|
||||
|
||||
F32 rayStrength = mOldLightRayStrength;
|
||||
if (mModifLightRays)
|
||||
rayStrength *= mLightRayMod;
|
||||
char rayStrBuf[20];
|
||||
dSprintf(rayStrBuf, sizeof(rayStrBuf), "%3.7f", rayStrength);
|
||||
Con::setVariable("$LightRayPostFX::brightScalar", rayStrBuf);
|
||||
}
|
||||
}
|
||||
if (stream->readFlag())//Volumetric Fog
|
||||
|
|
|
|||
|
|
@ -1265,7 +1265,7 @@ void DecalRoad::_generateEdges()
|
|||
//
|
||||
for ( U32 i = 0; i < mEdges.size(); i++ )
|
||||
{
|
||||
RoadEdge *edge = &mEdges[i];
|
||||
edge = &mEdges[i];
|
||||
edge->p0 = edge->p1 - edge->rvec * edge->width * 0.5f;
|
||||
edge->p2 = edge->p1 + edge->rvec * edge->width * 0.5f;
|
||||
_getTerrainHeight( edge->p0 );
|
||||
|
|
@ -1467,20 +1467,20 @@ void DecalRoad::_captureVerts()
|
|||
for ( U32 i = 0; i < clipperList.size(); i++ )
|
||||
{
|
||||
ClippedPolyList *clipper = &clipperList[i];
|
||||
RoadEdge &edge = mEdges[i];
|
||||
RoadEdge &nextEdge = mEdges[i+1];
|
||||
edge = &mEdges[i];
|
||||
nextEdge = &mEdges[i+1];
|
||||
|
||||
VectorF segFvec = nextEdge.p1 - edge.p1;
|
||||
VectorF segFvec = nextEdge->p1 - edge->p1;
|
||||
F32 segLen = segFvec.len();
|
||||
segFvec.normalize();
|
||||
|
||||
F32 texLen = segLen / mTextureLength;
|
||||
texEnd = texStart + texLen;
|
||||
|
||||
BiQuadToSqr quadToSquare( Point2F( edge.p0.x, edge.p0.y ),
|
||||
Point2F( edge.p2.x, edge.p2.y ),
|
||||
Point2F( nextEdge.p2.x, nextEdge.p2.y ),
|
||||
Point2F( nextEdge.p0.x, nextEdge.p0.y ) );
|
||||
BiQuadToSqr quadToSquare( Point2F( edge->p0.x, edge->p0.y ),
|
||||
Point2F( edge->p2.x, edge->p2.y ),
|
||||
Point2F( nextEdge->p2.x, nextEdge->p2.y ),
|
||||
Point2F( nextEdge->p0.x, nextEdge->p0.y ) );
|
||||
|
||||
//
|
||||
if ( i % mSegmentsPerBatch == 0 )
|
||||
|
|
@ -1572,12 +1572,12 @@ void DecalRoad::_captureVerts()
|
|||
Box3F box;
|
||||
for ( U32 i = 0; i < mBatches.size(); i++ )
|
||||
{
|
||||
const RoadBatch &batch = mBatches[i];
|
||||
batch = &mBatches[i];
|
||||
|
||||
if ( i == 0 )
|
||||
box = batch.bounds;
|
||||
box = batch->bounds;
|
||||
else
|
||||
box.intersect( batch.bounds );
|
||||
box.intersect( batch->bounds );
|
||||
}
|
||||
|
||||
mWorldBox = box;
|
||||
|
|
|
|||
|
|
@ -1132,11 +1132,11 @@ void GuiMeshRoadEditorCtrl::setSelectedNode( S32 node )
|
|||
mSelNode = node;
|
||||
if ( mSelNode != -1 )
|
||||
{
|
||||
const MeshRoadNode &node = mSelRoad->mNodes[mSelNode];
|
||||
const MeshRoadNode &curNode = mSelRoad->mNodes[mSelNode];
|
||||
|
||||
MatrixF objMat = mSelRoad->getNodeTransform(mSelNode);
|
||||
Point3F objScale( node.width, 1.0f, node.depth );
|
||||
Point3F worldPos = node.point;
|
||||
Point3F objScale(curNode.width, 1.0f, curNode.depth );
|
||||
Point3F worldPos = curNode.point;
|
||||
|
||||
mGizmo->set( objMat, worldPos, objScale );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1277,11 +1277,11 @@ void GuiRiverEditorCtrl::setSelectedNode( S32 node )
|
|||
mSelNode = node;
|
||||
if ( mSelNode != -1 )
|
||||
{
|
||||
const RiverNode &node = mSelRiver->mNodes[mSelNode];
|
||||
const RiverNode &curNode = mSelRiver->mNodes[mSelNode];
|
||||
|
||||
MatrixF objMat = mSelRiver->getNodeTransform(mSelNode);
|
||||
Point3F objScale( node.width, 1.0f, node.depth );
|
||||
Point3F worldPos = node.point;
|
||||
Point3F objScale(curNode.width, 1.0f, curNode.depth );
|
||||
Point3F worldPos = curNode.point;
|
||||
|
||||
mGizmo->set( objMat, worldPos, objScale );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1681,54 +1681,40 @@ void MeshRoad::_generateSlices()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate uvec, fvec, and rvec for all slices
|
||||
//
|
||||
|
||||
|
||||
MatrixF mat(true);
|
||||
|
||||
for ( U32 i = 0; i < mSlices.size(); i++ )
|
||||
{
|
||||
calcSliceTransform( i, mat );
|
||||
mat.getColumn( 0, &mSlices[i].rvec );
|
||||
mat.getColumn( 1, &mSlices[i].fvec );
|
||||
mat.getColumn( 2, &mSlices[i].uvec );
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate p0/p2/pb0/pb2 for all slices
|
||||
//
|
||||
for ( U32 i = 0; i < mSlices.size(); i++ )
|
||||
{
|
||||
MeshRoadSlice *slice = &mSlices[i];
|
||||
slice->p0 = slice->p1 - slice->rvec * slice->width * 0.5f;
|
||||
slice->p2 = slice->p1 + slice->rvec * slice->width * 0.5f;
|
||||
slice->pb0 = slice->p0 - slice->uvec * slice->depth;
|
||||
slice->pb2 = slice->p2 - slice->uvec * slice->depth;
|
||||
}
|
||||
|
||||
// Generate the object/world bounds
|
||||
Box3F box;
|
||||
for ( U32 i = 0; i < mSlices.size(); i++ )
|
||||
{
|
||||
const MeshRoadSlice &slice = mSlices[i];
|
||||
// Calculate uvec, fvec, and rvec for all slices
|
||||
calcSliceTransform( i, mat );
|
||||
MeshRoadSlice *slicePtr = &mSlices[i];
|
||||
mat.getColumn( 0, &slicePtr->rvec );
|
||||
mat.getColumn( 1, &slicePtr->fvec );
|
||||
mat.getColumn( 2, &slicePtr->uvec );
|
||||
|
||||
// Calculate p0/p2/pb0/pb2 for all slices
|
||||
slicePtr->p0 = slicePtr->p1 - slicePtr->rvec * slicePtr->width * 0.5f;
|
||||
slicePtr->p2 = slicePtr->p1 + slicePtr->rvec * slicePtr->width * 0.5f;
|
||||
slicePtr->pb0 = slicePtr->p0 - slicePtr->uvec * slicePtr->depth;
|
||||
slicePtr->pb2 = slicePtr->p2 - slicePtr->uvec * slicePtr->depth;
|
||||
|
||||
// Generate or extend the object/world bounds
|
||||
if ( i == 0 )
|
||||
{
|
||||
box.minExtents = slice.p0;
|
||||
box.maxExtents = slice.p2;
|
||||
box.extend( slice.pb0 );
|
||||
box.extend( slice.pb2 );
|
||||
box.minExtents = slicePtr->p0;
|
||||
box.maxExtents = slicePtr->p2;
|
||||
box.extend(slicePtr->pb0 );
|
||||
box.extend(slicePtr->pb2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
box.extend( slice.p0 );
|
||||
box.extend( slice.p2 );
|
||||
box.extend( slice.pb0 );
|
||||
box.extend( slice.pb2 );
|
||||
box.extend(slicePtr->p0 );
|
||||
box.extend(slicePtr->p2 );
|
||||
box.extend(slicePtr->pb0 );
|
||||
box.extend(slicePtr->pb2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mWorldBox = box;
|
||||
resetObjectBox();
|
||||
|
|
|
|||
|
|
@ -690,13 +690,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
|||
mMatrixSet->setSceneProjection(GFX->getProjectionMatrix());
|
||||
mMatrixSet->setWorld(GFX->getWorldMatrix());
|
||||
|
||||
ObjectRenderInst *ri = renderPass->allocInst<ObjectRenderInst>();
|
||||
ri->renderDelegate.bind( this, &ScatterSky::_renderMoon );
|
||||
ri->type = RenderPassManager::RIT_Sky;
|
||||
ObjectRenderInst *moonRI = renderPass->allocInst<ObjectRenderInst>();
|
||||
moonRI->renderDelegate.bind( this, &ScatterSky::_renderMoon );
|
||||
moonRI->type = RenderPassManager::RIT_Sky;
|
||||
// Render after sky objects and before CloudLayer!
|
||||
ri->defaultKey = 5;
|
||||
ri->defaultKey2 = 0;
|
||||
renderPass->addInst(ri);
|
||||
moonRI->defaultKey = 5;
|
||||
moonRI->defaultKey2 = 0;
|
||||
renderPass->addInst(moonRI);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -955,8 +955,9 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat
|
|||
|
||||
Point3F camPos2 = state->getCameraPosition();
|
||||
MatrixF xfm(true);
|
||||
|
||||
xfm.setPosition(camPos2 - Point3F(0, 0, mZOffset));
|
||||
GFX->multWorld(xfm);
|
||||
|
||||
MatrixF xform(proj);//GFX->getProjectionMatrix());
|
||||
xform *= GFX->getViewMatrix();
|
||||
xform *= GFX->getWorldMatrix();
|
||||
|
|
@ -968,7 +969,6 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat
|
|||
rotMat.set(EulerF(M_PI_F, 0.0, 0.0));
|
||||
xform.mul(rotMat);
|
||||
}
|
||||
xform.setPosition(xform.getPosition() - Point3F(0, 0, mZOffset));
|
||||
|
||||
mShaderConsts->setSafe( mModelViewProjSC, xform );
|
||||
mShaderConsts->setSafe( mMiscSC, miscParams );
|
||||
|
|
@ -1346,7 +1346,7 @@ void ScatterSky::_getColor( const Point3F &pos, LinearColorF *outColor )
|
|||
for ( U32 i = 0; i < 2; i++ )
|
||||
{
|
||||
F32 fHeight = v3SamplePoint.len();
|
||||
F32 fDepth = mExp( scaleOverScaleDepth * (mSphereInnerRadius - smViewerHeight) );
|
||||
fDepth = mExp( scaleOverScaleDepth * (mSphereInnerRadius - smViewerHeight) );
|
||||
F32 fLightAngle = mDot( mLightDir, v3SamplePoint ) / fHeight;
|
||||
F32 fCameraAngle = mDot( v3Ray, v3SamplePoint ) / fHeight;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue