Add transparent ghost kart in STK
There is already define for soccer team too, so in the future, if anyone is smart to make a shader to draw red/blue karts, it should be easier. TODO: wheels and speed weight objects. (They seem need to be copied to work)
This commit is contained in:
parent
5ac25db7f8
commit
ccd6294699
@ -1013,7 +1013,8 @@ scene::IMesh *IrrDriver::getMesh(const std::string &filename)
|
||||
* \return Newly created skinned mesh. You should call drop() when you don't
|
||||
* need it anymore.
|
||||
*/
|
||||
scene::IAnimatedMesh *IrrDriver::copyAnimatedMesh(scene::IAnimatedMesh *orig)
|
||||
scene::IAnimatedMesh *IrrDriver::copyAnimatedMesh(scene::IAnimatedMesh *orig,
|
||||
video::E_CUSTOM_MATERIAL_TYPE cmt)
|
||||
{
|
||||
using namespace scene;
|
||||
CSkinnedMesh *mesh = dynamic_cast<CSkinnedMesh*>(orig);
|
||||
@ -1022,7 +1023,10 @@ scene::IAnimatedMesh *IrrDriver::copyAnimatedMesh(scene::IAnimatedMesh *orig)
|
||||
Log::error("copyAnimatedMesh", "Given mesh was not a skinned mesh.");
|
||||
return NULL;
|
||||
}
|
||||
return mesh->clone();
|
||||
|
||||
scene::IAnimatedMesh* out = mesh->clone();
|
||||
out->setCustomMaterialType(cmt);
|
||||
return out;
|
||||
} // copyAnimatedMesh
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -353,7 +353,8 @@ public:
|
||||
void setAllMaterialFlags(scene::IMesh *mesh) const;
|
||||
scene::IAnimatedMesh *getAnimatedMesh(const std::string &name);
|
||||
scene::IMesh *getMesh(const std::string &name);
|
||||
scene::IAnimatedMesh *copyAnimatedMesh(scene::IAnimatedMesh *orig);
|
||||
scene::IAnimatedMesh *copyAnimatedMesh(scene::IAnimatedMesh *orig,
|
||||
video::E_CUSTOM_MATERIAL_TYPE cmt);
|
||||
video::ITexture *applyMask(video::ITexture* texture,
|
||||
const std::string& mask_path);
|
||||
void displayFPS();
|
||||
|
@ -126,6 +126,10 @@ void STKAnimatedMesh::updateNoGL()
|
||||
TransparentMaterial TranspMat = getTransparentMaterialFromType(type, MaterialTypeParam, material);
|
||||
TransparentMesh[TranspMat].push_back(&mesh);
|
||||
}
|
||||
else if (m->getCustomMaterialType() == video::ECMT_TRANSPARENT)
|
||||
{
|
||||
TransparentMesh[TM_ADDITIVE].push_back(&mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Material::ShaderType MatType = material->getShaderType();// getMeshMaterialFromType(type, mb->getVertexType(), material);
|
||||
|
@ -173,7 +173,14 @@ void STKMeshSceneNode::updateNoGL()
|
||||
|
||||
GLMesh &mesh = GLmeshes[i];
|
||||
Material* material = material_manager->getMaterialFor(mb->getMaterial().getTexture(0), mb);
|
||||
if (rnd->isTransparent())
|
||||
if (Mesh->getCustomMaterialType() == video::ECMT_TRANSPARENT)
|
||||
{
|
||||
if (!immediate_draw)
|
||||
TransparentMesh[TM_ADDITIVE].push_back(&mesh);
|
||||
else
|
||||
additive = true;
|
||||
}
|
||||
else if (rnd->isTransparent())
|
||||
{
|
||||
TransparentMaterial TranspMat = getTransparentMaterialFromType(type, MaterialTypeParam, material);
|
||||
if (!immediate_draw)
|
||||
|
@ -35,7 +35,8 @@
|
||||
AbstractKart::AbstractKart(const std::string& ident,
|
||||
int world_kart_id, int position,
|
||||
const btTransform& init_transform,
|
||||
PerPlayerDifficulty difficulty)
|
||||
PerPlayerDifficulty difficulty,
|
||||
video::E_CUSTOM_MATERIAL_TYPE cmt)
|
||||
: Moveable()
|
||||
{
|
||||
m_world_kart_id = world_kart_id;
|
||||
@ -59,7 +60,7 @@ AbstractKart::AbstractKart(const std::string& ident,
|
||||
// released when the kart is deleted, but since the original
|
||||
// kart_model is stored in the kart_properties all the time,
|
||||
// there is no risk of a mesh being deleted to early.
|
||||
m_kart_model = m_kart_properties->getKartModelCopy();
|
||||
m_kart_model = m_kart_properties->getKartModelCopy(cmt);
|
||||
m_kart_width = m_kart_model->getWidth();
|
||||
m_kart_height = m_kart_model->getHeight();
|
||||
m_kart_length = m_kart_model->getLength();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#ifndef HEADER_ABSTRACT_KART_HPP
|
||||
#define HEADER_ABSTRACT_KART_HPP
|
||||
|
||||
#include <EMaterialTypes.h>
|
||||
#include <memory>
|
||||
|
||||
#include "items/powerup_manager.hpp"
|
||||
@ -98,7 +99,8 @@ public:
|
||||
AbstractKart(const std::string& ident,
|
||||
int world_kart_id,
|
||||
int position, const btTransform& init_transform,
|
||||
PerPlayerDifficulty difficulty);
|
||||
PerPlayerDifficulty difficulty,
|
||||
video::E_CUSTOM_MATERIAL_TYPE cmt);
|
||||
virtual ~AbstractKart();
|
||||
virtual core::stringw getName() const;
|
||||
virtual void reset();
|
||||
|
@ -28,7 +28,7 @@ GhostKart::GhostKart(const std::string& ident, unsigned int world_kart_id,
|
||||
int position)
|
||||
: Kart(ident, world_kart_id,
|
||||
position, btTransform(btQuaternion(0, 0, 0, 1)),
|
||||
PLAYER_DIFFICULTY_NORMAL)
|
||||
PLAYER_DIFFICULTY_NORMAL, video::ECMT_TRANSPARENT)
|
||||
{
|
||||
} // GhostKart
|
||||
|
||||
|
@ -92,9 +92,10 @@
|
||||
*/
|
||||
Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
int position, const btTransform& init_transform,
|
||||
PerPlayerDifficulty difficulty)
|
||||
PerPlayerDifficulty difficulty,
|
||||
video::E_CUSTOM_MATERIAL_TYPE cmt)
|
||||
: AbstractKart(ident, world_kart_id, position, init_transform,
|
||||
difficulty)
|
||||
difficulty, cmt)
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
|
||||
# pragma warning(1:4355)
|
||||
|
@ -231,7 +231,8 @@ private:
|
||||
public:
|
||||
Kart(const std::string& ident, unsigned int world_kart_id,
|
||||
int position, const btTransform& init_transform,
|
||||
PerPlayerDifficulty difficulty);
|
||||
PerPlayerDifficulty difficulty,
|
||||
video::E_CUSTOM_MATERIAL_TYPE cmt = video::ECMT_DEFAULT);
|
||||
virtual ~Kart();
|
||||
virtual void init(RaceManager::KartType type);
|
||||
virtual void kartIsInRestNow();
|
||||
|
@ -281,7 +281,7 @@ KartModel::~KartModel()
|
||||
* It is also marked not to be a master copy, so attachModel can be called
|
||||
* for this instance.
|
||||
*/
|
||||
KartModel* KartModel::makeCopy()
|
||||
KartModel* KartModel::makeCopy(video::E_CUSTOM_MATERIAL_TYPE cmt)
|
||||
{
|
||||
// Make sure that we are copying from a master objects, and
|
||||
// that there is indeed no animated node defined here ...
|
||||
@ -294,7 +294,7 @@ KartModel* KartModel::makeCopy()
|
||||
km->m_kart_height = m_kart_height;
|
||||
km->m_kart_highest_point= m_kart_highest_point;
|
||||
km->m_kart_lowest_point = m_kart_lowest_point;
|
||||
km->m_mesh = irr_driver->copyAnimatedMesh(m_mesh);
|
||||
km->m_mesh = irr_driver->copyAnimatedMesh(m_mesh, cmt);
|
||||
km->m_model_filename = m_model_filename;
|
||||
km->m_animation_speed = m_animation_speed;
|
||||
km->m_current_animation = AF_DEFAULT;
|
||||
|
@ -232,7 +232,7 @@ private:
|
||||
public:
|
||||
KartModel(bool is_master);
|
||||
~KartModel();
|
||||
KartModel* makeCopy();
|
||||
KartModel* makeCopy(video::E_CUSTOM_MATERIAL_TYPE cmt);
|
||||
void reset();
|
||||
void loadInfo(const XMLNode &node);
|
||||
bool loadModels(const KartProperties &kart_properties);
|
||||
|
@ -243,8 +243,9 @@ public:
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a pointer to the KartModel object. */
|
||||
KartModel* getKartModelCopy () const
|
||||
{return m_kart_model->makeCopy(); }
|
||||
KartModel* getKartModelCopy
|
||||
(video::E_CUSTOM_MATERIAL_TYPE cmt = video::ECMT_DEFAULT) const
|
||||
{return m_kart_model->makeCopy(cmt); }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a pointer to the main KartModel object. This copy
|
||||
|
@ -398,7 +398,8 @@ AbstractKart *SoccerWorld::createKart(const std::string &kart_ident, int index,
|
||||
m_kart_position_map[index] = (unsigned)(pos_index - 1);
|
||||
|
||||
AbstractKart *new_kart = new Kart(kart_ident, index, position, init_pos,
|
||||
difficulty);
|
||||
difficulty, team == SOCCER_TEAM_BLUE ?
|
||||
video::ECMT_BLUE : video::ECMT_RED);
|
||||
new_kart->init(race_manager->getKartType(index));
|
||||
Controller *controller = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user