Exemplo n.º 1
0
void EmberEntity::updateAttachment()
{
	//Get the new location. We use getEmberLocation() since we always know that all entities are of type EmberEntity.
	EmberEntity* newLocationEntity = getEmberLocation();

	if (newLocationEntity && newLocationEntity->getAttachment()) {
		try {
			IEntityAttachment* newAttachment = newLocationEntity->getAttachment()->attachEntity(*this);
			setAttachment(newAttachment);
			if (newAttachment) {
				newAttachment->updateScale();
			}
		} catch (const std::exception& ex) {
			S_LOG_WARNING("Problem when creating new attachment for entity." << ex);
		}
		//If we're the top level entity the attachment has been set from the outside and shouldn't be changed.
		//FIXME This is a little hackish; how can we improve it to not require special cases?
	} else if (m_view->getTopLevel() == this) {
		return;
	} else {
		try {
			setAttachment(nullptr);
		} catch (const std::exception& ex) {
			S_LOG_WARNING("Problem when setting attachment for entity." << ex);
		}
	}
}
Exemplo n.º 2
0
void EmberEntity::onLocationChanged(Eris::Entity *oldLocation)
{
  //Get the new location. We use getEmberLocation() since we always know that all entities are of type EmberEntity.
  EmberEntity* newLocationEntity = getEmberLocation();

  if (newLocationEntity && newLocationEntity->getAttachment()) {
    try {
      IEntityAttachment* newAttachment = newLocationEntity->getAttachment()->attachEntity(*this);
      setAttachment(newAttachment);
      if (newAttachment) {
        newAttachment->updateScale();
      }
    } catch (const std::exception& ex) {
      S_LOG_WARNING("Problem when creating new attachment for entity." << ex);
    }
  } else {
    try {
      setAttachment(0);
    } catch (const std::exception& ex) {
      S_LOG_WARNING("Problem when setting attachment for entity." << ex);
    }
  }

  Eris::Entity::onLocationChanged(oldLocation);

}
Exemplo n.º 3
0
void UnitSAO::clearParentAttachment()
{
	ServerActiveObject *parent = nullptr;
	if (m_attachment_parent_id) {
		parent = m_env->getActiveObject(m_attachment_parent_id);
		setAttachment(0, "", m_attachment_position, m_attachment_rotation);
	} else {
		setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0));
	}
	// Do it
	if (parent)
		parent->removeAttachmentChild(m_id);
}
Exemplo n.º 4
0
void EmberEntity::setGraphicalRepresentation(IGraphicalRepresentation* graphicalRepresentation)
{
  if (graphicalRepresentation != mGraphicalRepresentation) {
    //We must delete the attachment before we delete the graphical representation.
    setAttachment(0);
    delete mGraphicalRepresentation;
    mGraphicalRepresentation = graphicalRepresentation;
    onLocationChanged(getLocation()); //This is needed to generate a new attachment.
  }
}
Exemplo n.º 5
0
void EmberEntity::setGraphicalRepresentation(IGraphicalRepresentation* graphicalRepresentation)
{
	if (graphicalRepresentation != mGraphicalRepresentation) {
		//If we're the top level entity the attachment has been set from the outside and shouldn't be changed.
		//FIXME This is a little hackish; how can we improve it to not require special cases?
		if (m_view->getTopLevel() != this) {
			//We must delete the attachment before we delete the graphical representation.
			setAttachment(nullptr);
		}
		delete mGraphicalRepresentation;
		mGraphicalRepresentation = graphicalRepresentation;
		updateAttachment();
		EventChangedGraphicalRepresentation();
	}
}
Texture3DRenderableDynamic::Texture3DRenderableDynamic(
		Texture2DFile& filePosX,
		Texture2DFile& fileNegX,
		Texture2DFile& filePosY,
		Texture2DFile& fileNegY,
		Texture2DFile& filePosZ,
		Texture2DFile& fileNegZ,
		ParameterList& parameters,
		pTexture2DRenderable texture2D,
		pProgram program)
		:
				Texture3DRenderable(filePosX, fileNegX, filePosY, fileNegY,
						filePosZ, fileNegZ, texture2D, parameters),
				mProgram(program),
				mTimePassed(0.0f) {
	setAttachment(GL_COLOR_ATTACHMENT0);
}
void luaSetRightWeapon(int id)
{
    static const char *weps[] = { "vwep/pistol", "vwep/shotg", "vwep/chaing", "vwep/rocket", "vwep/rifle", "vwep/gl", NULL };

    setAttachment(id, weps, WEAPON_TAG);
}
void luaSetArmor(int id)
{
    static const char *armors[] = { "mrfixit/armor/blue", "mrfixit/armor/green", "mrfixit/armor/yellow", NULL };

    setAttachment(id, armors, ARMOR_TAG);
}
Exemplo n.º 9
0
void Framebuffer::resetAttachment(GLenum binding)
{
    setAttachment(GL_NONE, binding, ImageIndex::MakeInvalid(), nullptr);
}
Exemplo n.º 10
0
void Framebuffer::setNULLAttachment(GLenum attachment)
{
    setAttachment(attachment, NULL);
}
Exemplo n.º 11
0
 bool RenderTargetFBO::setAttachment( AttachmentTarget target, const TextureRectangleSharedPtr &texture, StereoTarget stereoTarget )
 {
   return setAttachment( target, AttachmentTexture::create( texture ).inplaceCast<Attachment>(), stereoTarget );
 }
Exemplo n.º 12
0
void Framebuffer::setTextureAttachment(GLenum attachment, Texture *texture, const ImageIndex &imageIndex)
{
    setAttachment(attachment, new TextureAttachment(attachment, texture, imageIndex));
}
Exemplo n.º 13
0
 bool RenderTargetFBO::setAttachment( AttachmentTarget target, const RenderbufferSharedPtr &buffer, StereoTarget stereoTarget )
 {
   return setAttachment( target, AttachmentRenderbuffer::create( buffer ).inplaceCast<Attachment>(), stereoTarget );
 }
void luaSetLeftWeapon(int id)
{
    static const char *shields[] = { "vwep/fist", NULL };

    setAttachment(id, shields, LEFTWEAPON_TAG);
}
Exemplo n.º 15
0
void Framebuffer::setRenderbufferAttachment(GLenum attachment, Renderbuffer *renderbuffer)
{
    setAttachment(attachment, new RenderbufferAttachment(attachment, renderbuffer));
}
void luaSetRightWeaponSparkle(int id)
{
    static const char *weps[] = { "particle/sparkly", NULL };

    setAttachment(id, weps, WEAPON_PARTICLE_TAG);
}
Exemplo n.º 17
0
 bool RenderTargetFBO::setAttachment( AttachmentTarget target, const TextureCubemapSharedPtr &texture, StereoTarget stereoTarget, int face, int level )
 {
   return setAttachment( target, AttachmentTexture::create( texture, face, level ).inplaceCast<Attachment>(), stereoTarget );
 }