SSE2: CVector alignment fixes for particle systems

--HG--
branch : sse2
hg/feature/sse2
kaetemi 11 years ago
parent 95fb48fbfc
commit 31b2141b12

@ -41,6 +41,7 @@ namespace NL3D
using NLMISC::CVector;
using NLMISC::CVectorPacked;
using NLMISC::CPlane;
using NLMISC::CMatrix;
@ -842,8 +843,8 @@ private:
void flagSkinVerticesForMatrixBlock(uint8 *skinFlags, CMatrixBlock &mb);
void computeSkinMatrixes(CSkeletonModel *skeleton, CMatrix3x4 *matrixes, CMatrixBlock *prevBlock, CMatrixBlock &curBlock);
void computeSoftwarePointSkinning(CMatrix3x4 *matrixes, CVector *srcVector, CPaletteSkin *srcPal, float *srcWgt, CVector *dstVector);
void computeSoftwareVectorSkinning(CMatrix3x4 *matrixes, CVector *srcVector, CPaletteSkin *srcPal, float *srcWgt, CVector *dstVector);
void computeSoftwarePointSkinning(CMatrix3x4 *matrixes, CVector *srcVector, CPaletteSkin *srcPal, float *srcWgt, CVectorPacked *dstVector);
void computeSoftwareVectorSkinning(CMatrix3x4 *matrixes, CVector *srcVector, CPaletteSkin *srcPal, float *srcWgt, CVectorPacked *dstVector);
// Shadow mapping and CMesh. NB: not serialized, but created at each load
CShadowSkin _ShadowSkin;

@ -102,9 +102,9 @@ public:
*/
virtual void integrateSingle(float /* startDate */, float /* deltaT */, uint /* numStep */,
const CPSLocated * /* src */, uint32 /* indexInLocated */,
NLMISC::CVector * /* destPos */,
NLMISC::CVectorPacked * /* destPos */,
bool /* accumulate */ = false,
uint /* posStride */ = sizeof(NLMISC::CVector)) const
uint /* posStride */ = sizeof(NLMISC::CVectorPacked)) const
{
nlassert(0); // not an integrable force
}
@ -412,9 +412,9 @@ public:
virtual void integrateSingle(float startDate, float deltaT, uint numStep,
const CPSLocated *src, uint32 indexInLocated,
NLMISC::CVector *destPos,
NLMISC::CVectorPacked *destPos,
bool accumulate = false,
uint posStride = sizeof(NLMISC::CVector)) const;
uint posStride = sizeof(NLMISC::CVectorPacked)) const;
protected:
/// inherited from CPSForceIntensityHelper
@ -583,9 +583,9 @@ public:
virtual void integrateSingle(float startDate, float deltaT, uint numStep,
const CPSLocated *src, uint32 indexInLocated,
NLMISC::CVector *destPos,
NLMISC::CVectorPacked *destPos,
bool accumulate = false,
uint posStride = sizeof(NLMISC::CVector)) const;
uint posStride = sizeof(NLMISC::CVectorPacked)) const;
/// perform initialisations
static void initPrecalc();

@ -508,11 +508,12 @@ public:
*/
void integrateSingle(float startDate, float deltaT, uint numStep,
uint32 indexInLocated,
NLMISC::CVector *destPos,
uint posStride = sizeof(NLMISC::CVector)) const;
NLMISC::CVectorPacked *destPos,
uint posStride = sizeof(NLMISC::CVectorPacked)) const;
// compute position for a single element at the given date
// NB : only works with object that have parametric trajectories
inline void computeParametricPos(float date, uint indexInLocated, NLMISC::CVectorPacked &dest) const;
inline void computeParametricPos(float date, uint indexInLocated, NLMISC::CVector &dest) const;
@ -1052,6 +1053,12 @@ inline TAnimationTime CPSLocated::getAgeInSeconds(uint elementIndex) const
// *****************************************************************************************************
inline void CPSLocated::computeParametricPos(float date, uint indexInLocated, NLMISC::CVector &dest) const
{
NLMISC::CVectorPacked temp;
integrateSingle(date, 1.f, 1, indexInLocated, &temp);
dest = temp;
}
inline void CPSLocated::computeParametricPos(float date, uint indexInLocated, NLMISC::CVectorPacked &dest) const
{
integrateSingle(date, 1.f, 1, indexInLocated, &dest);
}

@ -51,12 +51,12 @@ inline uint ScaleFloatGE(float f, float deltaT, float clampValue, uint numStep)
* \param destPos The destination, that will be filled with the given value
* \param stride Number of byte between each value to be copied
*/
inline NLMISC::CVector *FillBufUsingSubdiv(const NLMISC::CVector &value,
inline NLMISC::CVectorPacked *FillBufUsingSubdiv(const NLMISC::CVector &value,
float clampValue,
float &startValue,
float deltaT,
uint &maxNumStep,
NLMISC::CVector *destPos,
NLMISC::CVectorPacked *destPos,
uint32 stride
)
{
@ -68,7 +68,7 @@ inline NLMISC::CVector *FillBufUsingSubdiv(const NLMISC::CVector &value,
while (numToFill--)
{
*destPos = value;
destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
destPos = (NLMISC::CVectorPacked *) ( (uint8 *) destPos + stride);
}
return destPos;

@ -247,7 +247,7 @@ private:
//@}
CSmartPtr<ITexture> _Tex;
CPSVector<NLMISC::CVector>::V _Shape;
CPSVector<NLMISC::CVectorPacked>::V _Shape;
float _UFactor, _VFactor;
TOrientation _Orientation;

@ -120,8 +120,8 @@ protected:
* The dest tab must have at least nbSegs + 1 entries.
*/
void computeRibbon( uint index,
NLMISC::CVector *dest,
uint stride = sizeof(NLMISC::CVector)
NLMISC::CVectorPacked *dest,
uint stride = sizeof(NLMISC::CVectorPacked)
);
/// Called each time the time of the system change in order to update the ribbons positions
@ -168,26 +168,26 @@ private:
/// Compute the ribbon points using linear interpolation between each sampling point.
void computeLinearRibbon( uint index,
NLMISC::CVector *dest,
uint stride = sizeof(NLMISC::CVector)
NLMISC::CVectorPacked *dest,
uint stride = sizeof(NLMISC::CVectorPacked)
);
/// The same as compute linear ribbon but try to make its length constant
void computeLinearCstSizeRibbon( uint index,
NLMISC::CVector *dest,
uint stride = sizeof(NLMISC::CVector)
NLMISC::CVectorPacked *dest,
uint stride = sizeof(NLMISC::CVectorPacked)
);
/// Compute the ribbon points using hermitte splines between each sampling point.
void computeHermitteRibbon( uint index,
NLMISC::CVector *dest,
uint stride = sizeof(NLMISC::CVector)
NLMISC::CVectorPacked *dest,
uint stride = sizeof(NLMISC::CVectorPacked)
);
/** Compute the ribbon points using hermitte splines between each sampling point,
* and make a rough approximation to get a constant length
*/
void computeHermitteCstSizeRibbon( uint index,
NLMISC::CVector *dest,
uint stride = sizeof(NLMISC::CVector)
NLMISC::CVectorPacked *dest,
uint stride = sizeof(NLMISC::CVectorPacked)
);
// called by the system when its date has been manually changed
virtual void systemDateChanged();

@ -83,6 +83,7 @@ public:
);
// a vertex
NL_ALIGN_SSE2(16)
struct CRGBAVertex // FIXME_SSE2
{
#if USE_SSE2
@ -96,8 +97,7 @@ public:
CRGBAVertex(const CVector &v, CRGBA c) : X(v.x), Y(v.y), Z(v.z), Color(c) {}
const CVector &asVector() const
{
//nlctassert(sizeof(CVector) == sizeof(CRGBAVertex));
nlctassert(sizeof(CVector) + 4 == sizeof(CRGBAVertex));
nlctassert(sizeof(CVector) == sizeof(CRGBAVertex));
*reinterpret_cast<const CVector *>(this);
}
#else

@ -53,7 +53,7 @@ class CPlane;
* \author Nevrax France
* \date 2000
*/
NL_ALIGN(16)
NL_ALIGN_SSE2(16)
class CMatrix
{
public:

@ -340,6 +340,9 @@ extern void *operator new(size_t size) throw(std::bad_alloc);
extern void *operator new[](size_t size) throw(std::bad_alloc);
extern void operator delete(void *p) throw();
extern void operator delete[](void *p) throw();
#define NL_ALIGN_SSE2(nb) NL_ALIGN(nb)
#else
#define NL_ALIGN_SSE2(nb)
#endif
// CHashMap, CHashSet and CHashMultiMap definitions

@ -36,15 +36,15 @@ class IStream;
* \author Nevrax France
* \date 2000
*/
// NL_ALIGN(16) // FIXME_SSE2
NL_ALIGN_SSE2(16)
class CVector
{
public: // Attributes.
float x,y,z;
/*#ifdef USE_SSE2 // FIXME_SSE2
#ifdef USE_SSE2
float w; // Padding
#endif*/
#endif
public: // const.
/// Null vector (0,0,0).
@ -176,6 +176,11 @@ public:
{
return CVector(x, y, z);
}
void serial(IStream &f)
{
f.serial(x,y,z);
}
};
// blend (faster version than the generic version found in algo.h)

@ -30,6 +30,7 @@
#include "nel/misc/fast_mem.h"
using namespace std;
using NLMISC::CVectorPacked;
namespace NL3D {
@ -270,9 +271,9 @@ void CComputedString::render2DClip (IDriver& driver, CRenderStringBuffer &rdrBuf
// copy and translate pos
CHECK_VBA_RANGE(srcvba, srcPtr, Vertices.getVertexSize());
CHECK_VBA_RANGE(dstvba, dstPtr, rdrBuffer.Vertices.getVertexSize())
((CVector*)dstPtr)->x= x + ((CVector*)srcPtr)->x;
((CVector*)dstPtr)->y= ((CVector*)srcPtr)->y;
((CVector*)dstPtr)->z= z + ((CVector*)srcPtr)->z;
((CVectorPacked*)dstPtr)->x= x + ((CVectorPacked*)srcPtr)->x;
((CVectorPacked*)dstPtr)->y= ((CVectorPacked*)srcPtr)->y;
((CVectorPacked*)dstPtr)->z= z + ((CVectorPacked*)srcPtr)->z;
// uv
*((CUV*)(dstPtr+ofsDstUV))= *((CUV*)(srcPtr+ofsSrcUV));
// color
@ -298,12 +299,12 @@ void CComputedString::render2DClip (IDriver& driver, CRenderStringBuffer &rdrBuf
uint numVerts= nNumQuadSrc*4;
// clip into VerticesClipped
CVector *pIniPos0 = (CVector*)srcPtr;
CVector *pIniPos2 = (CVector*)(((uint8*)pIniPos0) + srcSize*2);
CVector *pClipPos0 = (CVector*)dstPtr;
CVector *pClipPos1 = (CVector*)(((uint8*)pClipPos0) + dstSize);
CVector *pClipPos2 = (CVector*)(((uint8*)pClipPos1) + dstSize);
CVector *pClipPos3 = (CVector*)(((uint8*)pClipPos2) + dstSize);
CVectorPacked *pIniPos0 = (CVectorPacked*)srcPtr;
CVectorPacked *pIniPos2 = (CVectorPacked*)(((uint8*)pIniPos0) + srcSize*2);
CVectorPacked *pClipPos0 = (CVectorPacked*)dstPtr;
CVectorPacked *pClipPos1 = (CVectorPacked*)(((uint8*)pClipPos0) + dstSize);
CVectorPacked *pClipPos2 = (CVectorPacked*)(((uint8*)pClipPos1) + dstSize);
CVectorPacked *pClipPos3 = (CVectorPacked*)(((uint8*)pClipPos2) + dstSize);
CUV *pClipUV0 = (CUV*)(dstPtr + ofsDstUV );
CUV *pClipUV1 = (CUV*)(((uint8*)pClipUV0) + dstSize);
CUV *pClipUV2 = (CUV*)(((uint8*)pClipUV1) + dstSize);
@ -336,28 +337,28 @@ void CComputedString::render2DClip (IDriver& driver, CRenderStringBuffer &rdrBuf
// copy with no clip
// v0
*((CVector*) (dstPtr + dstSize*0))= *((CVector*) (srcPtr + srcSize*0));
*((CVectorPacked*) (dstPtr + dstSize*0))= *((CVectorPacked*) (srcPtr + srcSize*0));
*((CUV*) (dstPtr + dstSize*0 + ofsDstUV))= *((CUV*)(srcPtr + srcSize*0 + ofsSrcUV));
if (vtype == CVertexBuffer::TRGBA)
*((CRGBA*) (dstPtr + dstSize*0 + ofsDstColor))= mCol;
else
*((CBGRA*) (dstPtr + dstSize*0 + ofsDstColor))= mCol;
// v1
*((CVector*) (dstPtr + dstSize*1))= *((CVector*) (srcPtr + srcSize*1));
*((CVectorPacked*) (dstPtr + dstSize*1))= *((CVectorPacked*) (srcPtr + srcSize*1));
*((CUV*) (dstPtr + dstSize*1 + ofsDstUV))= *((CUV*)(srcPtr + srcSize*1 + ofsSrcUV));
if (vtype == CVertexBuffer::TRGBA)
*((CRGBA*) (dstPtr + dstSize*1 + ofsDstColor))= mCol;
else
*((CBGRA*) (dstPtr + dstSize*1 + ofsDstColor))= mCol;
// v2
*((CVector*) (dstPtr + dstSize*2))= *((CVector*) (srcPtr + srcSize*2));
*((CVectorPacked*) (dstPtr + dstSize*2))= *((CVectorPacked*) (srcPtr + srcSize*2));
*((CUV*) (dstPtr + dstSize*2 + ofsDstUV))= *((CUV*)(srcPtr + srcSize*2 + ofsSrcUV));
if (vtype == CVertexBuffer::TRGBA)
*((CRGBA*) (dstPtr + dstSize*2 + ofsDstColor))= mCol;
else
*((CBGRA*) (dstPtr + dstSize*2 + ofsDstColor))= mCol;
// v3
*((CVector*) (dstPtr + dstSize*3))= *((CVector*) (srcPtr + srcSize*3));
*((CVectorPacked*) (dstPtr + dstSize*3))= *((CVectorPacked*) (srcPtr + srcSize*3));
*((CUV*) (dstPtr + dstSize*3 + ofsDstUV))= *((CUV*)(srcPtr + srcSize*3 + ofsSrcUV));
if (vtype == CVertexBuffer::TRGBA)
*((CRGBA*) (dstPtr + dstSize*3 + ofsDstColor))= mCol;
@ -410,10 +411,10 @@ void CComputedString::render2DClip (IDriver& driver, CRenderStringBuffer &rdrBuf
// next quad out
++nNumQuadClipped;
pClipPos0 = (CVector*)(((uint8*)pClipPos0) + dstSize*4);
pClipPos1 = (CVector*)(((uint8*)pClipPos0) + dstSize);
pClipPos2 = (CVector*)(((uint8*)pClipPos1) + dstSize);
pClipPos3 = (CVector*)(((uint8*)pClipPos2) + dstSize);
pClipPos0 = (CVectorPacked*)(((uint8*)pClipPos0) + dstSize*4);
pClipPos1 = (CVectorPacked*)(((uint8*)pClipPos0) + dstSize);
pClipPos2 = (CVectorPacked*)(((uint8*)pClipPos1) + dstSize);
pClipPos3 = (CVectorPacked*)(((uint8*)pClipPos2) + dstSize);
pClipUV0 = (CUV*)( ((uint8*)pClipUV0) + dstSize*4 );
pClipUV1 = (CUV*)(((uint8*)pClipUV0) + dstSize);
pClipUV2 = (CUV*)(((uint8*)pClipUV1) + dstSize);
@ -421,8 +422,8 @@ void CComputedString::render2DClip (IDriver& driver, CRenderStringBuffer &rdrBuf
dstPtr+= 4*dstSize;
}
// next quad in
pIniPos0 = (CVector*)(((uint8*)pIniPos0) + srcSize*4);
pIniPos2 = (CVector*)(((uint8*)pIniPos0) + srcSize*2);
pIniPos0 = (CVectorPacked*)(((uint8*)pIniPos0) + srcSize*4);
pIniPos2 = (CVectorPacked*)(((uint8*)pIniPos0) + srcSize*2);
srcPtr+= 4*srcSize;
}
@ -506,8 +507,8 @@ void CComputedString::render2DUnProjected (IDriver& driver, CRenderStringBuffer
// copy and translate pos
CHECK_VBA_RANGE(dstvba, dstPtr, Vertices.getVertexSize());
CHECK_VBA_RANGE(srcvba, srcPtr, rdrBuffer.Vertices.getVertexSize());
((CVector*)dstPtr)->x= x + ((CVector*)srcPtr)->x;
((CVector*)dstPtr)->z= z + ((CVector*)srcPtr)->z;
((CVectorPacked*)dstPtr)->x= x + ((CVectorPacked*)srcPtr)->x;
((CVectorPacked*)dstPtr)->z= z + ((CVectorPacked*)srcPtr)->z;
// uv
*((CUV*)(dstPtr+ofsDstUV))= *((CUV*)(srcPtr+ofsSrcUV));
@ -533,12 +534,12 @@ void CComputedString::render2DUnProjected (IDriver& driver, CRenderStringBuffer
uint numVerts= nNumQuadSrc*4;
// clip into VerticesClipped
CVector *pIniPos0 = (CVector*)srcPtr;
CVector *pIniPos2 = (CVector*)(((uint8*)pIniPos0) + srcSize*2);
CVector *pClipPos0 = (CVector*)dstPtr;
CVector *pClipPos1 = (CVector*)(((uint8*)pClipPos0) + dstSize);
CVector *pClipPos2 = (CVector*)(((uint8*)pClipPos1) + dstSize);
CVector *pClipPos3 = (CVector*)(((uint8*)pClipPos2) + dstSize);
CVectorPacked *pIniPos0 = (CVectorPacked*)srcPtr;
CVectorPacked *pIniPos2 = (CVectorPacked*)(((uint8*)pIniPos0) + srcSize*2);
CVectorPacked *pClipPos0 = (CVectorPacked*)dstPtr;
CVectorPacked *pClipPos1 = (CVectorPacked*)(((uint8*)pClipPos0) + dstSize);
CVectorPacked *pClipPos2 = (CVectorPacked*)(((uint8*)pClipPos1) + dstSize);
CVectorPacked *pClipPos3 = (CVectorPacked*)(((uint8*)pClipPos2) + dstSize);
CUV *pClipUV0 = (CUV*)(dstPtr + ofsDstUV );
CUV *pClipUV1 = (CUV*)(((uint8*)pClipUV0) + dstSize);
CUV *pClipUV2 = (CUV*)(((uint8*)pClipUV1) + dstSize);
@ -555,28 +556,28 @@ void CComputedString::render2DUnProjected (IDriver& driver, CRenderStringBuffer
{
// copy with no clip
// v0
*((CVector*) (dstPtr + dstSize*0))= *((CVector*) (srcPtr + srcSize*0));
*((CVectorPacked*) (dstPtr + dstSize*0))= *((CVectorPacked*) (srcPtr + srcSize*0));
*((CUV*) (dstPtr + dstSize*0 + ofsDstUV))= *((CUV*)(srcPtr + srcSize*0 + ofsSrcUV));
if (vtype == CVertexBuffer::TRGBA)
*((CRGBA*) (dstPtr + dstSize*0 + ofsDstColor))= Color;
else
*((CBGRA*) (dstPtr + dstSize*0 + ofsDstColor))= Color;
// v1
*((CVector*) (dstPtr + dstSize*1))= *((CVector*) (srcPtr + srcSize*1));
*((CVectorPacked*) (dstPtr + dstSize*1))= *((CVectorPacked*) (srcPtr + srcSize*1));
*((CUV*) (dstPtr + dstSize*1 + ofsDstUV))= *((CUV*)(srcPtr + srcSize*1 + ofsSrcUV));
if (vtype == CVertexBuffer::TRGBA)
*((CRGBA*) (dstPtr + dstSize*1 + ofsDstColor))= Color;
else
*((CBGRA*) (dstPtr + dstSize*1 + ofsDstColor))= Color;
// v2
*((CVector*) (dstPtr + dstSize*2))= *((CVector*) (srcPtr + srcSize*2));
*((CVectorPacked*) (dstPtr + dstSize*2))= *((CVectorPacked*) (srcPtr + srcSize*2));
*((CUV*) (dstPtr + dstSize*2 + ofsDstUV))= *((CUV*)(srcPtr + srcSize*2 + ofsSrcUV));
if (vtype == CVertexBuffer::TRGBA)
*((CRGBA*) (dstPtr + dstSize*2 + ofsDstColor))= Color;
else
*((CBGRA*) (dstPtr + dstSize*2 + ofsDstColor))= Color;
// v3
*((CVector*) (dstPtr + dstSize*3))= *((CVector*) (srcPtr + srcSize*3));
*((CVectorPacked*) (dstPtr + dstSize*3))= *((CVectorPacked*) (srcPtr + srcSize*3));
*((CUV*) (dstPtr + dstSize*3 + ofsDstUV))= *((CUV*)(srcPtr + srcSize*3 + ofsSrcUV));
if (vtype == CVertexBuffer::TRGBA)
*((CRGBA*) (dstPtr + dstSize*3 + ofsDstColor))= Color;
@ -630,10 +631,10 @@ void CComputedString::render2DUnProjected (IDriver& driver, CRenderStringBuffer
// next quad out
++nNumQuadClipped;
pClipPos0 = (CVector*)(((uint8*)pClipPos0) + dstSize*4);
pClipPos1 = (CVector*)(((uint8*)pClipPos0) + dstSize);
pClipPos2 = (CVector*)(((uint8*)pClipPos1) + dstSize);
pClipPos3 = (CVector*)(((uint8*)pClipPos2) + dstSize);
pClipPos0 = (CVectorPacked*)(((uint8*)pClipPos0) + dstSize*4);
pClipPos1 = (CVectorPacked*)(((uint8*)pClipPos0) + dstSize);
pClipPos2 = (CVectorPacked*)(((uint8*)pClipPos1) + dstSize);
pClipPos3 = (CVectorPacked*)(((uint8*)pClipPos2) + dstSize);
pClipUV0 = (CUV*)( ((uint8*)pClipUV0) + dstSize*4 );
pClipUV1 = (CUV*)(((uint8*)pClipUV0) + dstSize);
pClipUV2 = (CUV*)(((uint8*)pClipUV1) + dstSize);
@ -641,8 +642,8 @@ void CComputedString::render2DUnProjected (IDriver& driver, CRenderStringBuffer
dstPtr+= 4*dstSize;
}
// next quad in
pIniPos0 = (CVector*)(((uint8*)pIniPos0) + srcSize*4);
pIniPos2 = (CVector*)(((uint8*)pIniPos0) + srcSize*2);
pIniPos0 = (CVectorPacked*)(((uint8*)pIniPos0) + srcSize*4);
pIniPos2 = (CVectorPacked*)(((uint8*)pIniPos0) + srcSize*2);
srcPtr+= 4*srcSize;
}
@ -657,13 +658,13 @@ void CComputedString::render2DUnProjected (IDriver& driver, CRenderStringBuffer
{
// preset unprojection
CVector tmp;
tmp.x = ((CVector*)dstPtrBackup)->x * OOW;
tmp.y = ((CVector*)dstPtrBackup)->z * OOH;
tmp.x = ((CVectorPacked*)dstPtrBackup)->x * OOW;
tmp.y = ((CVectorPacked*)dstPtrBackup)->z * OOH;
tmp.z = depth;
// mul by user scale matrix
tmp= scaleMatrix * tmp;
// Unproject it
*((CVector*)dstPtrBackup) = frustum.unProjectZ(tmp);
*((CVectorPacked*)dstPtrBackup) = frustum.unProjectZ(tmp);
dstPtrBackup += dstSize;
}

@ -920,29 +920,29 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV *quads, uint32 nbQuads,
for (uint32 i = 0; i < nbQuads; ++i)
{
const NLMISC::CQuadColorUV &qcuv = quads[i];
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V0;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V0;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs)= qcuv.Uv0;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CRGBA*)(dstPtr+colorOfs)= qcuv.Color0;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V1;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V1;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs)= qcuv.Uv1;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CRGBA*)(dstPtr+colorOfs)= qcuv.Color1;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V2;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V2;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs)= qcuv.Uv2;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CRGBA*)(dstPtr+colorOfs)= qcuv.Color2;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V3;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V3;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs)= qcuv.Uv3;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
@ -955,29 +955,29 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV *quads, uint32 nbQuads,
for (uint32 i = 0; i < nbQuads; ++i)
{
const NLMISC::CQuadColorUV &qcuv = quads[i];
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V0;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V0;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs)= qcuv.Uv0;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CBGRA*)(dstPtr+colorOfs)= qcuv.Color0;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V1;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V1;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs)= qcuv.Uv1;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CBGRA*)(dstPtr+colorOfs)= qcuv.Color1;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V2;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V2;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs)= qcuv.Uv2;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CBGRA))
*(CBGRA*)(dstPtr+colorOfs)= qcuv.Color2;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V3;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V3;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs)= qcuv.Uv3;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
@ -1014,8 +1014,8 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV2 *quads, uint32 nbQuads
for (uint32 i = 0; i < nbQuads; ++i)
{
const NLMISC::CQuadColorUV2 &qcuv = quads[i];
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V0;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V0;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= qcuv.Uv0;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs1, sizeof(CUV))
@ -1023,8 +1023,8 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV2 *quads, uint32 nbQuads
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CRGBA*)(dstPtr+colorOfs)= qcuv.Color0;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V1;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V1;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= qcuv.Uv1;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs1, sizeof(CUV))
@ -1032,8 +1032,8 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV2 *quads, uint32 nbQuads
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CRGBA*)(dstPtr+colorOfs)= qcuv.Color1;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V2;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V2;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= qcuv.Uv2;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs1, sizeof(CUV))
@ -1041,8 +1041,8 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV2 *quads, uint32 nbQuads
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CRGBA*)(dstPtr+colorOfs)= qcuv.Color2;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V3;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V3;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= qcuv.Uv3;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs1, sizeof(CUV))
@ -1057,8 +1057,8 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV2 *quads, uint32 nbQuads
for (uint32 i = 0; i < nbQuads; ++i)
{
const NLMISC::CQuadColorUV2 &qcuv = quads[i];
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V0;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V0;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= qcuv.Uv0;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs1, sizeof(CUV))
@ -1066,8 +1066,8 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV2 *quads, uint32 nbQuads
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CBGRA*)(dstPtr+colorOfs)= qcuv.Color0;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V1;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V1;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= qcuv.Uv1;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs1, sizeof(CUV))
@ -1075,8 +1075,8 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV2 *quads, uint32 nbQuads
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CBGRA*)(dstPtr+colorOfs)= qcuv.Color1;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V2;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V2;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= qcuv.Uv2;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs1, sizeof(CUV))
@ -1084,8 +1084,8 @@ void CDriverUser::drawQuads(const NLMISC::CQuadColorUV2 *quads, uint32 nbQuads
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CBGRA*)(dstPtr+colorOfs)= qcuv.Color2;
dstPtr+= vSize;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= qcuv.V3;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= qcuv.V3;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= qcuv.Uv3;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs1, sizeof(CUV))
@ -1127,24 +1127,24 @@ void CDriverUser::drawTriangles(const NLMISC::CTriangleColorUV *tris, uint32 nbT
do
{
//
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= tris->V0;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= tris->V0;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= tris->Uv0;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CRGBA*)(dstPtr+colorOfs)= tris->Color0;
dstPtr+= vSize;
//
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= tris->V1;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= tris->V1;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= tris->Uv1;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CRGBA*)(dstPtr+colorOfs)= tris->Color1;
dstPtr+= vSize;
//
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= tris->V2;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= tris->V2;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= tris->Uv2;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
@ -1159,24 +1159,24 @@ void CDriverUser::drawTriangles(const NLMISC::CTriangleColorUV *tris, uint32 nbT
do
{
//
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= tris->V0;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= tris->V0;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= tris->Uv0;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CBGRA*)(dstPtr+colorOfs)= tris->Color0;
dstPtr+= vSize;
//
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= tris->V1;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= tris->V1;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= tris->Uv1;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))
*(CBGRA*)(dstPtr+colorOfs)= tris->Color1;
dstPtr+= vSize;
//
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVector))
*(CVector*)(dstPtr+0)= tris->V2;
CHECK_VBA_RANGE(vba, dstPtr+0, sizeof(CVectorPacked))
*(CVectorPacked*)(dstPtr+0)= tris->V2;
CHECK_VBA_RANGE(vba, dstPtr+uvOfs0, sizeof(CUV))
*(CUV*)(dstPtr+uvOfs0)= tris->Uv2;
CHECK_VBA_RANGE(vba, dstPtr+colorOfs, sizeof(CRGBA))

@ -1870,15 +1870,15 @@ void CMeshGeom::applySkin(CSkeletonModel *skeleton)
nlassert(psPal->MatrixId[3]<IDriver::MaxModelMatrix);
// compute vertex part.
computeSoftwarePointSkinning(matrixes, srcVector, psPal, (float*)srcWgt, (CVector*)dstVector);
computeSoftwarePointSkinning(matrixes, srcVector, psPal, (float*)srcWgt, (CVectorPacked*)dstVector);
// compute normal part.
if(skinType>=SkinWithNormal)
computeSoftwareVectorSkinning(matrixes, srcNormal, psPal, (float*)srcWgt, (CVector*)dstNormal);
computeSoftwareVectorSkinning(matrixes, srcNormal, psPal, (float*)srcWgt, (CVectorPacked*)dstNormal);
// compute tg part.
if(skinType>=SkinWithTgSpace)
computeSoftwareVectorSkinning(matrixes, srcTgSpace, psPal, (float*)srcWgt, (CVector*)dstTgSpace);
computeSoftwareVectorSkinning(matrixes, srcTgSpace, psPal, (float*)srcWgt, (CVectorPacked*)dstTgSpace);
}
// inc flags.
@ -1938,42 +1938,48 @@ void CMeshGeom::flagSkinVerticesForMatrixBlock(uint8 *skinFlags, CMatrixBlock &m
// ***************************************************************************
void CMeshGeom::computeSoftwarePointSkinning(CMatrix3x4 *matrixes, CVector *srcVec, CPaletteSkin *srcPal, float *srcWgt, CVector *pDst)
void CMeshGeom::computeSoftwarePointSkinning(CMatrix3x4 *matrixes, CVector *srcVec, CPaletteSkin *srcPal, float *srcWgt, CVectorPacked *pDst)
{
CMatrix3x4 *pMat;
CVector temp;
// 0th matrix influence.
pMat= matrixes + srcPal->MatrixId[0];
pMat->mulSetPoint(*srcVec, srcWgt[0], *pDst);
pMat->mulSetPoint(*srcVec, srcWgt[0], temp);
// 1th matrix influence.
pMat= matrixes + srcPal->MatrixId[1];
pMat->mulAddPoint(*srcVec, srcWgt[1], *pDst);
pMat->mulAddPoint(*srcVec, srcWgt[1], temp);
// 2th matrix influence.
pMat= matrixes + srcPal->MatrixId[2];
pMat->mulAddPoint(*srcVec, srcWgt[2], *pDst);
pMat->mulAddPoint(*srcVec, srcWgt[2], temp);
// 3th matrix influence.
pMat= matrixes + srcPal->MatrixId[3];
pMat->mulAddPoint(*srcVec, srcWgt[3], *pDst);
pMat->mulAddPoint(*srcVec, srcWgt[3], temp);
*pDst = temp;
}
// ***************************************************************************
void CMeshGeom::computeSoftwareVectorSkinning(CMatrix3x4 *matrixes, CVector *srcVec, CPaletteSkin *srcPal, float *srcWgt, CVector *pDst)
void CMeshGeom::computeSoftwareVectorSkinning(CMatrix3x4 *matrixes, CVector *srcVec, CPaletteSkin *srcPal, float *srcWgt, CVectorPacked *pDst)
{
CMatrix3x4 *pMat;
CVector temp;
// 0th matrix influence.
pMat= matrixes + srcPal->MatrixId[0];
pMat->mulSetVector(*srcVec, srcWgt[0], *pDst);
pMat->mulSetVector(*srcVec, srcWgt[0], temp);
// 1th matrix influence.
pMat= matrixes + srcPal->MatrixId[1];
pMat->mulAddVector(*srcVec, srcWgt[1], *pDst);
pMat->mulAddVector(*srcVec, srcWgt[1], temp);
// 2th matrix influence.
pMat= matrixes + srcPal->MatrixId[2];
pMat->mulAddVector(*srcVec, srcWgt[2], *pDst);
pMat->mulAddVector(*srcVec, srcWgt[2], temp);
// 3th matrix influence.
pMat= matrixes + srcPal->MatrixId[3];
pMat->mulAddVector(*srcVec, srcWgt[3], *pDst);
pMat->mulAddVector(*srcVec, srcWgt[3], temp);
*pDst = temp;
}

@ -177,7 +177,7 @@ void CMeshMorpher::update (std::vector<CAnimatedMorph> *pBSFactor)
if (_UseTgSpace)
if (rBS.deltaTgSpace.size() > 0)
{
CVector *pV = (CVector*)dstvba.getTexCoordPointer (vp, tgSpaceStage);
CVectorPacked *pV = (CVectorPacked*)dstvba.getTexCoordPointer (vp, tgSpaceStage);
*pV += rBS.deltaTgSpace[j] * rFactor;
}

@ -418,7 +418,7 @@ void serialPackedVector12(std::vector<uint16> &v, NLMISC::IStream &f)
}
// some function to ease writing of some primitives into a vertex buffer
static inline void pushVBLine2D(NLMISC::CVector *&dest, const NLMISC::CVector &v0, const NLMISC::CVector &v1)
static inline void pushVBLine2D(NLMISC::CVectorPacked *&dest, const NLMISC::CVector &v0, const NLMISC::CVector &v1)
{
dest->x = v0.x;
dest->y = v0.y;
@ -434,7 +434,7 @@ static inline void pushVBLine2D(NLMISC::CVector *&dest, const NLMISC::CVector &v
++ dest;
}
static inline void pushVBTri2D(NLMISC::CVector *&dest, const NLMISC::CTriangle &tri)
static inline void pushVBTri2D(NLMISC::CVectorPacked *&dest, const NLMISC::CTriangle &tri)
{
dest->x = tri.V0.x;
dest->y = tri.V0.y;
@ -451,7 +451,7 @@ static inline void pushVBTri2D(NLMISC::CVector *&dest, const NLMISC::CTriangle &
}
static inline void pushVBQuad2D(NLMISC::CVector *&dest, const NLMISC::CQuad &quad)
static inline void pushVBQuad2D(NLMISC::CVectorPacked *&dest, const NLMISC::CQuad &quad)
{
dest->x = quad.V0.x;
dest->y = quad.V0.y;
@ -471,7 +471,7 @@ static inline void pushVBQuad2D(NLMISC::CVector *&dest, const NLMISC::CQuad &qua
++ dest;
}
static inline void pushVBQuad(NLMISC::CVector *&dest, const NLMISC::CQuad &quad)
static inline void pushVBQuad(NLMISC::CVectorPacked *&dest, const NLMISC::CQuad &quad)
{
*dest++ = quad.V0;
*dest++ = quad.V1;

@ -1026,8 +1026,8 @@ inline void CPatch::fillFar0VertexVB(CTessFarVertex *pVert)
if( !CLandscapeGlobals::VertexProgramEnabled )
{
// Set Pos. Set it local to the current center of landscape
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar0VBInfo.Accessor, CurVBPtr, sizeof(CVector));
*(CVector*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar0VBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked));
*(CVectorPacked*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
// Set Uvs.
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar0VBInfo.Accessor, CurVBPtr + CLandscapeGlobals::CurrentFar0VBInfo.TexCoordOff0, sizeof(CUV));
*(CUV*)(CurVBPtr + CLandscapeGlobals::CurrentFar0VBInfo.TexCoordOff0)= uv;
@ -1038,8 +1038,8 @@ inline void CPatch::fillFar0VertexVB(CTessFarVertex *pVert)
{
// Else must setup Vertex program inputs
// v[0]== StartPos.
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar0VBInfo.Accessor, CurVBPtr, sizeof(CVector));
*(CVector*)CurVBPtr= pVert->Src->StartPos;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar0VBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked));
*(CVectorPacked*)CurVBPtr= pVert->Src->StartPos;
// v[8]== Tex0
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar0VBInfo.Accessor, CurVBPtr + CLandscapeGlobals::CurrentFar0VBInfo.TexCoordOff0, sizeof(CUV));
*(CUV*)(CurVBPtr + CLandscapeGlobals::CurrentFar0VBInfo.TexCoordOff0)= uv;
@ -1110,8 +1110,8 @@ inline void CPatch::fillFar1VertexVB(CTessFarVertex *pVert)
if( !CLandscapeGlobals::VertexProgramEnabled )
{
// Set Pos. Set it local to the current center of landscape
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar1VBInfo.Accessor, CurVBPtr, sizeof(CVector));
*(CVector*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar1VBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked));
*(CVectorPacked*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
// Set Uvs.
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar1VBInfo.Accessor, CurVBPtr + CLandscapeGlobals::CurrentFar1VBInfo.TexCoordOff0, sizeof(CUV));
*(CUV*)(CurVBPtr + CLandscapeGlobals::CurrentFar1VBInfo.TexCoordOff0)= uv;
@ -1126,8 +1126,8 @@ inline void CPatch::fillFar1VertexVB(CTessFarVertex *pVert)
{
// Else must setup Vertex program inputs
// v[0]== StartPos.
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar1VBInfo.Accessor, CurVBPtr, sizeof(CVector));
*(CVector*)CurVBPtr= pVert->Src->StartPos;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar1VBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked));
*(CVectorPacked*)CurVBPtr= pVert->Src->StartPos;
// v[8]== Tex0
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar1VBInfo.Accessor, CurVBPtr + CLandscapeGlobals::CurrentFar1VBInfo.TexCoordOff0, sizeof(CUV));
*(CUV*)(CurVBPtr + CLandscapeGlobals::CurrentFar1VBInfo.TexCoordOff0)= uv;
@ -1179,8 +1179,8 @@ inline void CPatch::fillTileVertexVB(CTessNearVertex *pVert)
if( !CLandscapeGlobals::VertexProgramEnabled )
{
// Set Pos. Set it local to the current center of landscape
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentTileVBInfo.Accessor, CurVBPtr, sizeof(CVector))
*(CVector*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentTileVBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked))
*(CVectorPacked*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
// Set Uvs.
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentTileVBInfo.Accessor, CurVBPtr + CLandscapeGlobals::CurrentTileVBInfo.TexCoordOff0, sizeof(CUV))
*(CUV*)(CurVBPtr + CLandscapeGlobals::CurrentTileVBInfo.TexCoordOff0)= pVert->PUv0;
@ -1193,8 +1193,8 @@ inline void CPatch::fillTileVertexVB(CTessNearVertex *pVert)
{
// Else must setup Vertex program inputs
// v[0]== StartPos.
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentTileVBInfo.Accessor, CurVBPtr, sizeof(CVector))
*(CVector*)CurVBPtr= pVert->Src->StartPos;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentTileVBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked))
*(CVectorPacked*)CurVBPtr= pVert->Src->StartPos;
// v[8]== Tex0
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentTileVBInfo.Accessor, CurVBPtr + CLandscapeGlobals::CurrentTileVBInfo.TexCoordOff0, sizeof(CUV))
*(CUV*)(CurVBPtr + CLandscapeGlobals::CurrentTileVBInfo.TexCoordOff0)= pVert->PUv0;
@ -1383,8 +1383,8 @@ void CPatch::computeGeomorphFar0VertexListVB(CTessList<CTessFarVertex> &vertLi
CurVBPtr+= pVert->Index0 * CLandscapeGlobals::CurrentFar0VBInfo.VertexSize;
// Set Geomorphed Position. Set it local to the current center of landscape
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar0VBInfo.Accessor, CurVBPtr, sizeof(CVector))
*(CVector*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar0VBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked))
*(CVectorPacked*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
}
}
@ -1404,8 +1404,8 @@ void CPatch::computeGeomorphAlphaFar1VertexListVB(CTessList<CTessFarVertex> &v
// NB: the filling order of data is important, for AGP write combiners.
// Set Geomorphed Position. Set it local to the current center of landscape
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar1VBInfo.Accessor, CurVBPtr, sizeof(CVector))
*(CVector*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentFar1VBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked))
*(CVectorPacked*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
// Set Alpha color.
static CRGBA col(255,255,255,255);
@ -1434,8 +1434,8 @@ void CPatch::computeGeomorphTileVertexListVB(CTessList<CTessNearVertex> &vertL
CurVBPtr+= pVert->Index * CLandscapeGlobals::CurrentTileVBInfo.VertexSize;
// Set Geomorphed Position. Set it local to the current center of landscape
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentTileVBInfo.Accessor, CurVBPtr, sizeof(CVector))
*(CVector*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
CHECK_VBA_RANGE(CLandscapeGlobals::CurrentTileVBInfo.Accessor, CurVBPtr, sizeof(CVectorPacked))
*(CVectorPacked*)CurVBPtr= pVert->Src->Pos - CLandscapeGlobals::PZBModelPosition;
}
}

@ -23,6 +23,8 @@
#include "nel/3d/particle_system.h"
#include "nel/misc/fast_mem.h"
using NLMISC::CVectorPacked;
namespace NL3D
{
@ -84,7 +86,7 @@ inline void DrawDot(T it,
do
{
CHECK_VERTEX_BUFFER(vb, currPos);
*((CVector *) currPos) = *it;
*((CVectorPacked *) currPos) = *it;
++it ;
currPos += stride;
}
@ -93,7 +95,7 @@ inline void DrawDot(T it,
else if (srcStep == (1 << 16)) // make sure we haven't got auto-lod and that the step is 1.0
{
// there's no color information in the buffer, so we can copy it directly
NLMISC::CFastMem::memcpy(vba.getVertexCoordPointer(), &(*it), sizeof(NLMISC::CVector) * toProcess);
NLMISC::CFastMem::memcpy(vba.getVertexCoordPointer(), &(*it), sizeof(NLMISC::CVectorPacked) * toProcess);
it += toProcess;
}
else
@ -103,7 +105,7 @@ inline void DrawDot(T it,
do
{
CHECK_VERTEX_BUFFER(vb, currPos);
*((CVector *) currPos) = *it;
*((CVectorPacked *) currPos) = *it;
++it ;
currPos += sizeof(float[3]);
}

@ -914,7 +914,7 @@ uint GenEmitterPositions(CPSLocated *emitter,
uint numStep,
TAnimationTime deltaT, /* fraction of time needed to reach the first emission */
TAnimationTime step,
std::vector<NLMISC::CVector> &dest
std::vector<NLMISC::CVectorPacked> &dest
)
{
NL_PS_FUNC(GenEmitterPositions)
@ -930,8 +930,8 @@ uint GenEmitterPositions(CPSLocated *emitter,
}
else
{
std::vector<NLMISC::CVector>::iterator outIt = dest.end();
std::vector<NLMISC::CVector>::iterator endIt = dest.begin();
std::vector<NLMISC::CVectorPacked>::iterator outIt = dest.end();
std::vector<NLMISC::CVectorPacked>::iterator endIt = dest.begin();
NLMISC::CVector pos = emitter->getPos()[emitterIndex] - deltaT * emitter->getSpeed()[emitterIndex];
NLMISC::CVector speed = step * emitter->getSpeed()[emitterIndex];
do
@ -966,7 +966,7 @@ static inline uint GenEmitterPositionsWithLOD(CPSLocated *emitter,
TAnimationTime deltaT, /* fraction of time needed to reach the first emission */
TAnimationTime step,
float invLODRatio,
std::vector<NLMISC::CVector> &dest
std::vector<NLMISC::CVectorPacked> &dest
)
{
NL_PS_FUNC(GenEmitterPositionsWithLOD)
@ -982,8 +982,8 @@ static inline uint GenEmitterPositionsWithLOD(CPSLocated *emitter,
}
else
{
std::vector<NLMISC::CVector>::iterator outIt = dest.end();
std::vector<NLMISC::CVector>::iterator endIt = dest.begin();
std::vector<NLMISC::CVectorPacked>::iterator outIt = dest.end();
std::vector<NLMISC::CVectorPacked>::iterator endIt = dest.begin();
NLMISC::CVector pos = emitter->getPos()[emitterIndex] - deltaT * emitter->getSpeed()[emitterIndex];
NLMISC::CVector speed = step * invLODRatio * emitter->getSpeed()[emitterIndex];
do
@ -1021,7 +1021,7 @@ void CPSEmitter::processRegularEmissionConsistent(uint firstInstanceIndex, float
//
static std::vector<NLMISC::CVector> emitterPositions;
static std::vector<NLMISC::CVectorPacked> emitterPositions;
// Positions for the emitter. They are computed by using a parametric trajectory or by using integration
const uint size = _Owner->getSize();
@ -1454,7 +1454,7 @@ void CPSEmitter::processRegularEmissionConsistentWithNoLOD(uint firstInstanceInd
//
static std::vector<NLMISC::CVector> emitterPositions;
static std::vector<NLMISC::CVectorPacked> emitterPositions;
// Positions for the emitter. They are computed by using a parametric trajectory or by using integration
const uint size = _Owner->getSize();

@ -23,7 +23,7 @@
#include "nel/3d/particle_system.h"
#include "nel/misc/quat.h"
using NLMISC::CVectorPacked;
namespace NL3D
{
@ -96,27 +96,27 @@ public:
{
const CPlaneBasis &currBasis = f._PrecompBasis[*indexIt].Basis;
CHECK_VERTEX_BUFFER(vb, currVertex);
((CVector *) currVertex)->x = (*posIt).x + *ptSize * currBasis.X.x;
((CVector *) currVertex)->y = (*posIt).y + *ptSize * currBasis.X.y;
((CVector *) currVertex)->z = (*posIt).z + *ptSize * currBasis.X.z;
((CVectorPacked *) currVertex)->x = (*posIt).x + *ptSize * currBasis.X.x;
((CVectorPacked *) currVertex)->y = (*posIt).y + *ptSize * currBasis.X.y;
((CVectorPacked *) currVertex)->z = (*posIt).z + *ptSize * currBasis.X.z;
currVertex += stride;
CHECK_VERTEX_BUFFER(vb, currVertex);
((CVector *) currVertex)->x = (*posIt).x + *ptSize * currBasis.Y.x;
((CVector *) currVertex)->y = (*posIt).y + *ptSize * currBasis.Y.y;
((CVector *) currVertex)->z = (*posIt).z + *ptSize * currBasis.Y.z;
((CVectorPacked *) currVertex)->x = (*posIt).x + *ptSize * currBasis.Y.x;
((CVectorPacked *) currVertex)->y = (*posIt).y + *ptSize * currBasis.Y.y;
((CVectorPacked *) currVertex)->z = (*posIt).z + *ptSize * currBasis.Y.z;
currVertex += stride;
CHECK_VERTEX_BUFFER(vb, currVertex);
((CVector *) currVertex)->x = (*posIt).x - *ptSize * currBasis.X.x;
((CVector *) currVertex)->y = (*posIt).y - *ptSize * currBasis.X.y;
((CVector *) currVertex)->z = (*posIt).z - *ptSize * currBasis.X.z;
((CVectorPacked *) currVertex)->x = (*posIt).x - *ptSize * currBasis.X.x;
((CVectorPacked *) currVertex)->y = (*posIt).y - *ptSize * currBasis.X.y;
((CVectorPacked *) currVertex)->z = (*posIt).z - *ptSize * currBasis.X.z;
currVertex += stride;
CHECK_VERTEX_BUFFER(vb, currVertex);
((CVector *) currVertex)->x = (*posIt).x - *ptSize * currBasis.Y.x;
((CVector *) currVertex)->y = (*posIt).y - *ptSize * currBasis.Y.y;
((CVector *) currVertex)->z = (*posIt).z - *ptSize * currBasis.Y.z;
((CVectorPacked *) currVertex)->x = (*posIt).x - *ptSize * currBasis.Y.x;
((CVectorPacked *) currVertex)->y = (*posIt).y - *ptSize * currBasis.Y.y;
((CVectorPacked *) currVertex)->z = (*posIt).z - *ptSize * currBasis.Y.z;
currVertex += stride;
ptSize += ptSizeIncrement;
++indexIt;
@ -168,27 +168,27 @@ public:
{
// we use this instead of the + operator, because we avoid 4 constructor calls this way
CHECK_VERTEX_BUFFER(vb, currVertex);
((CVector *) currVertex)->x = (*posIt).x + *ptSize * currBasis->X.x;
((CVector *) currVertex)->y = (*posIt).y + *ptSize * currBasis->X.y;
((CVector *) currVertex)->z = (*posIt).z + *ptSize * currBasis->X.z;
((CVectorPacked *) currVertex)->x = (*posIt).x + *ptSize * currBasis->X.x;
((CVectorPacked *) currVertex)->y = (*posIt).y + *ptSize * currBasis->X.y;
((CVectorPacked *) currVertex)->z = (*posIt).z + *ptSize * currBasis->X.z;
currVertex += vSize;
CHECK_VERTEX_BUFFER(vb, currVertex);
((CVector *) currVertex)->x = (*posIt).x + *ptSize * currBasis->Y.x;
((CVector *) currVertex)->y = (*posIt).y + *ptSize * currBasis->Y.y;
((CVector *) currVertex)->z = (*posIt).z + *ptSize * currBasis->Y.z;
((CVectorPacked *) currVertex)->x = (*posIt).x + *ptSize * currBasis->Y.x;
((CVectorPacked *) currVertex)->y = (*posIt).y + *ptSize * currBasis->Y.y;
((CVectorPacked *) currVertex)->z = (*posIt).z + *ptSize * currBasis->Y.z;
currVertex += vSize;
CHECK_VERTEX_BUFFER(vb, currVertex);
((CVector *) currVertex)->x = (*posIt).x - *ptSize * currBasis->X.x;
((CVector *) currVertex)->y = (*posIt).y - *ptSize * currBasis->X.y;
((CVector *) currVertex)->z = (*posIt).z - *ptSize * currBasis->X.z;
((CVectorPacked *) currVertex)->x = (*posIt).x - *ptSize * currBasis->X.x;
((CVectorPacked *) currVertex)->y = (*posIt).y - *ptSize * currBasis->X.y;
((CVectorPacked *) currVertex)->z = (*posIt).z - *ptSize * currBasis->X.z;
currVertex += vSize;
CHECK_VERTEX_BUFFER(vb, currVertex);
((CVector *) currVertex)->x = (*posIt).x - *ptSize * currBasis->Y.x;
((CVector *) currVertex)->y = (*posIt).y - *ptSize * currBasis->Y.y;
((CVector *) currVertex)->z = (*posIt).z - *ptSize * currBasis->Y.z;
((CVectorPacked *) currVertex)->x = (*posIt).x - *ptSize * currBasis->Y.x;
((CVectorPacked *) currVertex)->y = (*posIt).y - *ptSize * currBasis->Y.y;
((CVectorPacked *) currVertex)->z = (*posIt).z - *ptSize * currBasis->Y.z;
currVertex += vSize;
ptSize += ptSizeIncrement;
++posIt;

@ -23,6 +23,7 @@
#include "nel/3d/particle_system.h"
#include "nel/misc/fast_floor.h"
using NLMISC::CVectorPacked;
namespace NL3D
{
@ -147,27 +148,27 @@ public:
v1 = rotTable[tabIndex] * currAlign->I + rotTable[tabIndex + 1] * currAlign->K;
v2 = rotTable[tabIndex + 2] * currAlign->I + rotTable[tabIndex + 3] * currAlign->K;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v2.z;
ptPos += stride;
++it;
@ -199,27 +200,27 @@ public:
v1 = CPSUtil::getCos((sint32) la._Angle2D) * currAlign->I + CPSUtil::getSin((sint32) la._Angle2D) * currAlign->K;
v2 = - CPSUtil::getSin((sint32) la._Angle2D) * currAlign->I + CPSUtil::getCos((sint32) la._Angle2D) * currAlign->K;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x + *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y + *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z + *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x + *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y + *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z + *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x + *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y + *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z + *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x + *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y + *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z + *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x - *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y - *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z - *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x - *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y - *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z - *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x - *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y - *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z - *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x - *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y - *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z - *currentSize2 * v2.z;
ptPos += stride;
++it;
++currAlign;
@ -283,24 +284,24 @@ public:
CHECK_VERTEX_BUFFER(vb, ptPos + stride2);
CHECK_VERTEX_BUFFER(vb, ptPos + stride3);
((CVector *) ptPos)->x = (*it).x + v1.x;
((CVector *) ptPos)->y = (*it).y + v1.y;
((CVector *) ptPos)->z = (*it).z + v1.z;
((CVectorPacked *) ptPos)->x = (*it).x + v1.x;
((CVectorPacked *) ptPos)->y = (*it).y + v1.y;
((CVectorPacked *) ptPos)->z = (*it).z + v1.z;
ptPos += stride;
((CVector *) ptPos)->x = (*it).x + v2.x;
((CVector *) ptPos)->y = (*it).y + v2.y;
((CVector *) ptPos)->z = (*it).z + v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + v2.z;
ptPos += stride;
((CVector *) ptPos)->x = (*it).x - v1.x;
((CVector *) ptPos)->y = (*it).y - v1.y;
((CVector *) ptPos)->z = (*it).z - v1.z;
((CVectorPacked *) ptPos)->x = (*it).x - v1.x;
((CVectorPacked *) ptPos)->y = (*it).y - v1.y;
((CVectorPacked *) ptPos)->z = (*it).z - v1.z;
ptPos += stride;
((CVector *) ptPos)->x = (*it).x - v2.x;
((CVector *) ptPos)->y = (*it).y - v2.y;
((CVector *) ptPos)->z = (*it).z - v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - v2.z;
ptPos += stride;
++it;
@ -336,27 +337,27 @@ public:
v2 = - sinAngle * currAlign->I + cosAngle * currAlign->K;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x + *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y + *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z + *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x + *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y + *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z + *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x + *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y + *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z + *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x + *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y + *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z + *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x - *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y - *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z - *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x - *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y - *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z - *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x - *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y - *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z - *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x - *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y - *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z - *currentSize2 * v2.z;
ptPos += stride;
++it;
++currentAngle;
@ -462,27 +463,27 @@ public:
while (it != endIt)
{
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v2.z;
ptPos += stride;
++it;
@ -498,27 +499,27 @@ public:
while (it != endIt)
{
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + myV1.x;
((CVector *) ptPos)->y = (*it).y + myV1.y;
((CVector *) ptPos)->z = (*it).z + myV1.z;
((CVectorPacked *) ptPos)->x = (*it).x + myV1.x;
((CVectorPacked *) ptPos)->y = (*it).y + myV1.y;
((CVectorPacked *) ptPos)->z = (*it).z + myV1.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + myV2.x;
((CVector *) ptPos)->y = (*it).y + myV2.y;
((CVector *) ptPos)->z = (*it).z + myV2.z;
((CVectorPacked *) ptPos)->x = (*it).x + myV2.x;
((CVectorPacked *) ptPos)->y = (*it).y + myV2.y;
((CVectorPacked *) ptPos)->z = (*it).z + myV2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - myV1.x;
((CVector *) ptPos)->y = (*it).y - myV1.y;
((CVector *) ptPos)->z = (*it).z - myV1.z;
((CVectorPacked *) ptPos)->x = (*it).x - myV1.x;
((CVectorPacked *) ptPos)->y = (*it).y - myV1.y;
((CVectorPacked *) ptPos)->z = (*it).z - myV1.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - myV2.x;
((CVector *) ptPos)->y = (*it).y - myV2.y;
((CVector *) ptPos)->z = (*it).z - myV2.z;
((CVectorPacked *) ptPos)->x = (*it).x - myV2.x;
((CVectorPacked *) ptPos)->y = (*it).y - myV2.y;
((CVectorPacked *) ptPos)->z = (*it).z - myV2.z;
ptPos += stride;
++it;
}
@ -548,27 +549,27 @@ public:
while (it != endIt)
{
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x + *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y + *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z + *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x + *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y + *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z + *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x + *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y + *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z + *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x + *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y + *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z + *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x - *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y - *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z - *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x - *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y - *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z - *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x - *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y - *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z - *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x - *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y - *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z - *currentSize2 * v2.z;
ptPos += stride;
++it;
currentSize += currentSizeStep;
@ -637,81 +638,81 @@ public:
mbv12 = -*currentSize * mbv1n;
mbv1 *= *currentSize * (1 + la._MotionBlurCoeff * n * n) / n;
*(CVector *) ptPos = *it - mbv2;
*(CVector *) (ptPos + stride) = *it + mbv1;
*(CVector *) (ptPos + stride2) = *it + mbv2;
*(CVector *) (ptPos + stride3) = *it + mbv12;
*(CVectorPacked *) ptPos = *it - mbv2;
*(CVectorPacked *) (ptPos + stride) = *it + mbv1;
*(CVectorPacked *) (ptPos + stride2) = *it + mbv2;
*(CVectorPacked *) (ptPos + stride3) = *it + mbv12;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - mbv2.x;
((CVector *) ptPos)->y = (*it).y - mbv2.y;
((CVector *) ptPos)->z = (*it).z - mbv2.z;
((CVectorPacked *) ptPos)->x = (*it).x - mbv2.x;
((CVectorPacked *) ptPos)->y = (*it).y - mbv2.y;
((CVectorPacked *) ptPos)->z = (*it).z - mbv2.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride);
((CVector *) (ptPos + stride))->x = (*it).x + mbv1.x;
((CVector *) (ptPos + stride))->y = (*it).y + mbv1.y;
((CVector *) (ptPos + stride))->z = (*it).z + mbv1.z;
((CVectorPacked *) (ptPos + stride))->x = (*it).x + mbv1.x;
((CVectorPacked *) (ptPos + stride))->y = (*it).y + mbv1.y;
((CVectorPacked *) (ptPos + stride))->z = (*it).z + mbv1.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride2);
((CVector *) (ptPos + stride2))->x = (*it).x + mbv2.x;
((CVector *) (ptPos + stride2))->y = (*it).y + mbv2.y;
((CVector *) (ptPos + stride2))->z = (*it).z + mbv2.z;
((CVectorPacked *) (ptPos + stride2))->x = (*it).x + mbv2.x;
((CVectorPacked *) (ptPos + stride2))->y = (*it).y + mbv2.y;
((CVectorPacked *) (ptPos + stride2))->z = (*it).z + mbv2.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride3);
((CVector *) (ptPos + stride3))->x = (*it).x + mbv12.x;
((CVector *) (ptPos + stride3))->y = (*it).y + mbv12.y;
((CVector *) (ptPos + stride3))->z = (*it).z + mbv12.z;
((CVectorPacked *) (ptPos + stride3))->x = (*it).x + mbv12.x;
((CVectorPacked *) (ptPos + stride3))->y = (*it).y + mbv12.y;
((CVectorPacked *) (ptPos + stride3))->z = (*it).z + mbv12.z;
}
else // speed too small, we must avoid imprecision
{
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v2.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride);
((CVector *) (ptPos + stride))->x = (*it).x + *currentSize * v1.x;
((CVector *) (ptPos + stride))->y = (*it).y + *currentSize * v1.y;
((CVector *) (ptPos + stride))->z = (*it).z + *currentSize * v1.z;
((CVectorPacked *) (ptPos + stride))->x = (*it).x + *currentSize * v1.x;
((CVectorPacked *) (ptPos + stride))->y = (*it).y + *currentSize * v1.y;
((CVectorPacked *) (ptPos + stride))->z = (*it).z + *currentSize * v1.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride2);
((CVector *) (ptPos + stride2))->x = (*it).x + *currentSize * v2.x;
((CVector *) (ptPos + stride2))->y = (*it).y + *currentSize * v2.y;
((CVector *) (ptPos + stride2))->z = (*it).z + *currentSize * v2.z;
((CVectorPacked *) (ptPos + stride2))->x = (*it).x + *currentSize * v2.x;
((CVectorPacked *) (ptPos + stride2))->y = (*it).y + *currentSize * v2.y;
((CVectorPacked *) (ptPos + stride2))->z = (*it).z + *currentSize * v2.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride3);
((CVector *) (ptPos + stride3))->x = (*it).x - *currentSize * v1.x;
((CVector *) (ptPos + stride3))->y = (*it).y - *currentSize * v1.y;
((CVector *) (ptPos + stride3))->z = (*it).z - *currentSize * v1.z;
((CVectorPacked *) (ptPos + stride3))->x = (*it).x - *currentSize * v1.x;
((CVectorPacked *) (ptPos + stride3))->y = (*it).y - *currentSize * v1.y;
((CVectorPacked *) (ptPos + stride3))->z = (*it).z - *currentSize * v1.z;
}
}
else
{
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v2.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride);
((CVector *) (ptPos + stride))->x = (*it).x + *currentSize * v1.x;
((CVector *) (ptPos + stride))->y = (*it).y + *currentSize * v1.y;
((CVector *) (ptPos + stride))->z = (*it).z + *currentSize * v1.z;
((CVectorPacked *) (ptPos + stride))->x = (*it).x + *currentSize * v1.x;
((CVectorPacked *) (ptPos + stride))->y = (*it).y + *currentSize * v1.y;
((CVectorPacked *) (ptPos + stride))->z = (*it).z + *currentSize * v1.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride2);
((CVector *) (ptPos + stride2))->x = (*it).x + *currentSize * v2.x;
((CVector *) (ptPos + stride2))->y = (*it).y + *currentSize * v2.y;
((CVector *) (ptPos + stride2))->z = (*it).z + *currentSize * v2.z;
((CVectorPacked *) (ptPos + stride2))->x = (*it).x + *currentSize * v2.x;
((CVectorPacked *) (ptPos + stride2))->y = (*it).y + *currentSize * v2.y;
((CVectorPacked *) (ptPos + stride2))->z = (*it).z + *currentSize * v2.z;
CHECK_VERTEX_BUFFER(vb, ptPos + stride3);
((CVector *) (ptPos + stride3))->x = (*it).x - *currentSize * v1.x;
((CVector *) (ptPos + stride3))->y = (*it).y - *currentSize * v1.y;
((CVector *) (ptPos + stride3))->z = (*it).z - *currentSize * v1.z;
((CVectorPacked *) (ptPos + stride3))->x = (*it).x - *currentSize * v1.x;
((CVectorPacked *) (ptPos + stride3))->y = (*it).y - *currentSize * v1.y;
((CVectorPacked *) (ptPos + stride3))->z = (*it).z - *currentSize * v1.z;
}
ptPos += stride4;
@ -793,30 +794,30 @@ public:
CHECK_VERTEX_BUFFER(vb, ptPos + stride2);
CHECK_VERTEX_BUFFER(vb, ptPos + stride3);
((CVector *) ptPos)->x = (*it).x + v1.x;
((CVector *) ptPos)->y = (*it).y + v1.y;
((CVector *) ptPos)->z = (*it).z + v1.z;
//nlinfo("** %f, %f, %f", ((CVector *) ptPos)->x, ((CVector *) ptPos)->y, ((CVector *) ptPos)->z);
((CVectorPacked *) ptPos)->x = (*it).x + v1.x;
((CVectorPacked *) ptPos)->y = (*it).y + v1.y;
((CVectorPacked *) ptPos)->z = (*it).z + v1.z;
//nlinfo("** %f, %f, %f", ((CVectorPacked *) ptPos)->x, ((CVectorPacked *) ptPos)->y, ((CVectorPacked *) ptPos)->z);
ptPos += stride;
((CVector *) ptPos)->x = (*it).x + v2.x;
((CVector *) ptPos)->y = (*it).y + v2.y;
((CVector *) ptPos)->z = (*it).z + v2.z;
//nlinfo("%f, %f, %f", ((CVector *) ptPos)->x, ((CVector *) ptPos)->y, ((CVector *) ptPos)->z);
((CVectorPacked *) ptPos)->x = (*it).x + v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + v2.z;
//nlinfo("%f, %f, %f", ((CVectorPacked *) ptPos)->x, ((CVectorPacked *) ptPos)->y, ((CVectorPacked *) ptPos)->z);
ptPos += stride;
((CVector *) ptPos)->x = (*it).x - v1.x;
((CVector *) ptPos)->y = (*it).y - v1.y;
((CVector *) ptPos)->z = (*it).z - v1.z;
//nlinfo("%f, %f, %f", ((CVector *) ptPos)->x, ((CVector *) ptPos)->y, ((CVector *) ptPos)->z);
((CVectorPacked *) ptPos)->x = (*it).x - v1.x;
((CVectorPacked *) ptPos)->y = (*it).y - v1.y;
((CVectorPacked *) ptPos)->z = (*it).z - v1.z;
//nlinfo("%f, %f, %f", ((CVectorPacked *) ptPos)->x, ((CVectorPacked *) ptPos)->y, ((CVectorPacked *) ptPos)->z);
ptPos += stride;
((CVector *) ptPos)->x = (*it).x - v2.x;
((CVector *) ptPos)->y = (*it).y - v2.y;
((CVector *) ptPos)->z = (*it).z - v2.z;
//nlinfo("%f, %f, %f", ((CVector *) ptPos)->x, ((CVector *) ptPos)->y, ((CVector *) ptPos)->z);
((CVectorPacked *) ptPos)->x = (*it).x - v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - v2.z;
//nlinfo("%f, %f, %f", ((CVectorPacked *) ptPos)->x, ((CVectorPacked *) ptPos)->y, ((CVectorPacked *) ptPos)->z);
ptPos += stride;
++it;
@ -851,27 +852,27 @@ public:
v2 = - sinAngle * I + cosAngle * K;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x + *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y + *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z + *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x + *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y + *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z + *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x + *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y + *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z + *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x + *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y + *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z + *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x + *currentSize * v1.x - *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y + *currentSize * v1.y - *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z + *currentSize * v1.z - *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x + *currentSize * v1.x - *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y + *currentSize * v1.y - *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z + *currentSize * v1.z - *currentSize2 * v2.z;
ptPos += stride;
CHECK_VERTEX_BUFFER(vb, ptPos);
((CVector *) ptPos)->x = (*it).x - *currentSize * v1.x - *currentSize2 * v2.x;
((CVector *) ptPos)->y = (*it).y - *currentSize * v1.y - *currentSize2 * v2.y;
((CVector *) ptPos)->z = (*it).z - *currentSize * v1.z - *currentSize2 * v2.z;
((CVectorPacked *) ptPos)->x = (*it).x - *currentSize * v1.x - *currentSize2 * v2.x;
((CVectorPacked *) ptPos)->y = (*it).y - *currentSize * v1.y - *currentSize2 * v2.y;
((CVectorPacked *) ptPos)->z = (*it).z - *currentSize * v1.z - *currentSize2 * v2.z;
ptPos += stride;
++it;
++currentAngle;

@ -23,6 +23,7 @@
#include "nel/3d/particle_system.h"
#include "nel/3d/driver.h"
using NLMISC::CVectorPacked;
namespace NL3D
@ -154,7 +155,7 @@ public:
{
CHECK_VERTEX_BUFFER(*vb, ptVect);
*(CVector *) ptVect = *posIt;
*(CVectorPacked *) ptVect = *posIt;
// the start angle
currentAngle = *currentAnglePt;
const uint8 phaseAdd = (uint8) (f._PhaseSpeed * (*timeIt));
@ -163,7 +164,7 @@ public:
const float moveIntensity = f._MoveIntensity * fanSize;
// compute radius & vect for first fan
firstSize = fanSize + (moveIntensity * CPSUtil::getCos(randomPhaseTab[0] + phaseAdd));
*(CVector *) ptVect = (*posIt) + I * firstSize * (CPSUtil::getCos((sint32) currentAngle))
*(CVectorPacked *) ptVect = (*posIt) + I * firstSize * (CPSUtil::getCos((sint32) currentAngle))
+ K * firstSize * (CPSUtil::getSin((sint32) currentAngle));
currentAngle += angleStep;
ptVect += stride;
@ -173,7 +174,7 @@ public:
for (k = 1; k <= upperBound; ++k)
{
fSize = fanSize + (moveIntensity * CPSUtil::getCos(randomPhaseTab[k] + phaseAdd));
*(CVector *) ptVect = (*posIt) + I * fSize * (CPSUtil::getCos((sint32) currentAngle))
*(CVectorPacked *) ptVect = (*posIt) + I * fSize * (CPSUtil::getCos((sint32) currentAngle))
+ K * fSize * (CPSUtil::getSin((sint32) currentAngle));
currentAngle += angleStep;
ptVect += stride;
@ -183,14 +184,14 @@ public:
sizeStep = sizeStepBase * (firstSize - fSize);
for (; k <= (sint32) (f._NbFans - 1); ++k)
{
*(CVector *) ptVect = (*posIt) + I * fSize * (CPSUtil::getCos((sint32) currentAngle))
*(CVectorPacked *) ptVect = (*posIt) + I * fSize * (CPSUtil::getCos((sint32) currentAngle))
+ K * fSize * (CPSUtil::getSin((sint32) currentAngle));
currentAngle += angleStep;
ptVect += stride;
fSize += sizeStep;
}
// last fan
*(CVector *) ptVect = (*posIt) + I * firstSize * (CPSUtil::getCos((sint32) *currentAnglePt))
*(CVectorPacked *) ptVect = (*posIt) + I * firstSize * (CPSUtil::getCos((sint32) *currentAnglePt))
+ K * firstSize * (CPSUtil::getSin((sint32) *currentAnglePt));
ptVect += stride;
currentSizePt += currentSizePtIncrement;

@ -602,9 +602,9 @@ void CPSGravity::integrate(float date, CPSLocated *src, uint32 startIndex, uint3
void CPSGravity::integrateSingle(float startDate, float deltaT, uint numStep,
const CPSLocated *src, uint32 indexInLocated,
NLMISC::CVector *destPos,
NLMISC::CVectorPacked *destPos,
bool accumulate /*= false*/,
uint stride/* = sizeof(NLMISC::CVector)*/) const
uint stride/* = sizeof(NLMISC::CVectorPacked)*/) const
{
NL_PS_FUNC(CPSGravity_CVector )
nlassert(src->isParametricMotionEnabled());
@ -635,7 +635,7 @@ void CPSGravity::integrateSingle(float startDate, float deltaT, uint numStep,
destPos->y = startPos.y + currDate * startSpeed.y;
destPos->z = startPos.z + currDate * startSpeed.z - _K * halfTimeSquare;
currDate += deltaT;
destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
destPos = (NLMISC::CVectorPacked *) ( (uint8 *) destPos + stride);
}
while (--numStep);
}
@ -655,7 +655,7 @@ void CPSGravity::integrateSingle(float startDate, float deltaT, uint numStep,
float halfTimeSquare = 0.5f * currDate * currDate;
destPos->z -= _K * halfTimeSquare;
currDate += deltaT;
destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
destPos = (NLMISC::CVectorPacked *) ( (uint8 *) destPos + stride);
}
while (--numStep);
}
@ -1146,7 +1146,7 @@ void CPSBrownianForce::integrate(float date, CPSLocated *src,
///==========================================================
void CPSBrownianForce::integrateSingle(float startDate, float deltaT, uint numStep,
const CPSLocated *src, uint32 indexInLocated,
NLMISC::CVector *destPos,
NLMISC::CVectorPacked *destPos,
bool accumulate,
uint stride) const
{
@ -1181,7 +1181,7 @@ void CPSBrownianForce::integrateSingle(float startDate, float deltaT, uint numSt
destPos->y = startPos.y + currDate * startSpeed.y + _K * PrecomputedPos[index].y;
destPos->z = startPos.z + currDate * startSpeed.z + _K * PrecomputedPos[index].z;
currDate += deltaT;
destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
destPos = (NLMISC::CVectorPacked *) ( (uint8 *) destPos + stride);
}
while (--numStep);
}
@ -1203,7 +1203,7 @@ void CPSBrownianForce::integrateSingle(float startDate, float deltaT, uint numSt
destPos->y += _K * PrecomputedPos[index].y;
destPos->z += _K * PrecomputedPos[index].z;
currDate += deltaT;
destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
destPos = (NLMISC::CVectorPacked *) ( (uint8 *) destPos + stride);
}
while (--numStep);
}

@ -257,7 +257,7 @@ void CPSLocated::notifyMotionTypeChanged(void)
/// ***************************************************************************************
void CPSLocated::integrateSingle(float startDate, float deltaT, uint numStep,
uint32 indexInLocated,
NLMISC::CVector *destPos,
NLMISC::CVectorPacked *destPos,
uint stride) const
{
NL_PS_FUNC(CPSLocated_integrateSingle)
@ -293,7 +293,7 @@ void CPSLocated::integrateSingle(float startDate, float deltaT, uint numStep,
destPos->y = pi.Pos.y + currDate * pi.Speed.y;
destPos->z = pi.Pos.z + currDate * pi.Speed.z;
currDate += deltaT;
destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
destPos = (NLMISC::CVectorPacked *) ( (uint8 *) destPos + stride);
}
while (--numStep);
}

@ -660,9 +660,9 @@ public:
CHECK_VERTEX_BUFFER(outVb, outVertex + outNormalOff);
// translate and resize the vertex (relatively to the mesh origin)
*(CVector *) outVertex = *posIt + sM * *(CVector *) inVertex;
*(CVectorPacked *) outVertex = *posIt + sM * *(CVector *) inVertex;
// copy the normal
*(CVector *) (outVertex + outNormalOff) = M * *(CVector *) (inVertex + inNormalOff);
*(CVectorPacked *) (outVertex + outNormalOff) = M * *(CVector *) (inVertex + inNormalOff);
inVertex += inVSize;
@ -683,7 +683,7 @@ public:
CHECK_VERTEX_BUFFER(outVb, outVertex);
// translate and resize the vertex (relatively to the mesh origin)
*(CVector *) outVertex = *posIt + sM * *(CVector *) inVertex;
*(CVectorPacked *) outVertex = *posIt + sM * *(CVector *) inVertex;
inVertex += inVSize;
outVertex += outVSize;
@ -774,9 +774,9 @@ public:
CHECK_VERTEX_BUFFER(outVb, outVertex + outNormalOff);
// morph, and transform the vertex
*(CVector *) outVertex = *posIt + sM * (opLambda * *(CVector *) m0 + lambda * *(CVector *) m1);
*(CVectorPacked *) outVertex = *posIt + sM * (opLambda * *(CVector *) m0 + lambda * *(CVector *) m1);
// morph, and transform the normal
*(CVector *) (outVertex + outNormalOff) = M * (opLambda * *(CVector *) (m0 + inNormalOff)
*(CVectorPacked *) (outVertex + outNormalOff) = M * (opLambda * *(CVector *) (m0 + inNormalOff)
+ lambda * *(CVector *) (m1 + inNormalOff)).normed();
@ -799,7 +799,7 @@ public:
CHECK_VERTEX_BUFFER((*inVB1), m1);
CHECK_VERTEX_BUFFER(outVb, outVertex);
// morph, and transform the vertex
*(CVector *) outVertex = *posIt + sM * (opLambda * *(CVector *) m0 + opLambda * *(CVector *) m1);
*(CVectorPacked *) outVertex = *posIt + sM * (opLambda * *(CVector *) m0 + opLambda * *(CVector *) m1);
m0 += inVSize;
m1 += inVSize;
@ -1684,8 +1684,8 @@ CVertexBuffer &CPSConstraintMesh::makePrerotatedVb(const CVertexBuffer &inVb)
CHECK_VERTEX_BUFFER(prerotatedVb, outVertex);
CHECK_VERTEX_BUFFER(prerotatedVb, outVertex + pNormalOff);
* (CVector *) outVertex = mat.mulVector(* (CVector *) inVertex);
* (CVector *) (outVertex + normalOff) = mat.mulVector(* (CVector *) (inVertex + pNormalOff) );
* (CVectorPacked *) outVertex = mat.mulVector(* (CVector *) inVertex);
* (CVectorPacked *) (outVertex + normalOff) = mat.mulVector(* (CVector *) (inVertex + pNormalOff) );
outVertex += vpSize;
inVertex += vSize;
@ -1701,7 +1701,7 @@ CVertexBuffer &CPSConstraintMesh::makePrerotatedVb(const CVertexBuffer &inVb)
CHECK_VERTEX_BUFFER(prerotatedVb, outVertex);
CHECK_VERTEX_BUFFER(inVb, inVertex);
* (CVector *) outVertex = mat.mulVector(* (CVector *) inVertex);
* (CVectorPacked *) outVertex = mat.mulVector(* (CVector *) inVertex);
outVertex += vpSize;
inVertex += vSize;
}

@ -397,7 +397,7 @@ static inline uint8 *BuildRibbonFirstSlice(const NLMISC::CVector &pos,
NL_PS_FUNC(BuildRibbonFirstSlice)
do
{
* (NLMISC::CVector *) dest = pos;
* (NLMISC::CVectorPacked *) dest = pos;
dest += vertexSize;
}
while (--numVerts);
@ -409,7 +409,7 @@ static inline uint8 *BuildRibbonFirstSlice(const NLMISC::CVector &pos,
// This compute one slice of a ribbon, and return the next vertex to be filled
static inline uint8 *ComputeRibbonSliceFollowPath(const NLMISC::CVector &prev,
const NLMISC::CVector &next,
const NLMISC::CVector *shape,
const NLMISC::CVectorPacked *shape,
uint numVerts,
uint8 *dest,
uint vertexSize,
@ -430,10 +430,10 @@ static inline uint8 *ComputeRibbonSliceFollowPath(const NLMISC::CVector &prev,
}
basis.setPos(next);
const NLMISC::CVector *shapeEnd = shape + numVerts;
const NLMISC::CVectorPacked *shapeEnd = shape + numVerts;
do
{
*(NLMISC::CVector *) dest = basis * (size * (*shape));
*(NLMISC::CVectorPacked *) dest = basis * (size * CVector(*shape));
++shape;
dest += vertexSize;
}
@ -445,7 +445,7 @@ static inline uint8 *ComputeRibbonSliceFollowPath(const NLMISC::CVector &prev,
// This compute one slice of a ribbon, and return the next vertex to be filled
static inline uint8 *ComputeRibbonSliceIdentity(const NLMISC::CVector &prev,
const NLMISC::CVector &next,
const NLMISC::CVector *shape,
const NLMISC::CVectorPacked *shape,
uint numVerts,
uint8 *dest,
uint vertexSize,
@ -453,10 +453,10 @@ static inline uint8 *ComputeRibbonSliceIdentity(const NLMISC::CVector &prev,
)
{
NL_PS_FUNC(ComputeRibbonSliceIdentity)
const NLMISC::CVector *shapeEnd = shape + numVerts;
const NLMISC::CVectorPacked *shapeEnd = shape + numVerts;
do
{
((NLMISC::CVector *) dest)->set(size * shape->x + next.x,
((NLMISC::CVectorPacked *) dest)->set(size * shape->x + next.x,
size * shape->y + next.y,
size * shape->z + next.z);
++shape;
@ -469,7 +469,7 @@ static inline uint8 *ComputeRibbonSliceIdentity(const NLMISC::CVector &prev,
///=========================================================================
static inline uint8 *ComputeRibbonSliceFollowPathXY(const NLMISC::CVector &prev,
const NLMISC::CVector &next,
const NLMISC::CVector *shape,
const NLMISC::CVectorPacked *shape,
uint numVerts,
uint8 *dest,
uint vertexSize,
@ -492,10 +492,10 @@ static inline uint8 *ComputeRibbonSliceFollowPathXY(const NLMISC::CVector &prev,
basis.setRot(I, CVector::K, J, true);
}
basis.setPos(next);
const NLMISC::CVector *shapeEnd = shape + numVerts;
const NLMISC::CVectorPacked *shapeEnd = shape + numVerts;
do
{
*(NLMISC::CVector *) dest = basis * (size * (*shape));
*(NLMISC::CVectorPacked *) dest = basis * (size * CVector(*shape));
++shape;
dest += vertexSize;
}
@ -511,8 +511,8 @@ static inline uint8 *ComputeRibbonSliceFollowPathXY(const NLMISC::CVector &prev,
// This is for untextured versions (no need to duplicate the last vertex of each slice)
static inline uint8 *ComputeUntexturedRibbonMesh(uint8 *destVb,
uint vertexSize,
const NLMISC::CVector *curve,
const NLMISC::CVector *shape,
const NLMISC::CVectorPacked *curve,
const NLMISC::CVectorPacked *shape,
uint numSegs,
uint numVerticesInShape,
float sizeIncrement,
@ -585,8 +585,8 @@ static inline uint8 *ComputeUntexturedRibbonMesh(uint8 *destVb,
// (Textured Version)
static inline uint8 *ComputeTexturedRibbonMesh(uint8 *destVb,
uint vertexSize,
const NLMISC::CVector *curve,
const NLMISC::CVector *shape,
const NLMISC::CVectorPacked *curve,
const NLMISC::CVectorPacked *shape,
uint numSegs,
uint numVerticesInShape,
float sizeIncrement,
@ -612,7 +612,7 @@ static inline uint8 *ComputeTexturedRibbonMesh(uint8 *destVb,
basis
);
// duplicate last vertex ( equal first)
* (NLMISC::CVector *) nextDestVb = * (NLMISC::CVector *) destVb;
* (NLMISC::CVectorPacked *) nextDestVb = * (NLMISC::CVectorPacked *) destVb;
destVb = nextDestVb + vertexSize;
//
++ curve;
@ -633,7 +633,7 @@ static inline uint8 *ComputeTexturedRibbonMesh(uint8 *destVb,
basis
);
// duplicate last vertex ( equal first)
* (NLMISC::CVector *) nextDestVb = * (NLMISC::CVector *) destVb;
* (NLMISC::CVectorPacked *) nextDestVb = * (NLMISC::CVectorPacked *) destVb;
destVb = nextDestVb + vertexSize;
//
++ curve;
@ -653,7 +653,7 @@ static inline uint8 *ComputeTexturedRibbonMesh(uint8 *destVb,
size
);
// duplicate last vertex ( equal first)
* (NLMISC::CVector *) nextDestVb = * (NLMISC::CVector *) destVb;
* (NLMISC::CVectorPacked *) nextDestVb = * (NLMISC::CVectorPacked *) destVb;
destVb = nextDestVb + vertexSize;
//
++ curve;
@ -727,7 +727,7 @@ void CPSRibbon::displayRibbons(uint32 nbRibbons, uint32 srcStep)
const uint numVerticesInShape = (uint)_Shape.size();
//
static std::vector<float> sizes;
static std::vector<NLMISC::CVector> ribbonPos; // this is where the position of each ribbon slice center i stored
static std::vector<NLMISC::CVectorPacked> ribbonPos; // this is where the position of each ribbon slice center i stored
ribbonPos.resize(_UsedNbSegs + 1); // make sure we have enough room
sizes.resize(numRibbonBatch);
@ -782,7 +782,7 @@ void CPSRibbon::displayRibbons(uint32 nbRibbons, uint32 srcStep)
const float ribbonSizeIncrement = *ptCurrSize / (float) _UsedNbSegs;
ptCurrSize += ptCurrSizeIncrement;
// the parent class has a method to get the ribbons positions
computeRibbon((uint) (fpRibbonIndex >> 16), &ribbonPos[0], sizeof(NLMISC::CVector));
computeRibbon((uint) (fpRibbonIndex >> 16), &ribbonPos[0], sizeof(NLMISC::CVectorPacked));
currVert = ComputeTexturedRibbonMesh(currVert,
vertexSize,
&ribbonPos[0],
@ -804,7 +804,7 @@ void CPSRibbon::displayRibbons(uint32 nbRibbons, uint32 srcStep)
const float ribbonSizeIncrement = *ptCurrSize / (float) _UsedNbSegs;
ptCurrSize += ptCurrSizeIncrement;
// the parent class has a method to get the ribbons positions
computeRibbon((uint) (fpRibbonIndex >> 16), &ribbonPos[0], sizeof(NLMISC::CVector));
computeRibbon((uint) (fpRibbonIndex >> 16), &ribbonPos[0], sizeof(NLMISC::CVectorPacked));
currVert = ComputeUntexturedRibbonMesh(currVert,
vertexSize,
&ribbonPos[0],

@ -33,7 +33,7 @@ static inline void BuildHermiteVector(const NLMISC::CVector &P0,
const NLMISC::CVector &P1,
const NLMISC::CVector &T0,
const NLMISC::CVector &T1,
NLMISC::CVector &dest,
NLMISC::CVectorPacked &dest,
float lambda
)
{
@ -54,7 +54,7 @@ static inline void BuildHermiteVector(const NLMISC::CVector &P0,
/// for test
static inline void BuildLinearVector(const NLMISC::CVector &P0,
const NLMISC::CVector &P1,
NLMISC::CVector &dest,
NLMISC::CVectorPacked &dest,
float lambda,
float oneMinusLambda
)
@ -204,7 +204,7 @@ void CPSRibbonBase::updateGlobals()
//=======================================================
void CPSRibbonBase::computeHermitteRibbon(uint index, NLMISC::CVector *dest, uint stride /* = sizeof(NLMISC::CVector)*/)
void CPSRibbonBase::computeHermitteRibbon(uint index, NLMISC::CVectorPacked *dest, uint stride /* = sizeof(NLMISC::CVectorPacked)*/)
{
NL_PS_FUNC(CPSRibbonBase_CVector )
nlassert(!_Parametric);
@ -242,7 +242,7 @@ void CPSRibbonBase::computeHermitteRibbon(uint index, NLMISC::CVector *dest, uin
nlassert(NLMISC::isValidDouble(dest->y));
nlassert(NLMISC::isValidDouble(dest->z));
#endif
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
}
while (--leftToDo);
return;
@ -262,7 +262,7 @@ void CPSRibbonBase::computeHermitteRibbon(uint index, NLMISC::CVector *dest, uin
nlassert(NLMISC::isValidDouble(dest->y));
nlassert(NLMISC::isValidDouble(dest->z));
#endif
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
-- leftToDo;
if (!leftToDo) return;
lambda += lambdaStep;
@ -289,7 +289,7 @@ void CPSRibbonBase::computeHermitteRibbon(uint index, NLMISC::CVector *dest, uin
}
//=======================================================
void CPSRibbonBase::computeLinearRibbon(uint index, NLMISC::CVector *dest, uint stride)
void CPSRibbonBase::computeLinearRibbon(uint index, NLMISC::CVectorPacked *dest, uint stride)
{
NL_PS_FUNC(CPSRibbonBase_computeLinearRibbon)
nlassert(!_Parametric);
@ -321,7 +321,7 @@ void CPSRibbonBase::computeLinearRibbon(uint index, NLMISC::CVector *dest, uint
nlassert(NLMISC::isValidDouble(dest->y));
nlassert(NLMISC::isValidDouble(dest->z));
#endif
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
}
while (--leftToDo);
@ -345,7 +345,7 @@ void CPSRibbonBase::computeLinearRibbon(uint index, NLMISC::CVector *dest, uint
nlassert(NLMISC::isValidDouble(dest->y));
nlassert(NLMISC::isValidDouble(dest->z));
#endif
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
-- leftToDo;
if (!leftToDo) return;
lambda += lambdaStep;
@ -387,14 +387,14 @@ void CPSRibbonBase::computeLinearRibbon(uint index, NLMISC::CVector *dest, uint
do
{
*dest = *currIt;
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
}
while (--leftToDo);
return;
}
float lambdaStep = _UsedSegDuration / dt;
BuildLinearVector(*currIt, *nextIt, *dest, 0.f, 1.f);
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
-- leftToDo;
// snap lambda to nearest time step
lambda = lambdaStep * fmodf(date[0], _UsedSegDuration) / _UsedSegDuration;
@ -406,7 +406,7 @@ void CPSRibbonBase::computeLinearRibbon(uint index, NLMISC::CVector *dest, uint
if (lambda >= 1.f) break;
/// compute a location
BuildLinearVector(*currIt, *nextIt, *dest, lambda, oneMinusLambda);
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
-- leftToDo;
if (!leftToDo) return;
lambda += lambdaStep;
@ -426,7 +426,7 @@ void CPSRibbonBase::computeLinearRibbon(uint index, NLMISC::CVector *dest, uint
do
{
*dest = *currIt;
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
}
while (--leftToDo);
return;
@ -442,7 +442,7 @@ void CPSRibbonBase::computeLinearRibbon(uint index, NLMISC::CVector *dest, uint
//=======================================================
void CPSRibbonBase::computeLinearCstSizeRibbon(uint index, NLMISC::CVector *dest, uint stride /* = sizeof(NLMISC::CVector)*/)
void CPSRibbonBase::computeLinearCstSizeRibbon(uint index, NLMISC::CVectorPacked *dest, uint stride /* = sizeof(NLMISC::CVectorPacked)*/)
{
NL_PS_FUNC(CPSRibbonBase_CVector )
nlassert(!_Parametric);
@ -485,7 +485,7 @@ void CPSRibbonBase::computeLinearCstSizeRibbon(uint index, NLMISC::CVector *dest
nlassert(NLMISC::isValidDouble(dest->y));
nlassert(NLMISC::isValidDouble(dest->z));
#endif
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
-- leftToDo;
if (!leftToDo) return;
lambda += lambdaStep;
@ -512,7 +512,7 @@ void CPSRibbonBase::computeLinearCstSizeRibbon(uint index, NLMISC::CVector *dest
nlassert(NLMISC::isValidDouble(dest->y));
nlassert(NLMISC::isValidDouble(dest->z));
#endif
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
}
return;
}
@ -520,7 +520,7 @@ void CPSRibbonBase::computeLinearCstSizeRibbon(uint index, NLMISC::CVector *dest
}
//=======================================================
void CPSRibbonBase::computeHermitteCstSizeRibbon(uint index, NLMISC::CVector *dest, uint stride /* = sizeof(NLMISC::CVector)*/)
void CPSRibbonBase::computeHermitteCstSizeRibbon(uint index, NLMISC::CVectorPacked *dest, uint stride /* = sizeof(NLMISC::CVectorPacked)*/)
{
NL_PS_FUNC(CPSRibbonBase_CVector )
nlassert(!_Parametric);
@ -567,7 +567,7 @@ void CPSRibbonBase::computeHermitteCstSizeRibbon(uint index, NLMISC::CVector *de
nlassert(NLMISC::isValidDouble(dest->z));
#endif
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
-- leftToDo;
if (!leftToDo) return;
lambda += lambdaStep;
@ -593,7 +593,7 @@ void CPSRibbonBase::computeHermitteCstSizeRibbon(uint index, NLMISC::CVector *de
nlassert(NLMISC::isValidDouble(dest->y));
nlassert(NLMISC::isValidDouble(dest->z));
#endif
dest = (NLMISC::CVector *) ((uint8 *) dest + stride);
dest = (NLMISC::CVectorPacked *) ((uint8 *) dest + stride);
}
return;
}
@ -605,7 +605,7 @@ void CPSRibbonBase::computeHermitteCstSizeRibbon(uint index, NLMISC::CVector *de
//=======================================================
void CPSRibbonBase::computeRibbon(uint index, NLMISC::CVector *dest, uint stride /* = sizeof(NLMISC::CVector)*/)
void CPSRibbonBase::computeRibbon(uint index, NLMISC::CVectorPacked *dest, uint stride /* = sizeof(NLMISC::CVectorPacked)*/)
{
NL_PS_FUNC(CPSRibbonBase_CVector )
switch (_InterpolationMode)

@ -34,7 +34,7 @@ const float NormEpsilon = 10E-8f;
struct CVectInfo
{
NLMISC::CVector Interp;
NLMISC::CVectorPacked Interp;
NLMISC::CVector Proj;
};
typedef std::vector<CVectInfo> TRibbonVect; // a vector used for intermediate computations
@ -247,8 +247,8 @@ static inline void BuildSlice(const NLMISC::CMatrix &mat, CVertexBuffer &vb, uin
invTgNorm = 1.f;
}
// build orthogonals vectors to tangent
*(NLMISC::CVector *) currVert = pos->Interp + ribSize * invTgNorm * (tangent.x * K - tangent.z * I);
*(NLMISC::CVector *) (currVert + vertexSize) = pos->Interp + ribSize * invTgNorm * (- tangent.x * K + tangent.z * I);
*(NLMISC::CVectorPacked *) currVert = NLMISC::CVector(pos->Interp) + ribSize * invTgNorm * (tangent.x * K - tangent.z * I);
*(NLMISC::CVectorPacked *) (currVert + vertexSize) = NLMISC::CVector(pos->Interp) + ribSize * invTgNorm * (- tangent.x * K + tangent.z * I);
}
else if (prev->Proj.y > ZEpsilon) // second point cross the near plane
{
@ -263,8 +263,8 @@ static inline void BuildSlice(const NLMISC::CMatrix &mat, CVertexBuffer &vb, uin
}
else //
{
*(NLMISC::CVector *) currVert = pos->Interp;
*(NLMISC::CVector *) (currVert + vertexSize) = pos->Interp;
*(NLMISC::CVectorPacked *) currVert = pos->Interp;
*(NLMISC::CVectorPacked *) (currVert + vertexSize) = pos->Interp;
return;
}
@ -282,8 +282,8 @@ static inline void BuildSlice(const NLMISC::CMatrix &mat, CVertexBuffer &vb, uin
}
// build orthogonals vectors to tangent
*(NLMISC::CVector *) currVert = inter + ribSize * invTgNorm * (tangent.x * K - tangent.z * I);
*(NLMISC::CVector *) (currVert + vertexSize) = inter + ribSize * invTgNorm * (- tangent.x * K + tangent.z * I);
*(NLMISC::CVectorPacked *) currVert = inter + ribSize * invTgNorm * (tangent.x * K - tangent.z * I);
*(NLMISC::CVectorPacked *) (currVert + vertexSize) = inter + ribSize * invTgNorm * (- tangent.x * K + tangent.z * I);
}
else if (next->Proj.y > ZEpsilon) // first point cross the near plane
{
@ -298,8 +298,8 @@ static inline void BuildSlice(const NLMISC::CMatrix &mat, CVertexBuffer &vb, uin
}
else //
{
*(NLMISC::CVector *) currVert = pos->Interp;
*(NLMISC::CVector *) (currVert + vertexSize) = pos->Interp;
*(NLMISC::CVectorPacked *) currVert = pos->Interp;
*(NLMISC::CVectorPacked *) (currVert + vertexSize) = pos->Interp;
return;
}
@ -316,14 +316,14 @@ static inline void BuildSlice(const NLMISC::CMatrix &mat, CVertexBuffer &vb, uin
}
// build orthogonals vectors to tangent
*(NLMISC::CVector *) currVert = inter + ribSize * invTgNorm * (tangent.x * K - tangent.z * I);
*(NLMISC::CVector *) (currVert + vertexSize) = inter + ribSize * invTgNorm * (- tangent.x * K + tangent.z * I);
*(NLMISC::CVectorPacked *) currVert = inter + ribSize * invTgNorm * (tangent.x * K - tangent.z * I);
*(NLMISC::CVectorPacked *) (currVert + vertexSize) = inter + ribSize * invTgNorm * (- tangent.x * K + tangent.z * I);
}
else // two points are not visible
{
*(NLMISC::CVector *) currVert = pos->Interp;
*(NLMISC::CVector *) (currVert + vertexSize) = pos->Interp;
*(NLMISC::CVectorPacked *) currVert = pos->Interp;
*(NLMISC::CVectorPacked *) (currVert + vertexSize) = pos->Interp;
}
}

@ -23,6 +23,7 @@
#include "nel/3d/ps_iterator.h"
#include "nel/3d/particle_system.h"
using NLMISC::CVectorPacked;
namespace NL3D
{
@ -159,10 +160,10 @@ public:
radVect = *ptCurrSize * (CPSUtil::getCos((sint32) currAngle) * ptCurrBasis->X + CPSUtil::getSin((sint32) currAngle) * ptCurrBasis->Y);
innerVect = radiusRatio * radVect;
CHECK_VERTEX_BUFFER(*vb, currVertex);
* (CVector *) currVertex = *posIt + radVect;
* (CVectorPacked *) currVertex = *posIt + radVect;
currVertex += vSize;
CHECK_VERTEX_BUFFER(*vb, currVertex);
* (CVector *) currVertex = *posIt + innerVect;
* (CVectorPacked *) currVertex = *posIt + innerVect;
currVertex += vSize;
currAngle += angleStep;
}

@ -25,6 +25,8 @@
#include <memory>
using NLMISC::CVectorPacked;
namespace NL3D
{
static NLMISC::CRGBA GradientB2W[] = {NLMISC::CRGBA(0, 0, 0, 0), NLMISC::CRGBA(255, 255, 255, 255) };
@ -330,7 +332,7 @@ void CPSTailDot::displayRibbons(uint32 nbRibbons, uint32 srcStep)
do
{
// the parent class has a method to get the ribbons positions
computeRibbon((uint) (fpRibbonIndex >> 16), (CVector *) currVert, vertexSize);
computeRibbon((uint) (fpRibbonIndex >> 16), (CVectorPacked *) currVert, vertexSize);
currVert += vertexSize * (_UsedNbSegs + 1);
fpRibbonIndex += srcStep;
}
@ -345,7 +347,7 @@ void CPSTailDot::displayRibbons(uint32 nbRibbons, uint32 srcStep)
{
// we compute each pos thanks to the parametric curve
_Owner->integrateSingle(date - _UsedSegDuration * (_UsedNbSegs + 1), _UsedSegDuration, _UsedNbSegs + 1, (uint) (fpRibbonIndex >> 16),
(NLMISC::CVector *) currVert, vertexSize);
(NLMISC::CVectorPacked *) currVert, vertexSize);
currVert += vertexSize * (_UsedNbSegs + 1);
fpRibbonIndex += srcStep;
}

@ -44,6 +44,7 @@ namespace NL3D {
using NLMISC::CVector;
using NLMISC::CVectorPacked;
//#ifdef NL_DEBUG

@ -27,6 +27,7 @@
#include "nel/3d/dru.h"
using NLMISC::CVectorPacked;
@ -162,8 +163,8 @@ void CSegRemanence::registerBasic()
// helper functions to fill vb
static inline void vbPush(uint8 *&dest, const CVector &v)
{
*(CVector *) dest = v;
dest +=sizeof(CVector);
*(CVectorPacked *) dest = v;
dest +=sizeof(CVectorPacked);
}
static inline void vbPush(uint8 *&dest, float f)

@ -33,6 +33,7 @@
#include "nel/3d/texture_bump.h"
#include "nel/3d/water_env_map.h"
using NLMISC::CVectorPacked;
using NLMISC::CVector2f;
@ -1450,15 +1451,15 @@ uint CWaterModel::fillVBSoft(void *datas, uint startTri)
}
for(uint l = 0; l < numVerts - 2; ++l)
{
*(CVector *) dest = unprojectedTriSoft[0];
*(CVectorPacked *) dest = unprojectedTriSoft[0];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[0];
dest += sizeof(float[2]);
*(CVector *) dest = unprojectedTriSoft[l + 1];
*(CVectorPacked *) dest = unprojectedTriSoft[l + 1];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[l + 1];
dest += sizeof(float[2]);
*(CVector *) dest = unprojectedTriSoft[l + 2];
*(CVectorPacked *) dest = unprojectedTriSoft[l + 2];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[l + 2];
dest += sizeof(float[2]);
@ -1481,27 +1482,27 @@ uint CWaterModel::fillVBSoft(void *datas, uint startTri)
computeWaterVertexSoft((float) (x + 1), (float) (y + 1), proj[2], envMap[2], camI, camJ, camK, denom, date, camMat.getPos());
computeWaterVertexSoft((float) x, (float) (y + 1), proj[3], envMap[3], camI, camJ, camK, denom, date, camMat.getPos());
//
*(CVector *) dest = proj[0];
*(CVectorPacked *) dest = proj[0];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[0];
dest += sizeof(float[2]);
*(CVector *) dest = proj[2];
*(CVectorPacked *) dest = proj[2];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[2];
dest += sizeof(float[2]);
*(CVector *) dest = proj[1];
*(CVectorPacked *) dest = proj[1];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[1];
dest += sizeof(float[2]);
*(CVector *) dest = proj[0];
*(CVectorPacked *) dest = proj[0];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[0];
dest += sizeof(float[2]);
*(CVector *) dest = proj[3];
*(CVectorPacked *) dest = proj[3];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[3];
dest += sizeof(float[2]);
*(CVector *) dest = proj[2];
*(CVectorPacked *) dest = proj[2];
dest += sizeof(float[3]);
*(CVector2f *) dest = envMap[2];
dest += sizeof(float[2]);
@ -1557,11 +1558,11 @@ uint CWaterModel::fillVBHard(void *datas, uint startTri)
}
for(uint l = 0; l < numVerts - 2; ++l)
{
*(CVector *) dest = unprojectedTri[0];
*(CVectorPacked *) dest = unprojectedTri[0];
dest += WATER_VERTEX_HARD_SIZE;
*(CVector *) dest = unprojectedTri[l + 1];
*(CVectorPacked *) dest = unprojectedTri[l + 1];
dest += WATER_VERTEX_HARD_SIZE;
*(CVector *) dest = unprojectedTri[l + 2];
*(CVectorPacked *) dest = unprojectedTri[l + 2];
dest += WATER_VERTEX_HARD_SIZE;
}
}
@ -1581,17 +1582,17 @@ uint CWaterModel::fillVBHard(void *datas, uint startTri)
computeWaterVertexHard((float) (x + 1), (float) (y + 1), proj[2], camI, camJ, camK, denom);
computeWaterVertexHard((float) x, (float) (y + 1), proj[3], camI, camJ, camK, denom);
//
*(CVector *) dest = proj[0];
*(CVectorPacked *) dest = proj[0];
dest += WATER_VERTEX_HARD_SIZE;
*(CVector *) dest = proj[2];
*(CVectorPacked *) dest = proj[2];
dest += WATER_VERTEX_HARD_SIZE;
*(CVector *) dest = proj[1];
*(CVectorPacked *) dest = proj[1];
dest += WATER_VERTEX_HARD_SIZE;
*(CVector *) dest = proj[0];
*(CVectorPacked *) dest = proj[0];
dest += WATER_VERTEX_HARD_SIZE;
*(CVector *) dest = proj[3];
*(CVectorPacked *) dest = proj[3];
dest += WATER_VERTEX_HARD_SIZE;
*(CVector *) dest = proj[2];
*(CVectorPacked *) dest = proj[2];
dest += WATER_VERTEX_HARD_SIZE;
}
}

Loading…
Cancel
Save