Pārlūkot izejas kodu

Fixed relative billboard position on Direct3D.
Billboard node movement no longer needs to dirty the vertex buffer.

Lasse Öörni 13 gadi atpakaļ
vecāks
revīzija
2976340a79

+ 0 - 8
Engine/Graphics/BillboardSet.cpp

@@ -304,14 +304,6 @@ const PODVector<unsigned char>& BillboardSet::GetNetBillboardsAttr() const
     return attrBuffer_.GetBuffer();
 }
 
-void BillboardSet::OnMarkedDirty(Node* node)
-{
-    Drawable::OnMarkedDirty(node);
-    
-    if (node == node_ && relative_)
-        bufferDirty_ = true;
-}
-
 void BillboardSet::OnWorldBoundingBoxUpdate()
 {
     worldBoundingBox_.defined_ = false;

+ 0 - 2
Engine/Graphics/BillboardSet.h

@@ -117,8 +117,6 @@ public:
     const PODVector<unsigned char>& GetNetBillboardsAttr() const;
     
 protected:
-    /// Handle node transform being dirtied. Mark billboards dirty if necessary.
-    virtual void OnMarkedDirty(Node* node);
     /// Recalculate the world-space bounding box.
     virtual void OnWorldBoundingBoxUpdate();
     /// Mark billboard vertex buffer to need an update.

+ 3 - 3
SourceAssets/HLSLShaders/Transform.hlsl

@@ -26,9 +26,9 @@ float GetDepth(float4 clipPos)
     return dot(clipPos.zw, cDepthMode.zw);
 }
 
-float3 GetBillboardPos(float4 iPos, float2 iSize)
+float3 GetBillboardPos(float4 iPos, float2 iSize, float4x3 modelMatrix)
 {
-    return float3(iPos.xyz + iSize.x * cViewRightVector + iSize.y * cViewUpVector);
+    return mul(float4(iPos.xyz + iSize.x * cViewRightVector + iSize.y * cViewUpVector, 1.0), modelMatrix);
 }
 
 float3 GetBillboardNormal()
@@ -45,7 +45,7 @@ float3 GetBillboardNormal()
 #endif
 
 #ifdef BILLBOARD
-    #define GetWorldPos(modelMatrix) GetBillboardPos(iPos, iSize)
+    #define GetWorldPos(modelMatrix) GetBillboardPos(iPos, iSize, modelMatrix)
 #else
     #define GetWorldPos(modelMatrix) mul(iPos, modelMatrix)
 #endif