Esempio n. 1
0
	void Scene::load(stream::InputStream<stream::SerializationEndian> &strm)
	{
		PROFILE;
		int engineMajor, engineMinor, enginePatch;

		strm.read(engineMajor);
		strm.read(engineMinor);
		strm.read(enginePatch);

		if (engineMajor != ENGINE_VERSION_MAJOR || engineMinor != ENGINE_VERSION_MINOR || enginePatch != ENGINE_VERSION_PATCH)
		{
			LOG_ERROR("Invalid version number on scene file, aborting load. Engine: " << ENGINE_VERSION_MAJOR << "." << ENGINE_VERSION_MINOR << "." << ENGINE_VERSION_PATCH << " File: " << engineMajor << "." << engineMinor << "." << enginePatch);
			return;
		}

		//Loading happens in two steps.
		//a) build the scene data as it is in the stream
		//b) Refresh Handle pointers
		//c) Refresh resources

		unsigned entityCount;

		strm.read(entityCount);

		for (unsigned i = 0; i < entityCount; ++i)
		{
			Entity *ent = rtti::dynamicCast<Entity>(rtti::RTTI::generateSerializable("Entity", getContextData()));

			ent->load(strm);

			entities.push_back(ent);
		}
	}
Esempio n. 2
0
        size_t refill(const Stream::InputStream & is, size_t readPossible)
        {
            if (!canFit(readPossible))
                readPossible = total - available();
            if (readPossible <= 0) return 0;

            // Move the data that was consumed out of buffer
            if (consumed)
            {
                memmove((uint8*)buffer, &((uint8*)buffer)[consumed], fill - consumed);
                fill -= consumed;
            }
            consumed = 0;

            uint64 ret = is.read(&((uint8*)buffer)[fill], readPossible);
            if (ret != (uint64)-1) fill += (size_t)ret;
            return (size_t)ret;
        }
Esempio n. 3
0
	void Handle::load(stream::InputStream<stream::SerializationEndian> &strm)
	{
		strm.read(id);
		ptr = manager->getHandle(id);
	}