





#include "xcstaticmodels.h"

XCStaticModel_s::XCStaticModel_s()
    : XAsset() {
}

void XCStaticModel_s::ParseData(QDataStream *aStream) {
    if (GetPtr() == -1) {
        // Parse writable
        mWritable.ParseData(aStream);

        // We would parse xmodel here, but we're using a placeholder

        // Parse origin
        aStream->read((char*)mOrigin, 3 * sizeof(float));

        // Parse invScaledAxis
        for (int i = 0; i < 3; ++i) {
            aStream->read((char*)mInvScaledAxis[i], 3 * sizeof(float));
        }

        // Parse absmin and absmax
        aStream->read((char*)mAbsmin, 3 * sizeof(float));
        aStream->read((char*)mAbsmax, 3 * sizeof(float));
    }
}

const XCStaticModelWritable& XCStaticModel_s::GetWritable() const {
    return mWritable;
}

void XCStaticModel_s::SetWritable(const XCStaticModelWritable& writable) {
    mWritable = writable;
}

void* XCStaticModel_s::GetXModel() const {
    return mXModel;
}

void XCStaticModel_s::SetXModel(void* model) {
    mXModel = model;
}

const float* XCStaticModel_s::GetOrigin() const {
    return mOrigin;
}

void XCStaticModel_s::SetOrigin(const float* origin, size_t count) {
    if (count <= 3) {
        memcpy(mOrigin, origin, count * sizeof(float));
    }
}

const float* XCStaticModel_s::GetInvScaledAxis() const {
    return &mInvScaledAxis[0][0];
}

void XCStaticModel_s::SetInvScaledAxis(const float* axis, size_t rows, size_t cols) {
    if (rows <= 3 && cols <= 3) {
        for (size_t i = 0; i < rows; ++i) {
            memcpy(mInvScaledAxis[i], &axis[i * cols], cols * sizeof(float));
        }
    }
}

const float* XCStaticModel_s::GetAbsmin() const {
    return mAbsmin;
}

void XCStaticModel_s::SetAbsmin(const float* absmin, size_t count) {
    if (count <= 3) {
        memcpy(mAbsmin, absmin, count * sizeof(float));
    }
}

const float* XCStaticModel_s::GetAbsmax() const {
    return mAbsmax;
}

void XCStaticModel_s::SetAbsmax(const float* absmax, size_t count) {
    if (count <= 3) {
        memcpy(mAbsmax, absmax, count * sizeof(float));
    }
}



