Exemplo n.º 1
0
//----------------------------------------------------------------------------
int ParticleController::GetMemoryUsed () const
{
    int iBaseSize = sizeof(ParticleController) - sizeof(Controller);

    Particles* pkParticle = (Particles*) m_pkObject;
    int iVertexQuantity = pkParticle->GetVertexQuantity();
    int iDynaSize = iVertexQuantity*sizeof(m_afPointLinearSpeed[0]);
    iDynaSize += iVertexQuantity*sizeof(m_afPointAngularSpeed[0]);
    iDynaSize += iVertexQuantity*sizeof(m_akPointLinearAxis[0]);
    iDynaSize += iVertexQuantity*sizeof(m_akPointAngularAxis[0]);
    iDynaSize += iVertexQuantity*sizeof(m_afPointSizeChange[0]);

    int iTotalSize = iBaseSize + iDynaSize + Controller::GetMemoryUsed();
    return iTotalSize;
}
Exemplo n.º 2
0
//----------------------------------------------------------------------------
int ParticleController::GetDiskUsed () const
{
    int iSize = Controller::GetDiskUsed() +
        sizeof(m_fSystemLinearSpeed) +
        sizeof(m_fSystemAngularSpeed) +
        sizeof(m_kSystemLinearAxis) +
        sizeof(m_kSystemAngularAxis) +
        sizeof(m_fSystemSizeChange);

    Particles* pkParticle = (Particles*) m_pkObject;
    int iVertexQuantity = pkParticle->GetVertexQuantity();

    iSize += sizeof(iVertexQuantity);
    iSize += iVertexQuantity*sizeof(m_afPointLinearSpeed[0]);
    iSize += iVertexQuantity*sizeof(m_afPointAngularSpeed[0]);
    iSize += iVertexQuantity*sizeof(m_akPointLinearAxis[0]);
    iSize += iVertexQuantity*sizeof(m_akPointAngularAxis[0]);
    iSize += iVertexQuantity*sizeof(m_afPointSizeChange[0]);

    return iSize;
}
Exemplo n.º 3
0
//----------------------------------------------------------------------------
void ParticleController::Save (Stream& rkStream)
{
    Controller::Save(rkStream);

    // native data
    StreamWrite(rkStream,m_fSystemLinearSpeed);
    StreamWrite(rkStream,m_fSystemAngularSpeed);
    StreamWrite(rkStream,m_kSystemLinearAxis);
    StreamWrite(rkStream,m_kSystemAngularAxis);

    // Write this to disk so that Load does not have to wait until the
    // controlled object is loaded and linked in order to allocate the
    // arrays.
    Particles* pkParticle = (Particles*)m_pkObject;
    int iVertexQuantity = pkParticle->GetVertexQuantity();
    StreamWrite(rkStream,iVertexQuantity);

    StreamWrite(rkStream,m_afPointLinearSpeed,iVertexQuantity);
    StreamWrite(rkStream,m_afPointAngularSpeed,iVertexQuantity);
    StreamWrite(rkStream,m_akPointLinearAxis,iVertexQuantity);
    StreamWrite(rkStream,m_akPointAngularAxis,iVertexQuantity);
    StreamWrite(rkStream,m_fSystemSizeChange);
    StreamWrite(rkStream,m_afPointSizeChange,iVertexQuantity);
}