Ejemplo n.º 1
0
	void PointLightComponent::_copyFrom(const ComponentBase *model)
	{
		auto o = static_cast<const PointLightComponent*>(model);
		range = o->range;
		color = o->color;
		postUnserialization();
	}
	ComponentBase *ComponentRegistrationManager::loadJson(std::size_t componentHashId, Entity &e, cereal::JSONInputArchive &ar)
	{
		AGE_ASSERT(_typeIds.find(componentHashId) != std::end(_typeIds) && "Component type has not been registered. Use REGISTER_COMPONENT_TYPE");
		auto id = _typeIds[componentHashId];

		auto voidCpt = e->getScene()->allocateComponent(id);

		auto find = _jsonLoadMap.find(id);
		AGE_ASSERT(find != std::end(_jsonLoadMap));
		find->second(voidCpt, ar, e);

		auto cpt = (AGE::ComponentBase*)voidCpt;

		cpt->_typeId = id;
		cpt->entity = e;
		cpt->postUnserialization();

		e->addComponentPtr(cpt);
		return cpt;
	}
Ejemplo n.º 3
0
	PointLightComponent::PointLightComponent(PointLightComponent const &o)
		: color(o.color),
		range(o.range)
	{
		postUnserialization();
	}
Ejemplo n.º 4
0
	void DirectionalLightComponent::_copyFrom(const ComponentBase *model)
	{
		auto o = static_cast<const DirectionalLightComponent*>(model);
		_data.color = o->_data.color;
		postUnserialization();
	}