Tuesday, March 12, 2013

[c/c++] use reference variable to set values


    ExpandedVertex& beforeVec = (*m_hVecGlobalVecRef)[i];

    beforeVec.pos.x = temp_hPos[i*4] ;
    beforeVec.pos.y = temp_hPos[i*4+1];
    beforeVec.pos.z = temp_hPos[i*4+2];
    beforeVec.mass = temp_hPos[i*4+3];

    beforeVec.vel.x = temp_hVel[i*4];
    beforeVec.vel.y = temp_hVel[i*4+1];
    beforeVec.vel.z = temp_hVel[i*4+2];
    beforeVec.mass = temp_hVel[i*4+3];

No comments:

Post a Comment