This commit is contained in:
Бранимир Караџић 2019-09-08 22:10:42 -07:00
parent 31caa79abe
commit 6533baff7b
4 changed files with 50 additions and 37 deletions

View File

@ -371,10 +371,10 @@ static const float s_cube[8][3] =
{ 0.0f, 0.0f, 0.0f }, // 7
};
float vertLerp(float* __restrict _result, float _iso, uint32_t _idx0, float _v0, uint32_t _idx1, float _v1)
float vertLerp(float* _result, float _iso, uint32_t _idx0, float _v0, uint32_t _idx1, float _v1)
{
const float* __restrict edge0 = s_cube[_idx0];
const float* __restrict edge1 = s_cube[_idx1];
const float* edge0 = s_cube[_idx0];
const float* edge1 = s_cube[_idx1];
if (bx::abs(_iso-_v1) < 0.00001f)
{
@ -401,7 +401,14 @@ float vertLerp(float* __restrict _result, float _iso, uint32_t _idx0, float _v0,
return lerp;
}
uint32_t triangulate(uint8_t* _result, uint32_t _stride, const float* __restrict _rgb, const float* __restrict _xyz, const Grid* _val[8], float _iso)
uint32_t triangulate(
uint8_t* _result
, uint32_t _stride
, const float* _rgb
, const float* _xyz
, const Grid* _val[8]
, float _iso
)
{
uint8_t cubeindex = 0;
cubeindex |= (_val[0]->m_val < _iso) ? 0x01 : 0;

View File

@ -133,11 +133,12 @@ void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _wid
}
}
void mtxBillboard(float* __restrict _result
, const float* __restrict _view
, const float* __restrict _pos
, const float* __restrict _scale
)
void mtxBillboard(
float* _result
, const float* _view
, const float* _pos
, const float* _scale
)
{
_result[ 0] = _view[0] * _scale[0];
_result[ 1] = _view[4] * _scale[0];
@ -157,10 +158,11 @@ void mtxBillboard(float* __restrict _result
_result[15] = 1.0f;
}
void planeNormal(float* __restrict _result
, const float* __restrict _v0
, const float* __restrict _v1
, const float* __restrict _v2
void planeNormal(
float* _result
, const float* _v0
, const float* _v1
, const float* _v2
)
{
const bx::Vec3 v0 = bx::load<bx::Vec3>(_v0);
@ -1189,11 +1191,11 @@ struct ShadowVolume
};
void shadowVolumeLightTransform(
float* __restrict _outLightPos
, const float* __restrict _scale
, const float* __restrict _rotate
, const float* __restrict _translate
, const float* __restrict _lightPos // world pos
float* _outLightPos
, const float* _scale
, const float* _rotate
, const float* _translate
, const float* _lightPos // world pos
)
{
/**
@ -1593,13 +1595,14 @@ void shadowVolumeCreate(
}
}
void createNearClipVolume(float* __restrict _outPlanes24f
, float* __restrict _lightPos
, float* __restrict _view
, float _fovy
, float _aspect
, float _near
)
void createNearClipVolume(
float* _outPlanes24f
, float* _lightPos
, float* _view
, float _fovy
, float _aspect
, float _near
)
{
float (*volumePlanes)[4] = (float(*)[4])_outPlanes24f;

View File

@ -184,10 +184,12 @@ static bgfx::UniformHandle s_shadowMap[ShadowMapRenderTargets::Count];
static bgfx::FrameBufferHandle s_rtShadowMap[ShadowMapRenderTargets::Count];
static bgfx::FrameBufferHandle s_rtBlur;
void mtxBillboard(float* __restrict _result
, const float* __restrict _view
, const float* __restrict _pos
, const float* __restrict _scale)
void mtxBillboard(
float* _result
, const float* _view
, const float* _pos
, const float* _scale
)
{
_result[ 0] = _view[0] * _scale[0];
_result[ 1] = _view[4] * _scale[0];
@ -207,7 +209,7 @@ void mtxBillboard(float* __restrict _result
_result[15] = 1.0f;
}
void mtxYawPitchRoll(float* __restrict _result
void mtxYawPitchRoll(float* _result
, float _yaw
, float _pitch
, float _roll
@ -1061,12 +1063,13 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBott
}
}
void worldSpaceFrustumCorners(float* _corners24f
void worldSpaceFrustumCorners(
float* _corners24f
, float _near
, float _far
, float _projWidth
, float _projHeight
, const float* __restrict _invViewMtx
, const float* _invViewMtx
)
{
// Define frustum corners in view space.

View File

@ -283,12 +283,12 @@ namespace bgfx
return bx::load<bx::Vec3>(&vertices[_index*_stride]);
}
inline float distanceDir(const float* __restrict _dir, const void* __restrict _vertices, uint32_t _stride, uint32_t _index)
inline float distanceDir(const float* _dir, const void* _vertices, uint32_t _stride, uint32_t _index)
{
return bx::dot(vertexPos(_vertices, _stride, _index), bx::load<bx::Vec3>(_dir) );
}
inline float distancePos(const float* __restrict _pos, const void* __restrict _vertices, uint32_t _stride, uint32_t _index)
inline float distancePos(const float* _pos, const void* _vertices, uint32_t _stride, uint32_t _index)
{
const bx::Vec3 tmp = bx::sub(bx::load<bx::Vec3>(_pos), vertexPos(_vertices, _stride, _index) );
return bx::sqrt(bx::dot(tmp, tmp) );
@ -299,10 +299,10 @@ namespace bgfx
template<typename IndexT, DistanceFn dfn, KeyFn kfn, uint32_t xorBits>
inline void calcSortKeys(
uint32_t* __restrict _keys
, uint32_t* __restrict _values
uint32_t* _keys
, uint32_t* _values
, const float _dirOrPos[3]
, const void* __restrict _vertices
, const void* _vertices
, uint32_t _stride
, const IndexT* _indices
, uint32_t _num