Пример #1
0
//----------------------------------------------------------------------------
void KeyframeController::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    TransformController::Load(source);

    source.Read(mNumCommonTimes);
    if (mNumCommonTimes > 0)
    {
        source.ReadVR(mNumCommonTimes, mCommonTimes);
        source.ReadAggregateRR(mNumTranslations, mTranslations);
        source.ReadAggregateRR(mNumRotations, mRotations);
        source.ReadRR(mNumScales, mScales);
    }
    else
    {
        source.ReadRR(mNumTranslations, mTranslationTimes);
        source.ReadAggregateVR(mNumTranslations, mTranslations);
        source.ReadRR(mNumRotations, mRotationTimes);
        source.ReadAggregateVR(mNumRotations, mRotations);
        source.ReadRR(mNumScales, mScaleTimes);
        source.ReadVR(mNumScales, mScales);
    }

    WM5_END_DEBUG_STREAM_LOAD(KeyframeController, source);
}
Пример #2
0
//----------------------------------------------------------------------------
void Shader::Load (InStream& source)
{
	WM5_BEGIN_DEBUG_STREAM_LOAD(source);

	Object::Load(source);

	source.ReadStringRR(mNumInputs, mInputName);
	source.ReadEnumVR(mNumInputs, mInputType);
	source.ReadEnumVR(mNumInputs, mInputSemantic);
	source.ReadStringRR(mNumOutputs, mOutputName);
	source.ReadEnumVR(mNumOutputs, mOutputType);
	source.ReadEnumVR(mNumOutputs, mOutputSemantic);
	source.ReadStringRR(mNumConstants, mConstantName);
	source.ReadVR(mNumConstants, mNumRegistersUsed);
	source.ReadStringRR(mNumSamplers, mSamplerName);
	source.ReadEnumVR(mNumSamplers, mSamplerType);
	source.ReadEnumVR(mNumSamplers, mFilter);
	source.ReadEnumVR(mNumSamplers, mCoordinate[0]);
	source.ReadEnumVR(mNumSamplers, mCoordinate[1]);
	source.ReadEnumVR(mNumSamplers, mCoordinate[2]);
	source.ReadVR(mNumSamplers, mLodBias);
	source.ReadVR(mNumSamplers, mAnisotropy);
	source.ReadAggregateVR(mNumSamplers, mBorderColor);

	// Test for modified MAX_PROFILES.
	int maxProfiles;
	source.Read(maxProfiles);

#ifdef WM5_ASSERT_ON_CHANGED_MAX_PROFILES
	assertion(maxProfiles == MAX_PROFILES,
	          "You changed MAX_PROFILES and are loading an old data set.\n");
#endif

	source.ReadBool(mProfileOwner);
	if (mProfileOwner)
	{
		int i;
		for (i = 0; i < maxProfiles; ++i)
		{
			source.ReadVR(mNumConstants, mBaseRegister[i]);
			source.ReadVR(mNumSamplers, mTextureUnit[i]);
			mProgram[i] = new0 std::string();
			source.ReadString(*mProgram[i]);
		}
		for (i = maxProfiles; i < MAX_PROFILES; ++i)
		{
			mBaseRegister[i] = 0;
			mTextureUnit[i] = 0;
			mProgram[i] = 0;
		}
	}

	WM5_END_DEBUG_STREAM_LOAD(Shader, source);
}
Пример #3
0
//----------------------------------------------------------------------------
void DlodNode::Load (InStream& source)
{
    PX2_BEGIN_DEBUG_STREAM_LOAD(source);

    SwitchNode::Load(source);

    source.ReadAggregate(mModelLodCenter);
    source.ReadRR(mNumLevelsOfDetail, mModelMinDist);
    source.ReadVR(mNumLevelsOfDetail, mModelMaxDist);
    source.ReadVR(mNumLevelsOfDetail, mWorldMinDist);
    source.ReadVR(mNumLevelsOfDetail, mWorldMaxDist);

    PX2_END_DEBUG_STREAM_LOAD(DlodNode, source);
}
//----------------------------------------------------------------------------
void CollapseRecordArray::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    Object::Load(source);

    source.Read(mNumRecords);
    mRecords = new1<CollapseRecord>(mNumRecords);

    for (int i = 0; i < mNumRecords; ++i)
    {
        source.Read(mRecords[i].VKeep);
        source.Read(mRecords[i].VThrow);
        source.Read(mRecords[i].NumVertices);
        source.Read(mRecords[i].NumTriangles);
        source.Read(mRecords[i].NumIndices);
        if (mRecords[i].NumIndices > 0)
        {
            mRecords[i].Indices = new1<int>(mRecords[i].NumIndices);
            source.ReadVR(mRecords[i].NumIndices, mRecords[i].Indices);
        }
        else
        {
            mRecords[i].Indices = 0;
        }
    }

    WM5_END_DEBUG_STREAM_LOAD(CollapseRecordArray, source);
}
Пример #5
0
//----------------------------------------------------------------------------
void RawTerrainPage::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	TriMesh::Load(source);

	source.Read(mSize);
	int numVertices = mSize*mSize;
	source.ReadVR(numVertices, mHeights);
	source.ReadAggregate(mOrigin);
	source.Read(mSpacing);

	mSizeM1 = mSize - 1;
	mInvSpacing = 1.0f/mSpacing;

	source.ReadPointer(mMaterialInstance);
	source.ReadPointer(mTextureDefault);
	source.ReadPointer(mTexture0);
	source.ReadPointer(mTextureAlpha);
	source.ReadPointer(mTexture1);
	source.ReadPointer(mTexture2);
	source.ReadPointer(mTexture3);
	source.ReadPointer(mTexture4);
	source.ReadAggregate(mUV01);
	source.ReadAggregate(mUV23);
	source.ReadAggregate(mUV4);
	source.ReadPointer(mUV01Float);
	source.ReadPointer(mUV23Float);
	source.ReadPointer(mUV4Float);
	
	PX2_END_DEBUG_STREAM_LOAD(RawTerrainPage, source);
}
//----------------------------------------------------------------------------
void TerrainPage::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	TriMesh::Load(source);
	PX2_VERSION_LOAD(source);

	source.Read(mSize);
	int numVertices = mSize*mSize;
	source.ReadVR(numVertices, mHeights);
	source.ReadAggregate(mOrigin);
	source.Read(mSpacing);

	mSizeM1 = mSize - 1;
	mInvSpacing = 1.0f/mSpacing;

	int numJunglers = 0;
	source.Read(numJunglers);
	if (numJunglers > 0)
	{
		mJunglers.resize(numJunglers);
		source.ReadPointerVV(numJunglers, &mJunglers[0]);
	}

	PX2_END_DEBUG_STREAM_LOAD(TerrainPage, source);
}
Пример #7
0
//----------------------------------------------------------------------------
void RevolutionSurface::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    TriMesh::Load(source);

    source.Read(mXCenter);
    source.ReadEnum(mTopology);
    source.Read(mNumCurveSamples);
    source.Read(mNumRadialSamples);
    source.ReadVR(mNumRadialSamples + 1, mSin);
    source.ReadVR(mNumRadialSamples + 1, mCos);
    source.ReadBool(mSampleByArcLength);

    // TODO.  See note in RevolutionSurface::Save.
    mCurve = 0;

    WM5_END_DEBUG_STREAM_LOAD(RevolutionSurface, source);
}
Пример #8
0
//----------------------------------------------------------------------------
void Texture::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    Object::Load(source);

    source.ReadEnum(mFormat);
    source.ReadEnum(mType);
    source.ReadEnum(mUsage);
    source.Read(mNumLevels);
    source.Read(mNumDimensions);
    source.ReadVV(MM_MAX_MIPMAP_LEVELS, mDimension[0]);
    source.ReadVV(MM_MAX_MIPMAP_LEVELS, mDimension[1]);
    source.ReadVV(MM_MAX_MIPMAP_LEVELS, mDimension[2]);
    source.ReadVV(MM_MAX_MIPMAP_LEVELS, mNumLevelBytes);
    source.Read(mNumTotalBytes);
    source.ReadVV(MM_MAX_MIPMAP_LEVELS, mLevelOffsets);
    source.ReadVV(MAX_USER_FIELDS, mUserField);
    source.ReadVR(mNumTotalBytes, mData);

    WM5_END_DEBUG_STREAM_LOAD(Texture, source);
}
Пример #9
0
//----------------------------------------------------------------------------
void MorphController::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    Controller::Load(source);

    source.Read(mNumVertices);
    source.Read(mNumTargets);
    source.Read(mNumKeys);

    int numTotalVertices = mNumVertices*mNumTargets;
    mVertices = new2<APoint>(mNumVertices, mNumTargets);
    source.ReadAggregateVV(numTotalVertices, mVertices[0]);

    source.ReadVR(mNumKeys, mTimes);

    int numTotalWeights = mNumKeys*(mNumTargets - 1);
    mWeights = new2<float>(mNumTargets - 1, mNumKeys);
    source.ReadVV(numTotalWeights, mWeights[0]);

    WM5_END_DEBUG_STREAM_LOAD(MorphController, source);
}