Skip to content

Commit

Permalink
xrRender: fix linux rain drops
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Feb 28, 2020
1 parent 280d681 commit a7d0292
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
49 changes: 23 additions & 26 deletions src/Layers/xrRender/DetailModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,27 @@ void CDetail::Unload()
shader.destroy();
}

/** Dirty hack - transfer indices (in 32bit lines) (2 indices by pass)
* @brief CDetail::transfer_indices
* @param iDest
* @param iOffset
*/
void CDetail::transfer_indices(u16* iDest, u32 iOffset)
{
VERIFY(iOffset < 65535);
{
u32 item = (iOffset << 16) | iOffset;
u32 count = number_indices / 2;
u32* sit = (u32*)(indices);
u32* send = sit + count;
u32* dit = (u32*)(iDest);
for (; sit != send; dit++, sit++)
*dit = *sit + item;
if (number_indices & 1)
iDest[number_indices - 1] = u16(indices[number_indices - 1] + u16(iOffset));
}
}

void CDetail::transfer(Fmatrix& mXform, fvfVertexOut* vDest, u32 C, u16* iDest, u32 iOffset)
{
// Transfer vertices
Expand All @@ -33,19 +54,7 @@ void CDetail::transfer(Fmatrix& mXform, fvfVertexOut* vDest, u32 C, u16* iDest,
}
}

// Transfer indices (in 32bit lines)
VERIFY(iOffset < 65535);
{
u32 item = (iOffset << 16) | iOffset;
u32 count = number_indices / 2;
LPDWORD sit = LPDWORD(indices);
LPDWORD send = sit + count;
LPDWORD dit = LPDWORD(iDest);
for (; sit != send; dit++, sit++)
*dit = *sit + item;
if (number_indices & 1)
iDest[number_indices - 1] = u16(indices[number_indices - 1] + u16(iOffset));
}
transfer_indices(iDest, iOffset);
}

void CDetail::transfer(Fmatrix& mXform, fvfVertexOut* vDest, u32 C, u16* iDest, u32 iOffset, float du, float dv)
Expand All @@ -63,19 +72,7 @@ void CDetail::transfer(Fmatrix& mXform, fvfVertexOut* vDest, u32 C, u16* iDest,
}
}

// Transfer indices (in 32bit lines)
VERIFY(iOffset < 65535);
{
u32 item = (iOffset << 16) | iOffset;
u32 count = number_indices / 2;
LPDWORD sit = LPDWORD(indices);
LPDWORD send = sit + count;
LPDWORD dit = LPDWORD(iDest);
for (; sit != send; dit++, sit++)
*dit = *sit + item;
if (number_indices & 1)
iDest[number_indices - 1] = u16(indices[number_indices - 1] + u16(iOffset));
}
transfer_indices(iDest, iOffset);
}

void CDetail::Load(IReader* S)
Expand Down
2 changes: 2 additions & 0 deletions src/Layers/xrRender/DetailModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

class ECORE_API CDetail : public IRender_DetailModel
{
private:
void transfer_indices(u16* iDest, u32 iOffset);
public:
void Load(IReader* S);
void Optimize();
Expand Down

0 comments on commit a7d0292

Please sign in to comment.