FPInterfaceDesc* ParticleChannelInt::GetDescByID(Interface_ID id) { if (id == PARTICLECHANNEL_INTERFACE) return &pc_Int_channel; if (id == PARTICLECHANNELAMOUNTR_INTERFACE) return &pc_Int_AmountR; if (id == PARTICLECHANNELAMOUNTW_INTERFACE) return &pc_Int_AmountW; if (id == GetReadID()) return &pc_Int_IntR; if (id == GetWriteID()) return &pc_Int_IntW; return NULL; }
BaseInterface* ParticleChannelInt::GetInterface(Interface_ID id) { if (id == PARTICLECHANNEL_INTERFACE) return (IParticleChannel*)this; if (id == PARTICLECHANNELAMOUNTR_INTERFACE) return (IParticleChannelAmountR*)this; if (id == PARTICLECHANNELAMOUNTW_INTERFACE) return (IParticleChannelAmountW*)this; if (id == GetReadID()) return (IParticleChannelIntR*)this; if (id == GetWriteID()) return (IParticleChannelIntW*)this; return IObject::GetInterface(id); }
IOResult ParticleChannelMap::Save(ISave* isave) const { IOResult res; ULONG nb; // UVVertChannel if (chanUVVert() != NULL) { isave->BeginChunk(kChunkUVVertChannel); if ((res = chanUVVert()->Save(isave)) != IO_OK) return res; isave->EndChunk(); } // TVFaceChannel if (chanTVFace() != NULL) { isave->BeginChunk(kChunkTVFaceChannel); if ((res = chanTVFace()->Save(isave)) != IO_OK) return res; isave->EndChunk(); } // interface id Interface_ID id; isave->BeginChunk(IParticleChannel::kChunkReadID); id = GetReadID(); if ((res = isave->Write(&id, sizeof(Interface_ID), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkWriteID); id = GetWriteID(); if ((res = isave->Write(&id, sizeof(Interface_ID), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkTransferable); bool isTransferable = IsTransferable(); if ((res = isave->Write(&isTransferable, sizeof(bool), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkPrivate); bool isPrivate = IsPrivateChannel(); if ((res = isave->Write(&isPrivate, sizeof(bool), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkActionHandle); ULONG handle = m_creatorHandle; if ((res = isave->Write(&handle, sizeof(ULONG), &nb)) != IO_OK) return res; isave->EndChunk(); return IO_OK; }
BaseInterface* ParticleChannelMap::GetInterface(Interface_ID id) { if (id == PARTICLECHANNEL_INTERFACE) return (IParticleChannel*)this; if (id == PARTICLECHANNELAMOUNTR_INTERFACE) return (IParticleChannelAmountR*)this; if (id == PARTICLECHANNELAMOUNTW_INTERFACE) return (IParticleChannelAmountW*)this; if (id == GetReadID()) return (IParticleChannelMapR*)this; if (id == GetWriteID()) return (IParticleChannelMapW*)this; if ((id == PARTICLECHANNELTABUVVERTR_INTERFACE) || (id == PARTICLECHANNELTABUVVERTW_INTERFACE)) if (chanUVVert()) return _chanUVVert()->GetInterface(id); if ((id == PARTICLECHANNELTABTVFACER_INTERFACE) || (id == PARTICLECHANNELTABTVFACEW_INTERFACE)) if (chanTVFace()) return _chanTVFace()->GetInterface(id); return IObject::GetInterface(id); }
IOResult ParticleChannelInt::Save(ISave* isave) const { ULONG nb; IOResult res; int num; isave->BeginChunk(IParticleChannel::kChunkCount); num = data().Count(); if ((res = isave->Write(&num, sizeof(int), &nb)) != IO_OK) return res; isave->EndChunk(); if (num > 0) { isave->BeginChunk(IParticleChannel::kChunkData); if ((res = isave->Write(data().Addr(0), sizeof(int)*num, &nb)) != IO_OK) return res; isave->EndChunk(); } isave->BeginChunk(IParticleChannel::kChunkGlobalCount); num = globalCount(); if ((res = isave->Write(&num, sizeof(int), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkGlobalValue); int v = globalValue(); if ((res = isave->Write(&v, sizeof(int), &nb)) != IO_OK) return res; isave->EndChunk(); Interface_ID id; isave->BeginChunk(IParticleChannel::kChunkReadID); id = GetReadID(); if ((res = isave->Write(&id, sizeof(Interface_ID), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkWriteID); id = GetWriteID(); if ((res = isave->Write(&id, sizeof(Interface_ID), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkTransferable); bool isTransferable = IsTransferable(); if ((res = isave->Write(&isTransferable, sizeof(bool), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkPrivate); bool isPrivate = IsPrivateChannel(); if ((res = isave->Write(&isPrivate, sizeof(bool), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkActionHandle); ULONG handle = m_creatorHandle; if ((res = isave->Write(&handle, sizeof(ULONG), &nb)) != IO_OK) return res; isave->EndChunk(); isave->BeginChunk(IParticleChannel::kChunkValue1); bool isg = isGlobal(); if ((res = isave->Write(&isg, sizeof(bool), &nb)) != IO_OK) return res; isave->EndChunk(); return IO_OK; }