mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Direct3D11 Engine/source changes
This commit is contained in:
parent
3a9b50f702
commit
41e5caf22b
81 changed files with 1291 additions and 617 deletions
|
|
@ -110,7 +110,7 @@ namespace
|
|||
start -= lineVec;
|
||||
end += lineVec;
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(GFX, 4, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(GFX, 4, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
verts[0].point.set( start.x+perp.x, start.y+perp.y, z1 );
|
||||
|
|
|
|||
|
|
@ -319,81 +319,79 @@ void GuiGradientCtrl::renderColorBox(RectI &bounds)
|
|||
void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<ColorRange> colorRange)
|
||||
{
|
||||
GFX->setStateBlock(mStateBlock);
|
||||
|
||||
// Create new global dimensions
|
||||
|
||||
// Create new global dimensions
|
||||
S32 l = bounds.point.x + mSwatchFactor, r = bounds.point.x + bounds.extent.x - mSwatchFactor;
|
||||
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - mSwatchFactor;
|
||||
|
||||
// Draw border using new global dimensions
|
||||
if (mProfile->mBorder)
|
||||
GFX->getDrawUtil()->drawRect( RectI( Point2I(l,t),Point2I(r,b) ), mProfile->mBorderColor);
|
||||
|
||||
// Update local dimensions
|
||||
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
|
||||
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
|
||||
|
||||
ColorRange& firstColorRange = colorRange.first();
|
||||
|
||||
if(colorRange.size() == 1) // Only one color to draw
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
// Draw border using new global dimensions
|
||||
if (mProfile->mBorder)
|
||||
GFX->getDrawUtil()->drawRect(RectI(Point2I(l, t), Point2I(r, b)), mProfile->mBorderColor);
|
||||
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( l, t );
|
||||
PrimBuild::vertex2i( l, b );
|
||||
// Update local dimensions
|
||||
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
|
||||
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
|
||||
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( r, b );
|
||||
PrimBuild::vertex2i( r, t );
|
||||
if (colorRange.size() == 1) // Only one color to draw
|
||||
{
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
|
||||
PrimBuild::end();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::color(colorRange.first().swatch->getColor());
|
||||
PrimBuild::vertex2i(l, t);
|
||||
PrimBuild::vertex2i(r, t);
|
||||
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( l, t );
|
||||
PrimBuild::vertex2i( l, b );
|
||||
PrimBuild::color(colorRange.first().swatch->getColor());
|
||||
PrimBuild::vertex2i(l, b);
|
||||
PrimBuild::vertex2i(r, b);
|
||||
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, b);
|
||||
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, t);
|
||||
PrimBuild::end();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
|
||||
PrimBuild::end();
|
||||
PrimBuild::color(colorRange.first().swatch->getColor());
|
||||
PrimBuild::vertex2i(l, t);
|
||||
PrimBuild::vertex2i(l + colorRange.first().swatch->getPosition().x, t);
|
||||
|
||||
for( U16 i = 0;i < colorRange.size() - 1; i++ )
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
if (!vertical) // Horizontal (+x)
|
||||
{
|
||||
// First color
|
||||
PrimBuild::color( colorRange[i].swatch->getColor() );
|
||||
PrimBuild::vertex2i( l + colorRange[i].swatch->getPosition().x, t );
|
||||
PrimBuild::vertex2i( l + colorRange[i].swatch->getPosition().x, b );
|
||||
|
||||
// First color
|
||||
PrimBuild::color( colorRange[i+1].swatch->getColor() );
|
||||
PrimBuild::vertex2i( l + colorRange[i+1].swatch->getPosition().x, b );
|
||||
PrimBuild::vertex2i( l + colorRange[i+1].swatch->getPosition().x, t );
|
||||
}
|
||||
PrimBuild::end();
|
||||
}
|
||||
PrimBuild::color(colorRange.first().swatch->getColor());
|
||||
PrimBuild::vertex2i(l, b);
|
||||
PrimBuild::vertex2i(l + colorRange.first().swatch->getPosition().x, b);
|
||||
|
||||
ColorRange& lastColorRange = colorRange.last();
|
||||
PrimBuild::end();
|
||||
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
for (U16 i = 0; i < colorRange.size() - 1; i++)
|
||||
{
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
if (!vertical) // Horizontal (+x)
|
||||
{
|
||||
// First color
|
||||
PrimBuild::color(colorRange[i].swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange[i].swatch->getPosition().x, t);
|
||||
PrimBuild::color(colorRange[i + 1].swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange[i + 1].swatch->getPosition().x, t);
|
||||
|
||||
PrimBuild::color(lastColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, t);
|
||||
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, b);
|
||||
|
||||
PrimBuild::color(lastColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( r, b );
|
||||
PrimBuild::vertex2i( r, t );
|
||||
// First color
|
||||
PrimBuild::color(colorRange[i].swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange[i].swatch->getPosition().x, b);
|
||||
PrimBuild::color(colorRange[i + 1].swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange[i + 1].swatch->getPosition().x, b);
|
||||
}
|
||||
PrimBuild::end();
|
||||
}
|
||||
|
||||
PrimBuild::end();
|
||||
}
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
|
||||
PrimBuild::color(colorRange.last().swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange.last().swatch->getPosition().x, t);
|
||||
PrimBuild::vertex2i(r, t);
|
||||
|
||||
PrimBuild::color(colorRange.last().swatch->getColor());
|
||||
PrimBuild::vertex2i(l + colorRange.last().swatch->getPosition().x, b);
|
||||
PrimBuild::vertex2i(r, b);
|
||||
|
||||
PrimBuild::end();
|
||||
}
|
||||
}
|
||||
|
||||
void GuiGradientCtrl::onMouseDown(const GuiEvent &event)
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ void GuiTextEditSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
Point2I(start.x+14,midPoint.y),
|
||||
mProfile->mFontColor);
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(GFX, 6, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(GFX, 6, GFXBufferTypeVolatile);
|
||||
verts.lock();
|
||||
|
||||
verts[0].color.set( 0, 0, 0 );
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class GuiEditCtrl : public GuiControl
|
|||
SimSet* mSelectedSet;
|
||||
|
||||
// grid drawing
|
||||
GFXVertexBufferHandle<GFXVertexPC> mDots;
|
||||
GFXVertexBufferHandle<GFXVertexPCT> mDots;
|
||||
GFXStateBlockRef mDotSB;
|
||||
|
||||
mouseModes mMouseDownMode;
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
|
||||
// draw the curv
|
||||
GFXVertexBufferHandle<GFXVertexPC> verts(GFX, ext.x, GFXBufferTypeVolatile);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> verts(GFX, ext.x, GFXBufferTypeVolatile);
|
||||
|
||||
verts.lock();
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
for( S32 sample = 0; sample < numSamples; ++ sample )
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::begin( GFXTriangleStrip, 4 );
|
||||
PrimBuild::color( mGraphColor[ k ] );
|
||||
|
||||
F32 offset = F32( getExtent().x ) / F32( MaxDataPoints ) * F32( sample + 1 );
|
||||
|
|
|
|||
|
|
@ -1315,7 +1315,7 @@ DefineEngineMethod( EditTSCtrl, renderCircle, void, ( Point3F pos, Point3F norma
|
|||
{
|
||||
PrimBuild::color( object->mConsoleFillColor );
|
||||
|
||||
PrimBuild::begin( GFXTriangleFan, points.size() + 2 );
|
||||
PrimBuild::begin( GFXTriangleStrip, points.size() + 2 );
|
||||
|
||||
// Center point
|
||||
PrimBuild::vertex3fv( pos );
|
||||
|
|
|
|||
|
|
@ -1403,7 +1403,7 @@ void Gizmo::renderGizmo(const MatrixF &cameraTransform, F32 cameraFOV )
|
|||
|
||||
for(U32 j = 0; j < 6; j++)
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::begin( GFXTriangleStrip, 4 );
|
||||
|
||||
PrimBuild::vertex3fv( sgCenterBoxPnts[sgBoxVerts[j][0]] * tipScale);
|
||||
PrimBuild::vertex3fv( sgCenterBoxPnts[sgBoxVerts[j][1]] * tipScale);
|
||||
|
|
@ -1599,7 +1599,7 @@ void Gizmo::_renderAxisBoxes()
|
|||
|
||||
for(U32 j = 0; j < 6; j++)
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::begin( GFXTriangleStrip, 4 );
|
||||
|
||||
PrimBuild::vertex3fv( sgCenterBoxPnts[sgBoxVerts[j][0]] * tipScale + sgAxisVectors[axisIdx] * pos );
|
||||
PrimBuild::vertex3fv( sgCenterBoxPnts[sgBoxVerts[j][1]] * tipScale + sgAxisVectors[axisIdx] * pos );
|
||||
|
|
@ -1663,7 +1663,7 @@ void Gizmo::_renderAxisCircles()
|
|||
ColorI color = mProfile->inActiveColor;
|
||||
color.alpha = 100;
|
||||
PrimBuild::color( color );
|
||||
PrimBuild::begin( GFXTriangleFan, segments+2 );
|
||||
PrimBuild::begin( GFXTriangleStrip, segments+2 );
|
||||
|
||||
PrimBuild::vertex3fv( Point3F(0,0,0) );
|
||||
|
||||
|
|
|
|||
|
|
@ -265,18 +265,18 @@ void GuiTerrPreviewCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// the texture if flipped horz to reflect how the terrain is really drawn
|
||||
PrimBuild::color3f(1.0f, 1.0f, 1.0f);
|
||||
PrimBuild::begin(GFXTriangleFan, 4);
|
||||
PrimBuild::texCoord2f(textureP1.x, textureP2.y);
|
||||
PrimBuild::vertex2f(screenP1.x, screenP2.y); // left bottom
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
PrimBuild::texCoord2f(textureP1.x, textureP1.y);
|
||||
PrimBuild::vertex2f(screenP1.x, screenP1.y); // left top
|
||||
|
||||
|
||||
PrimBuild::texCoord2f(textureP2.x, textureP2.y);
|
||||
PrimBuild::vertex2f(screenP2.x, screenP2.y); // right bottom
|
||||
PrimBuild::texCoord2f(textureP2.x, textureP1.y);
|
||||
PrimBuild::vertex2f(screenP2.x, screenP1.y); // right top
|
||||
PrimBuild::texCoord2f(textureP2.x, textureP1.y);
|
||||
PrimBuild::vertex2f(screenP2.x, screenP1.y); // right top
|
||||
|
||||
PrimBuild::texCoord2f(textureP1.x, textureP1.y);
|
||||
PrimBuild::vertex2f(screenP1.x, screenP1.y); // left top
|
||||
PrimBuild::texCoord2f(textureP1.x, textureP2.y);
|
||||
PrimBuild::vertex2f(screenP1.x, screenP2.y); // left bottom
|
||||
|
||||
PrimBuild::texCoord2f(textureP2.x, textureP2.y);
|
||||
PrimBuild::vertex2f(screenP2.x, screenP2.y); // right bottom
|
||||
PrimBuild::end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ void SelectionBrush::rebuild()
|
|||
//... move the selection
|
||||
}
|
||||
|
||||
void SelectionBrush::render(Vector<GFXVertexPC> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const
|
||||
void SelectionBrush::render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const
|
||||
{
|
||||
//... render the selection
|
||||
}
|
||||
|
|
@ -1342,8 +1342,8 @@ void TerrainEditor::renderPoints( const Vector<GFXVertexPCT> &pointList )
|
|||
U32 vertsThisDrawCall = getMin( (U32)vertsLeft, (U32)MAX_DYNAMIC_VERTS );
|
||||
vertsLeft -= vertsThisDrawCall;
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> vbuff( GFX, vertsThisDrawCall, GFXBufferTypeVolatile );
|
||||
GFXVertexPC *vert = vbuff.lock();
|
||||
GFXVertexBufferHandle<GFXVertexPCT> vbuff( GFX, vertsThisDrawCall, GFXBufferTypeVolatile );
|
||||
GFXVertexPCT *vert = vbuff.lock();
|
||||
|
||||
const U32 loops = vertsThisDrawCall / 6;
|
||||
|
||||
|
|
@ -1394,7 +1394,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
if(sel.size() == 0)
|
||||
return;
|
||||
|
||||
Vector<GFXVertexPC> vertexBuffer;
|
||||
Vector<GFXVertexPCT> vertexBuffer;
|
||||
ColorF color;
|
||||
ColorI iColor;
|
||||
|
||||
|
|
@ -1430,15 +1430,15 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
//
|
||||
iColor = color;
|
||||
|
||||
GFXVertexPC *verts = &(vertexBuffer[i * 5]);
|
||||
GFXVertexPCT *verts = &(vertexBuffer[i * 5]);
|
||||
|
||||
verts[0].point = wPos + Point3F(-squareSize, -squareSize, 0);
|
||||
verts[0].point = wPos + Point3F(-squareSize, squareSize, 0);
|
||||
verts[0].color = iColor;
|
||||
verts[1].point = wPos + Point3F( squareSize, -squareSize, 0);
|
||||
verts[1].point = wPos + Point3F( squareSize, squareSize, 0);
|
||||
verts[1].color = iColor;
|
||||
verts[2].point = wPos + Point3F( squareSize, squareSize, 0);
|
||||
verts[2].point = wPos + Point3F( -squareSize, -squareSize, 0);
|
||||
verts[2].color = iColor;
|
||||
verts[3].point = wPos + Point3F(-squareSize, squareSize, 0);
|
||||
verts[3].point = wPos + Point3F( squareSize, -squareSize, 0);
|
||||
verts[3].color = iColor;
|
||||
verts[4].point = verts[0].point;
|
||||
verts[4].color = iColor;
|
||||
|
|
@ -1452,7 +1452,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
GridPoint selectedGridPoint = sel[i].mGridPoint;
|
||||
Point2I gPos = selectedGridPoint.gridPos;
|
||||
|
||||
GFXVertexPC *verts = &(vertexBuffer[i * 5]);
|
||||
GFXVertexPCT *verts = &(vertexBuffer[i * 5]);
|
||||
|
||||
bool center = gridToWorld(selectedGridPoint, verts[0].point);
|
||||
gridToWorld(Point2I(gPos.x + 1, gPos.y), verts[1].point, selectedGridPoint.terrainBlock);
|
||||
|
|
@ -1503,12 +1503,12 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
|
||||
// Render this bad boy, by stuffing everything into a volatile buffer
|
||||
// and rendering...
|
||||
GFXVertexBufferHandle<GFXVertexPC> selectionVB(GFX, vertexBuffer.size(), GFXBufferTypeStatic);
|
||||
GFXVertexBufferHandle<GFXVertexPCT> selectionVB(GFX, vertexBuffer.size(), GFXBufferTypeStatic);
|
||||
|
||||
selectionVB.lock(0, vertexBuffer.size());
|
||||
|
||||
// Copy stuff
|
||||
dMemcpy((void*)&selectionVB[0], (void*)&vertexBuffer[0], sizeof(GFXVertexPC) * vertexBuffer.size());
|
||||
dMemcpy((void*)&selectionVB[0], (void*)&vertexBuffer[0], sizeof(GFXVertexPCT) * vertexBuffer.size());
|
||||
|
||||
selectionVB.unlock();
|
||||
|
||||
|
|
@ -1518,7 +1518,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
|
||||
if(renderFill)
|
||||
for(U32 i=0; i < sel.size(); i++)
|
||||
GFX->drawPrimitive( GFXTriangleFan, i*5, 4);
|
||||
GFX->drawPrimitive( GFXTriangleStrip, i*5, 4);
|
||||
|
||||
if(renderFrame)
|
||||
for(U32 i=0; i < sel.size(); i++)
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ public:
|
|||
|
||||
const char *getType() const { return "selection"; }
|
||||
void rebuild();
|
||||
void render(Vector<GFXVertexPC> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const;
|
||||
void render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const;
|
||||
void setSize(const Point2I &){}
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -1303,7 +1303,7 @@ void WorldEditor::renderObjectFace(SceneObject * obj, const VectorF & normal, co
|
|||
|
||||
PrimBuild::color( col );
|
||||
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
PrimBuild::begin( GFXTriangleStrip, 4 );
|
||||
for(U32 k = 0; k < 4; k++)
|
||||
{
|
||||
PrimBuild::vertex3f(projPnts[k].x, projPnts[k].y, projPnts[k].z);
|
||||
|
|
@ -1503,7 +1503,7 @@ void WorldEditor::renderSplinePath(SimPath::Path *path)
|
|||
if(vCount > 4000)
|
||||
batchSize = 4000;
|
||||
|
||||
GFXVertexBufferHandle<GFXVertexPC> vb;
|
||||
GFXVertexBufferHandle<GFXVertexPCT> vb;
|
||||
vb.set(GFX, 3*batchSize, GFXBufferTypeVolatile);
|
||||
void *lockPtr = vb.lock();
|
||||
if(!lockPtr) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue