Ejemplo n.º 1
0
hsGMaterial* hsGMaterial::Clone()
{
    hsGMaterial* clo = CloneNoLayers();

    clo->SetNumLayers(GetNumLayers());
    
    int i;
    for( i = 0; i < GetNumLayers(); i++ )
        clo->SetLayer(fLayers[i], i);

    return clo;
}
Ejemplo n.º 2
0
void hsGMaterial::Write(hsStream* s)
{
    s->WriteLE32(fLoadFlags);
    s->WriteLE32(fCompFlags);

    s->WriteLE32(GetNumLayers());
    s->WriteLE32(GetNumPiggyBacks());
}
Ejemplo n.º 3
0
void hsGMaterial::Reset()
{
    int i;
    for( i = 0; i < GetNumLayers(); i++ )
    {
        if( fLayers[i] )
            fLayers[i]->Eval(0, 0, 0);
    }
}
Ejemplo n.º 4
0
uint32_t hsGMaterial::AddLayerViaNotify(plLayerInterface* layer)
{
    int idx = GetNumLayers();

    // Add via notify so we'll dispose of it properly later.
    plMatRefMsg* msg = new plMatRefMsg(GetKey(), plRefMsg::kOnRequest, idx, plMatRefMsg::kLayer);
    hsgResMgr::ResMgr()->SendRef(layer->GetKey(), msg, plRefFlags::kActiveRef);

    fLayers.SetCount(idx+1);
    fLayers[idx] = layer;

    return idx;
}
Ejemplo n.º 5
0
void hsGMaterial::Write(hsStream *stream, hsResMgr *group)
{
    plSynchedObject::Write(stream, group);

    Write(stream);

    // Write one (or many) texture indices
    int iLay;
    for( iLay = 0; iLay < GetNumLayers(); iLay++ )
    {
        group->WriteKey(stream,GetLayer(iLay));
    }
    for( iLay = 0; iLay < GetNumPiggyBacks(); iLay++ )
    {
        group->WriteKey(stream, GetPiggyBack(iLay));
    }
}
Ejemplo n.º 6
0
void hsGMaterial::Eval(double secs, uint32_t frame)
{
    plProfile_BeginLap(MaterialAnims, GetKeyName().c_str());

    int i;
    for( i = 0; i < GetNumLayers(); i++ )
    {
        if( fLayers[i] )
            fLayers[i]->Eval(secs, frame, 0);
    }
    for( i = 0; i < GetNumPiggyBacks(); i++ )
    {
        if( fPiggyBacks[i] )
            fPiggyBacks[i]->Eval(secs, frame, 0);
    }

    plProfile_EndLap(MaterialAnims, GetKeyName().c_str());
}
Ejemplo n.º 7
0
void hsGMaterial::Read(hsStream *stream, hsResMgr *group)
{
    plSynchedObject::Read(stream, group);

    Read(stream);

    int iLay;    
    // Assign texture(s)
    for (iLay = 0; iLay < GetNumLayers(); iLay++)
    {
        plMatRefMsg* msg = new plMatRefMsg(GetKey(), plRefMsg::kOnCreate, iLay, plMatRefMsg::kLayer);
        plKey key = group->ReadKeyNotifyMe(stream, msg, plRefFlags::kActiveRef);
    }
    for (iLay = 0; iLay < GetNumPiggyBacks(); iLay++)
    {
        plMatRefMsg* msg = new plMatRefMsg(GetKey(), plRefMsg::kOnCreate, iLay, plMatRefMsg::kPiggyBack);
        plKey key = group->ReadKeyNotifyMe(stream, msg, plRefFlags::kActiveRef);
    }
}
Ejemplo n.º 8
0
uint32_t hsGMaterial::IMakeExtraLayer()
{
    fLayers.ExpandAndZero(GetNumLayers()+1);
    return fLayers.GetCount();
}
Ejemplo n.º 9
0
	void SpriteMap::ClearLayers() {
		for (Int i = GetNumLayers() - 1; i >= 0; i--)
			RemoveLayer(i);
	}
Ejemplo n.º 10
0
bool STileLayerList::CanExecuteActionNeedingLayerBelow() const
{
	const int32 SelectedLayer = GetSelectionIndex();
	return (SelectedLayer != INDEX_NONE) && (SelectedLayer + 1 < GetNumLayers());
}