mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +02:00
Fix -Wclass-memaccess warnings
This commit is contained in:
parent
baa0fd34f4
commit
5a8be4de4b
8 changed files with 28 additions and 16 deletions
|
@ -146,7 +146,7 @@ void ParticleEffectEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEn
|
|||
particleUniforms.rotateWithEntity = _particleProperties.rotateWithEntity ? 1 : 0;
|
||||
});
|
||||
// Update particle uniforms
|
||||
memcpy(&_uniformBuffer.edit<ParticleUniforms>(), &particleUniforms, sizeof(ParticleUniforms));
|
||||
_uniformBuffer.edit<ParticleUniforms>() = particleUniforms;
|
||||
}
|
||||
|
||||
ItemKey ParticleEffectEntityRenderer::getKey() {
|
||||
|
|
|
@ -378,10 +378,10 @@ protected:
|
|||
TransformCamera _cams[2];
|
||||
|
||||
Cameras(){};
|
||||
Cameras(const TransformCamera& cam) { memcpy(_cams, &cam, sizeof(TransformCamera)); };
|
||||
Cameras(const TransformCamera& cam) { _cams[0] = cam; };
|
||||
Cameras(const TransformCamera& camL, const TransformCamera& camR) {
|
||||
memcpy(_cams, &camL, sizeof(TransformCamera));
|
||||
memcpy(_cams + 1, &camR, sizeof(TransformCamera));
|
||||
_cams[0] = camL;
|
||||
_cams[1] = camR;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -331,8 +331,7 @@ void GLBackend::do_setStateBlendFactor(const Batch& batch, size_t paramOffset) {
|
|||
|
||||
void GLBackend::do_setStateScissorRect(const Batch& batch, size_t paramOffset) {
|
||||
Vec4i rect;
|
||||
memcpy(&rect, batch.readData(batch._params[paramOffset]._uint), sizeof(Vec4i));
|
||||
|
||||
memcpy(glm::value_ptr(rect), batch.readData(batch._params[paramOffset]._uint), sizeof(Vec4i));
|
||||
if (_stereo.isStereo()) {
|
||||
rect.z /= 2;
|
||||
if (_stereo._pass) {
|
||||
|
|
|
@ -24,7 +24,7 @@ void GLBackend::do_setViewTransform(const Batch& batch, size_t paramOffset) {
|
|||
}
|
||||
|
||||
void GLBackend::do_setProjectionTransform(const Batch& batch, size_t paramOffset) {
|
||||
memcpy(&_transform._projection, batch.readData(batch._params[paramOffset]._uint), sizeof(Mat4));
|
||||
memcpy(glm::value_ptr(_transform._projection), batch.readData(batch._params[paramOffset]._uint), sizeof(Mat4));
|
||||
_transform._invalidProj = true;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ void GLBackend::do_setProjectionJitter(const Batch& batch, size_t paramOffset) {
|
|||
}
|
||||
|
||||
void GLBackend::do_setViewportTransform(const Batch& batch, size_t paramOffset) {
|
||||
memcpy(&_transform._viewport, batch.readData(batch._params[paramOffset]._uint), sizeof(Vec4i));
|
||||
memcpy(glm::value_ptr(_transform._viewport), batch.readData(batch._params[paramOffset]._uint), sizeof(Vec4i));
|
||||
|
||||
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "OctreeLogging.h"
|
||||
#include "NumericalConstants.h"
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
bool OctreePacketData::_debug = false;
|
||||
AtomicUIntStat OctreePacketData::_totalBytesOfOctalCodes { 0 };
|
||||
|
@ -702,17 +703,17 @@ void OctreePacketData::debugBytes() {
|
|||
}
|
||||
|
||||
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, glm::vec2& result) {
|
||||
memcpy(&result, dataBytes, sizeof(result));
|
||||
memcpy(glm::value_ptr(result), dataBytes, sizeof(result));
|
||||
return sizeof(result);
|
||||
}
|
||||
|
||||
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, glm::vec3& result) {
|
||||
memcpy(&result, dataBytes, sizeof(result));
|
||||
memcpy(glm::value_ptr(result), dataBytes, sizeof(result));
|
||||
return sizeof(result);
|
||||
}
|
||||
|
||||
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, glm::u8vec3& result) {
|
||||
memcpy(&result, dataBytes, sizeof(result));
|
||||
memcpy(glm::value_ptr(result), dataBytes, sizeof(result));
|
||||
return sizeof(result);
|
||||
}
|
||||
|
||||
|
@ -743,7 +744,12 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVecto
|
|||
memcpy(&length, dataBytes, sizeof(uint16_t));
|
||||
dataBytes += sizeof(length);
|
||||
result.resize(length);
|
||||
memcpy(result.data(), dataBytes, length * sizeof(glm::vec3));
|
||||
|
||||
for(int i=0;i<length;i++) {
|
||||
memcpy(glm::value_ptr(result[i]), dataBytes, sizeof(glm::vec3));
|
||||
dataBytes += sizeof(glm::vec3);
|
||||
}
|
||||
|
||||
return sizeof(uint16_t) + length * sizeof(glm::vec3);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "GLMHelpers.h"
|
||||
#include "ByteCountCoding.h"
|
||||
#include "PropertyFlags.h"
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
class BufferParser {
|
||||
public:
|
||||
|
@ -98,7 +99,10 @@ template<>
|
|||
inline void BufferParser::readValue(QVector<glm::vec3>& result) {
|
||||
uint16_t length; readValue(length);
|
||||
result.resize(length);
|
||||
memcpy(result.data(), _data + _offset, sizeof(glm::vec3) * length);
|
||||
for(int i=0;i<length;i++) {
|
||||
memcpy(glm::value_ptr(result[i]), _data + _offset + (sizeof(glm::vec3)*i), sizeof(glm::vec3) * length);
|
||||
}
|
||||
|
||||
_offset += sizeof(glm::vec3) * length;
|
||||
}
|
||||
|
||||
|
|
|
@ -620,7 +620,9 @@ void PolygonClip::clipToScreen(const glm::vec2* inputVertexArray, int inLength,
|
|||
glm::vec2* tempVertexArrayB = new glm::vec2[maxLength];
|
||||
|
||||
// set up our temporary arrays
|
||||
memcpy(tempVertexArrayA, inputVertexArray, sizeof(glm::vec2) * inLength);
|
||||
for(int i=0;i<inLength;i++) {
|
||||
tempVertexArrayA[i] = inputVertexArray[i];
|
||||
}
|
||||
|
||||
// Left edge
|
||||
LineSegment2 edge;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "../NumericalConstants.h"
|
||||
#include "../ViewFrustum.h"
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
void ConicalViewFrustum::set(const ViewFrustum& viewFrustum) {
|
||||
// The ConicalViewFrustum has two parts: a central sphere (same as ViewFrustum) and a circular cone that bounds the frustum part.
|
||||
|
@ -131,9 +132,9 @@ int ConicalViewFrustum::serialize(unsigned char* destinationBuffer) const {
|
|||
int ConicalViewFrustum::deserialize(const unsigned char* sourceBuffer) {
|
||||
const unsigned char* startPosition = sourceBuffer;
|
||||
|
||||
memcpy(&_position, sourceBuffer, sizeof(_position));
|
||||
memcpy(glm::value_ptr(_position), sourceBuffer, sizeof(_position));
|
||||
sourceBuffer += sizeof(_position);
|
||||
memcpy(&_direction, sourceBuffer, sizeof(_direction));
|
||||
memcpy(glm::value_ptr(_direction), sourceBuffer, sizeof(_direction));
|
||||
sourceBuffer += sizeof(_direction);
|
||||
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*)sourceBuffer, &_angle);
|
||||
sourceBuffer += unpackClipValueFromTwoByte(sourceBuffer, _farClip);
|
||||
|
|
Loading…
Reference in a new issue