Exemple #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);
		}
	}
}
Exemple #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);

}
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);
}
Exemple #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.
  }
}
Exemple #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);
}
Exemple #9
0
void Framebuffer::resetAttachment(GLenum binding)
{
    setAttachment(GL_NONE, binding, ImageIndex::MakeInvalid(), nullptr);
}
void Framebuffer::setNULLAttachment(GLenum attachment)
{
    setAttachment(attachment, NULL);
}
Exemple #11
0
 bool RenderTargetFBO::setAttachment( AttachmentTarget target, const TextureRectangleSharedPtr &texture, StereoTarget stereoTarget )
 {
   return setAttachment( target, AttachmentTexture::create( texture ).inplaceCast<Attachment>(), stereoTarget );
 }
void Framebuffer::setTextureAttachment(GLenum attachment, Texture *texture, const ImageIndex &imageIndex)
{
    setAttachment(attachment, new TextureAttachment(attachment, texture, imageIndex));
}
Exemple #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);
}
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);
}
Exemple #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 );
 }