示例#1
0
//----------------------------------------------------------------------------
void UIAnimPicBox::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	UIPicBox::Load(source);

	source.ReadPointer(mAPBCtrl);
	source.ReadString(mFrameTexPack);
	source.Read(mIntervalTime);

	int numAnim = 0;
	source.Read(numAnim);
	mElements.resize(numAnim);
	for (int i=0; i<numAnim; i++)
	{
		source.Read(mElements[i].Index);
		source.ReadAggregate(mElements[i].UV0);
		source.ReadAggregate(mElements[i].UV1);
		source.ReadAggregate(mElements[i].UV2);
		source.ReadAggregate(mElements[i].UV3);
		source.ReadPointer(mElements[i].Tex);
	}

	PX2_END_DEBUG_STREAM_LOAD(UIAnimPicBox, source);
}
示例#2
0
//----------------------------------------------------------------------------
void Jungler::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

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

	source.ReadEnum(mJunglerType);
	source.Read(mMaxNum);
	source.ReadPointer(mMtlInst);
	source.ReadPointer(mTexture);
	int num = 0;
	source.Read(num);
	if (num > 0)
	{
		mPoses.resize(num);
		mNormals.resize(num);
		mWidths.resize(num);
		mHeights.resize(num);

		source.ReadAggregateVV(num, &mPoses[0]);
		source.ReadAggregateVV(num, &mNormals[0]);
		source.ReadVV(num, &mWidths[0]);
		source.ReadVV(num, &mHeights[0]);
	}

	PX2_END_DEBUG_STREAM_LOAD(Jungler, source);
}
示例#3
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);
}
示例#4
0
//----------------------------------------------------------------------------
void CurveMesh::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Polysegment::Load(source);
	PX2_VERSION_LOAD(source);

	source.Read(mNumFullVertices);
	source.Read(mNumSegments);
	source.Read(mLevel);
	source.ReadBool(mAllowDynamicChange);
	source.ReadPointer(mOrigVBuffer);
	source.ReadPointer(mOrigParams);

	bool locked = (mOrigVBuffer == 0);
	if (!locked)
	{
		source.ReadPointerVR(mNumSegments, mSegments);
	}

	if (mAllowDynamicChange)
	{
		mCInfo = new1<CurveInfo>(mNumFullVertices);
		for (int i = 0; i < mNumFullVertices; ++i)
		{
			source.ReadPointer(mCInfo[i].Segment);
			source.Read(mCInfo[i].Param);
		}
	}

	PX2_END_DEBUG_STREAM_LOAD(CurveMesh, 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);
}
示例#6
0
//----------------------------------------------------------------------------
void RawTerrain::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Node::Load(source);

	source.ReadEnum(mMode);
	source.Read(mNumRows);
	source.Read(mNumCols);
	source.Read(mSize);
	source.Read(mMinElevation);
	source.Read(mMaxElevation);
	source.Read(mSpacing);
	source.Read(mCameraRow);
	source.Read(mCameraCol);
	source.ReadPointer(mVFormat);
	source.ReadPointer(mCamera);
	source.ReadPointer(mShine);

	mPages = new2<RawTerrainPagePtr>(mNumCols, mNumRows);
	for (int row = 0; row < mNumRows; ++row)
	{
		for (int col = 0; col < mNumCols; ++col)
		{
			source.ReadPointer(mPages[row][col]);
		}
	}

	PX2_END_DEBUG_STREAM_LOAD(RawTerrain, source);
}
示例#7
0
文件: loadertga.cpp 项目: skopp/rush
bool LoadTGA( InStream& is, ColorSurface& image )
{
    BYTE header[18];
    is.Read( header, 18 );

    if (header[1] != 0 || 
        (header[2] != 2 && header[2] != 3)) 
    {
        return false;
    }

    int width   = header[0 + 12] + header[1 + 12]*256; 
    int height  = header[2 + 12] + header[3 + 12]*256;
    int bitspp  = header[4 + 12]; 
    
    image.SetExt( width, height );

    int bytespp = 0;
    if (bitspp == 32) 
    {
        bytespp = 4;
    }
    else if (bitspp == 24) 
    {
        bytespp = 3;
    }
    else 
    {
        return false;
    }

    int nPix = width*height;
    int nBytes = nPix*bytespp;
    Buffer buf( nBytes );
    if (!is.Read( buf.GetData(), nBytes ))
    {
        return false;
    }
    const BYTE* pPix = buf.GetData();
    for (int j = height - 1; j >= 0; j--)
    {
        for (int i = 0; i < width; i++)
        {
            BYTE alpha = 255;
            if (bytespp == 4) 
            {
                alpha = pPix[3];
            }
            image.SetColor( i, j, ColorF( alpha, pPix[2], pPix[1], pPix[0] ) );
            pPix += bytespp;
        }
    }
    return true;
}
//----------------------------------------------------------------------------
void UISizeExtendControl::Load(InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Controller::Load(source);
	PX2_VERSION_LOAD(source);

	source.Read(mWidthOverHeightPercent);
	source.Read(mOriginHeight);

	PX2_END_DEBUG_STREAM_LOAD(Controller, source);
}
示例#9
0
//----------------------------------------------------------------------------
void Particles::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    TriMesh::Load(source);

    source.ReadRR(mNumParticles, mPositionSizes);
    source.Read(mSizeAdjust);
    source.Read(mNumActive);

    WM5_END_DEBUG_STREAM_LOAD(Particles, source);
}
//----------------------------------------------------------------------------
void GroupBuf::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Buf::Load(source);
	PX2_VERSION_LOAD(source);

	source.Read(mToGroupCharacterID);
	source.Read(mBeforeGroup);

	PX2_END_DEBUG_STREAM_LOAD(GroupBuf, source);
}
示例#11
0
//----------------------------------------------------------------------------
void ClodMesh::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

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

	source.Read(mCurrentRecord);
	source.Read(mTargetRecord);
	source.ReadPointer(mRecordArray);

	PX2_END_DEBUG_STREAM_LOAD(ClodMesh, source);
}
示例#12
0
//----------------------------------------------------------------------------
void OffsetProperty::Load (InStream& source)
{
    PX2_BEGIN_DEBUG_STREAM_LOAD(source);

    Object::Load(source);

    source.ReadBool(FillEnabled);
    source.ReadBool(LineEnabled);
    source.ReadBool(PointEnabled);
    source.Read(Scale);
    source.Read(Bias);

    PX2_END_DEBUG_STREAM_LOAD(OffsetProperty, source);
}
//----------------------------------------------------------------------------
void PushTransformController::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Controller::Load(source);
	PX2_VERSION_LOAD(source);

	source.ReadEnum(mTransType);
	source.Read(mMaxVelocity);
	source.Read(mFriction);
	source.ReadAggregate(mVelocity);

	PX2_END_DEBUG_STREAM_LOAD(PushTransformController, source);
}
示例#14
0
//----------------------------------------------------------------------------
void SurfacePatch::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    Object::Load(source);

    source.Read(mUMin);
    source.Read(mUMax);
    source.Read(mVMin);
    source.Read(mVMax);
    source.ReadBool(mRectangular);

    WM5_END_DEBUG_STREAM_LOAD(SurfacePatch, source);
}
示例#15
0
//----------------------------------------------------------------------------
void OffsetState::Load (InStream& source)
{
	WM5_BEGIN_DEBUG_STREAM_LOAD(source);

	Object::Load(source);

	source.ReadBool(FillEnabled);
	source.ReadBool(LineEnabled);
	source.ReadBool(PointEnabled);
	source.Read(Scale);
	source.Read(Bias);

	WM5_END_DEBUG_STREAM_LOAD(OffsetState, source);
}
示例#16
0
//----------------------------------------------------------------------------
void SimpleSegment::Load (InStream& source)
{
	WM5_BEGIN_DEBUG_STREAM_LOAD(source);

	CurveSegment::Load(source);

	source.Read(mAmplitude);
	source.Read(mFrequency);
	source.Read(mHeight);

	mAmplFreq = mAmplitude*mFrequency;
	mAmplFreqFreq = mAmplFreq*mFrequency;
	mAmplFreqFreqFreq = mAmplFreqFreq*mFrequency;

	WM5_END_DEBUG_STREAM_LOAD(SimpleSegment, source);
}
示例#17
0
//----------------------------------------------------------------------------
void Scene::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Netable::Load(source);

	source.Read<int>(mSceneID);

	source.ReadPointer(mSceneNode);

	int numActors;
	source.Read(numActors);
	if (numActors > 0)
	{
		mActors.resize(numActors);
		source.ReadPointerVV(numActors, &mActors[0]);
	}
	source.ReadPointer(mTerrainActor);

	source.ReadPointer(mDefaultLight);
	source.ReadPointer(mDefaultCameraActor);
	source.ReadPointer(mDefaultARActor);

	PX2_END_DEBUG_STREAM_LOAD(Scene, source);
}
//----------------------------------------------------------------------------
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);
}
示例#19
0
//----------------------------------------------------------------------------
void Controller::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);
	Object::Load(source);

	source.ReadEnum(Repeat);
	source.Read(MinTime);
	source.Read(MaxTime);
	source.Read(Phase);
	source.Read(Frequency);
	source.ReadBool(Active);
	source.ReadPointer(mObject);

	mApplicationTime = -Mathd::MAX_REAL;

	PX2_END_DEBUG_STREAM_LOAD(Controller, source);
}
示例#20
0
//----------------------------------------------------------------------------
void StencilState::Load (InStream& source)
{
	WM5_BEGIN_DEBUG_STREAM_LOAD(source);

	Object::Load(source);

	source.ReadBool(Enabled);
	source.ReadEnum(Compare);
	source.Read(Reference);
	source.Read(Mask);
	source.Read(WriteMask);
	source.ReadEnum(OnFail);
	source.ReadEnum(OnZFail);
	source.ReadEnum(OnZPass);

	WM5_END_DEBUG_STREAM_LOAD(StencilState, source);
}
示例#21
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);
}
示例#22
0
//----------------------------------------------------------------------------
void IndexBuffer::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Buffer::Load(source);

	source.Read(mOffset);

	PX2_END_DEBUG_STREAM_LOAD(IndexBuffer, source);
}
示例#23
0
//----------------------------------------------------------------------------
void Polypoint::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    Visual::Load(source);

    source.Read(mNumPoints);

    WM5_END_DEBUG_STREAM_LOAD(Polypoint, source);
}
示例#24
0
//----------------------------------------------------------------------------
void SkinController::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Controller::Load(source);

	source.Read(mNumVertices);
	source.Read(mNumBones);

	int numWeightsOffsets = mNumVertices*mNumBones;
	mWeights = new2<float>(mNumBones, mNumVertices);
	mOffsets = new2<APoint>(mNumBones, mNumVertices);
	source.ReadVV(numWeightsOffsets, mWeights[0]);
	source.ReadAggregateVV(numWeightsOffsets, mOffsets[0]);

	source.ReadPointerVR(mNumBones, mBones);

	PX2_END_DEBUG_STREAM_LOAD(SkinController, source);
}
示例#25
0
//----------------------------------------------------------------------------
void SwitchNode::Load (InStream& source)
{
	WM5_BEGIN_DEBUG_STREAM_LOAD(source);

	Node::Load(source);

	source.Read(mActiveChild);

	WM5_END_DEBUG_STREAM_LOAD(SwitchNode, source);
}
//----------------------------------------------------------------------------
void Polypoint::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Renderable::Load(source);
	PX2_VERSION_LOAD(source);

	source.Read(mNumPoints);

	PX2_END_DEBUG_STREAM_LOAD(Polypoint, source);
}
示例#27
0
//----------------------------------------------------------------------------
void CurveSegment::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    Object::Load(source);

    source.Read(mUMin);
    source.Read(mUMax);

    WM5_END_DEBUG_STREAM_LOAD(CurveSegment, source);
}
示例#28
0
//----------------------------------------------------------------------------
void RenderTarget::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	Object::Load(source);
	PX2_VERSION_LOAD(source);

	source.Read(mNumTargets);
	source.Read(mWidth);
	source.Read(mHeight);
	source.Read(mHasMipmaps);
	source.ReadBool(mHasDepthStencil);
	source.ReadBool(mIsOnlyDepth16NoStencil);

	source.ReadPointerVR(mNumTargets, mColorTextures);
	source.ReadPointer(mDepthStencilTexture);
	source.ReadBool(mHasMipmaps);

	PX2_END_DEBUG_STREAM_LOAD(RenderTarget, source);
}
示例#29
0
//----------------------------------------------------------------------------
void ParticleEvent_Alpha::Load (InStream& source)
{
	PX2_BEGIN_DEBUG_STREAM_LOAD(source);

	EffectEvent::Load(source);

	source.Read(mAlpha.Value0);
	source.Read(mAlpha.Value1);

	PX2_END_DEBUG_STREAM_LOAD(ParticleEvent_Alpha, source);
}
示例#30
0
//----------------------------------------------------------------------------
void Polysegment::Load (InStream& source)
{
    WM5_BEGIN_DEBUG_STREAM_LOAD(source);

    Visual::Load(source);

    source.Read(mNumSegments);
    source.ReadBool(mContiguous);

    WM5_END_DEBUG_STREAM_LOAD(Polysegment, source);
}