Beispiel #1
0
void			CIDEEntry_PEDS::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
	case 1:
	case 2:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_strDefaultPedType);
		pDataWriter->writeToken(m_strBehaviour);
		pDataWriter->writeToken(m_strAnimationGroup);
		pDataWriter->writeToken(m_uiCarsCanDrive);
		if (getFormatType() >= 1)
		{
			pDataWriter->writeToken(m_strAnimationFile);
			pDataWriter->writeToken(m_vecPreferredRadioStations.m_x);
			pDataWriter->writeToken(m_vecPreferredRadioStations.m_y);
			if (getFormatType() == 2)
			{
				pDataWriter->writeToken(m_strVoiceArchive);
				pDataWriter->writeToken(m_strVoices[0]);
				pDataWriter->writeToken(m_strVoices[1]);
			}
		}
		break;
	case 3:
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strProps);
		pDataWriter->writeToken(m_strDefaultPedType);
		pDataWriter->writeToken(m_strAnimationGroup);
		pDataWriter->writeToken(m_strGestureGroup);
		pDataWriter->writeToken(m_strGesturePhoneGroup);
		pDataWriter->writeToken(m_strFacialGroup);
		pDataWriter->writeToken(m_strVisemeGroup);
		pDataWriter->writeToken(m_strFlags);
		pDataWriter->writeToken(m_strAnimationFile);
		pDataWriter->writeToken(m_strBlendShapeFile);
		pDataWriter->writeToken(m_vecPreferredRadioStations.m_x);
		pDataWriter->writeToken(m_vecPreferredRadioStations.m_y);
		pDataWriter->writeToken(m_strAudioType);
		pDataWriter->writeToken(m_strFirstVoice);
		pDataWriter->writeToken(m_strLastVoice);
		break;
	default:
		throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
	}
}
real CompressedDataMatrix::sumColumn(int column) {
	real sum = 0.0;
	if (getFormatType(column) == DENSE) {
	    throw new std::invalid_argument("DENSE");
// 		cerr << "Not yet implemented (DENSE)." << endl;
// 		exit(-1);
	} else if (getFormatType(column) == SPARSE) {
	    throw new std::invalid_argument("DENSE");
// 		cerr << "Not yet implemented (SPARSE)." << endl;
// 		exit(-1);
	} else { // is indiciator
		sum = allColumns[column]->getNumberOfEntries();
	}
	return sum;
}
Beispiel #3
0
void			CIDEEntry_ANIM::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_strAnimationName);
		pDataWriter->writeToken(m_fDrawDistance);
		pDataWriter->writeToken(m_uiFlags);
		pDataWriter->writeToken(m_uiUnknown1);
		pDataWriter->writeToken(m_vecBoundingBoxLowerLeftCorner);
		pDataWriter->writeToken(m_vecBoundingBoxUpperRightCorner);
		pDataWriter->writeToken(m_vecBoundingSphereCenterPosition);
		pDataWriter->writeToken(m_fBoundingSphereRadius);
		pDataWriter->writeToken(m_strLODModel);
		break;
	case 1:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_strAnimationName);
		pDataWriter->writeToken(m_fDrawDistance);
		pDataWriter->writeToken(m_uiFlags);
		break;
	default:
		throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
	}
}
size_t CompressedDataMatrix::getNumberOfNonZeroEntries(int column) const {
    const auto type = getFormatType(column);
    if (type == INTERCEPT || type == DENSE) {
        return getNumberOfRows();
    } else {
        return getNumberOfEntries(column);
    }
}
Beispiel #5
0
	void VertexDecl::bindArray()
	{
		bool haveTex = false;
		for ( InfoVec::iterator iter = mInfoVec.begin() , itEnd = mInfoVec.end(); 
			iter != itEnd; ++iter )
		{
			Info& info = *iter;
			switch( info.semantic )
			{
			case Vertex::ePosition:
				glEnableClientState( GL_VERTEX_ARRAY );
				glVertexPointer( getElementSize( info.format ) , getFormatType( info.format ) , mVertexSize , (void*)info.offset );
				break;
			case Vertex::eNormal:
				assert( getElementSize( info.format ) == 3 );
				glEnableClientState( GL_NORMAL_ARRAY );
				glNormalPointer( getFormatType( info.format ) , mVertexSize , (void*)info.offset );
				break;
			case Vertex::eColor:
				if ( info.idx == 0 )
				{
					glEnableClientState( GL_COLOR_ARRAY );
					glColorPointer( getElementSize( info.format ) , getFormatType( info.format ) , mVertexSize , (void*)info.offset );
				}
				else
				{
					glEnableClientState( GL_SECONDARY_COLOR_ARRAY );
					glSecondaryColorPointer( getElementSize( info.format ) , getFormatType( info.format ) , mVertexSize , (void*)info.offset );
				}
				break;
			case Vertex::eTexcoord:
				glClientActiveTexture( GL_TEXTURE0 + info.idx );
				glEnableClientState( GL_TEXTURE_COORD_ARRAY );
				glTexCoordPointer( getElementSize( info.format ) , getFormatType( info.format ) , mVertexSize , (void*)info.offset );
				haveTex = true;
				break;
			}
		}
	}
Beispiel #6
0
void			CIPLEntry_PICK::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
		pDataWriter->writeToken(m_uiWeaponId);
		pDataWriter->writeToken(m_vecPosition);
		break;
	default:
		throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
	}
}
Beispiel #7
0
void			CIDEEntry_HIER::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		break;
	default:
		throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
	}
}
Beispiel #8
0
void			CIDEEntry_PATH_Group::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
		CIDEEntry_PATH::serialize();

		pDataWriter->writeToken(m_strGroupType);
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		break;
	}
}
Beispiel #9
0
void			CIPLEntry_JUMP::serialize(void)
{
    CDataWriter *pDataWriter = CDataWriter::getInstance();

    switch (getFormatType())
    {
    case 0:
        pDataWriter->writeToken(m_vecStartLowerPosition);
        pDataWriter->writeToken(m_vecStartUpperPosition);
        pDataWriter->writeToken(m_vecTargetLowerPosition);
        pDataWriter->writeToken(m_vecTargetUpperPosition);
        pDataWriter->writeToken(m_vecCameraPosition);
        pDataWriter->writeToken(m_uiReward);
        break;
    default:
        throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
    }
}
Beispiel #10
0
void			CIDEEntry_PATH_Node::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
		CIDEEntry_PATH::serialize();

		pDataWriter->writeToken(m_uiNodeType);
		pDataWriter->writeToken(m_uiNextNode);
		pDataWriter->writeToken(m_uiIsCrossRoad);
		pDataWriter->writeToken(m_vecPosition * 16.0f);
		pDataWriter->writeToken(m_fUnknown1);
		pDataWriter->writeToken(m_uiLeftLaneCount);
		pDataWriter->writeToken(m_uiRightLaneCount);
		break;
	}
}
Beispiel #11
0
void			CIPLEntry_TCYC::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
		pDataWriter->write(m_vecPositionLower);
		pDataWriter->write(m_vecPositionUpper);
		pDataWriter->write(m_uiUnknown1);
		pDataWriter->write(m_uiWeatherId);
		pDataWriter->write(m_iBrightness);
		pDataWriter->write(m_uiTime);
		pDataWriter->write(m_uiDrawDistance);
		break;
	default:
		throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
	}
}
Beispiel #12
0
void			CIPLEntry_PATH_Node::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
		CIPLEntry_PATH::serialize();

		pDataWriter->write(m_uiNodeType);
		pDataWriter->write(m_uiNextNode);
		pDataWriter->write(m_uiIsCrossRoad);
		pDataWriter->write(m_vecPosition * 16.0f);
		pDataWriter->write(m_fMedian);
		pDataWriter->write(m_uiLeftLaneCount);
		pDataWriter->write(m_uiRightLaneCount);
		pDataWriter->write(m_uiSpeedLimit);
		pDataWriter->write(m_uiFlags);
		pDataWriter->write(m_fSpawnRate);
		break;
	default:
		throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
	}
}
Beispiel #13
0
void			CIDEEntry_TOBJ::serialize(void)
{
	CDataWriter *pDataWriter = CDataWriter::getInstance();

	switch (getFormatType())
	{
	case 0:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_uiUnknown2);
		break;
	case 1:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_uiClumpCount);
		pDataWriter->writeToken(m_vecDrawDistances[0]);
		pDataWriter->writeToken(m_uiFlags);
		pDataWriter->writeToken(m_uiTimeOn);
		pDataWriter->writeToken(m_uiTimeOff);
		break;
	case 2:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_uiClumpCount);
		pDataWriter->writeToken(m_vecDrawDistances[0]);
		pDataWriter->writeToken(m_vecDrawDistances[1]);
		pDataWriter->writeToken(m_uiFlags);
		pDataWriter->writeToken(m_uiTimeOn);
		pDataWriter->writeToken(m_uiTimeOff);
		break;
	case 3:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_uiClumpCount);
		pDataWriter->writeToken(m_vecDrawDistances[0]);
		pDataWriter->writeToken(m_vecDrawDistances[1]);
		pDataWriter->writeToken(m_vecDrawDistances[2]);
		pDataWriter->writeToken(m_uiFlags);
		pDataWriter->writeToken(m_uiTimeOn);
		pDataWriter->writeToken(m_uiTimeOff);
		break;
	case 4:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_vecDrawDistances[0]);
		pDataWriter->writeToken(m_uiFlags);
		pDataWriter->writeToken(m_uiTimeOn);
		pDataWriter->writeToken(m_uiTimeOff);
		break;
	case 5:
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_vecDrawDistances[0]);
		pDataWriter->writeToken(m_uiFlags);
		pDataWriter->writeToken(m_uiUnknown2);
		pDataWriter->writeToken(m_vecBoundingBoxLowerLeftCorner);
		pDataWriter->writeToken(m_vecBoundingBoxUpperRightCorner);
		pDataWriter->writeToken(m_vecBoundingSphereCenterPosition);
		pDataWriter->writeToken(m_fBoundingSphereRadius);
		pDataWriter->writeToken(m_strLODModel);
		pDataWriter->writeToken(m_uiNightFlags);
		break;
	case 6:
		pDataWriter->writeToken(m_uiObjectId);
		pDataWriter->writeToken(m_strModelName);
		pDataWriter->writeToken(m_strTXDName);
		pDataWriter->writeToken(m_uiClumpCount);
		for (auto fDrawDistance : m_vecDrawDistances)
		{
			pDataWriter->writeToken(fDrawDistance);
		}
		pDataWriter->writeToken(m_uiFlags);

		if (m_uiTokenCount >= (6 + m_vecDrawDistances.size()))
		{
			pDataWriter->writeToken(m_uiTimeOn);
			if (m_uiTokenCount >= (7 + m_vecDrawDistances.size()))
			{
				pDataWriter->writeToken(m_uiTimeOff);
			}
		}
		break;
	default:
		throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
	}
}