Reduced number of parameters for Shadow.
This commit is contained in:
parent
dc68f5f122
commit
91c40e27c2
@ -18,23 +18,27 @@
|
||||
|
||||
#include "graphics/shadow.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
|
||||
#include <IMesh.h>
|
||||
#include <IMeshSceneNode.h>
|
||||
#include <ISceneNode.h>
|
||||
|
||||
Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
||||
float scale = 1.0, float x_offset = 0.0, float y_offset = 0.0,
|
||||
float z_offset = 0.0)
|
||||
Shadow::Shadow(const KartProperties *kart_properties,
|
||||
scene::ISceneNode *node,
|
||||
float y_offset = 0.0)
|
||||
{
|
||||
video::SMaterial m;
|
||||
m.setTexture(0, texture);
|
||||
m.setTexture(0, kart_properties->getShadowTexture());
|
||||
m.BackfaceCulling = false;
|
||||
m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
m.setFlag(video::EMF_ZWRITE_ENABLE , false);
|
||||
m_mesh = irr_driver->createQuadMesh(&m, /*create_one_quad*/true);
|
||||
scene::IMeshBuffer *buffer = m_mesh->getMeshBuffer(0);
|
||||
irr::video::S3DVertex* v=(video::S3DVertex*)buffer->getVertices();
|
||||
float scale = kart_properties->getShadowScale();
|
||||
float x_offset = kart_properties->getShadowXOffset();
|
||||
float z_offset = kart_properties->getShadowXOffset();
|
||||
v[0].Pos.X = -scale+x_offset; v[0].Pos.Z = scale+z_offset; v[0].Pos.Y = 0.01f-y_offset;
|
||||
v[1].Pos.X = scale+x_offset; v[1].Pos.Z = scale+z_offset; v[1].Pos.Y = 0.01f-y_offset;
|
||||
v[2].Pos.X = scale+x_offset; v[2].Pos.Z = -scale+z_offset; v[2].Pos.Y = 0.01f-y_offset;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "utils/no_copy.hpp"
|
||||
|
||||
#include <string>
|
||||
class KartProperties;
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -46,8 +46,8 @@ private:
|
||||
/** The scene node of the kart to which this shadow belongs. */
|
||||
scene::ISceneNode *m_parent_kart_node;
|
||||
public:
|
||||
Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
||||
float scale, float x_offset, float y_offset,float z_offset);
|
||||
Shadow(const KartProperties *kart_properties,
|
||||
scene::ISceneNode *node, float y_offset);
|
||||
~Shadow();
|
||||
void enableShadow();
|
||||
void disableShadow();
|
||||
|
@ -2424,12 +2424,8 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
|
||||
|
||||
if (!CVS->supportsShadows())
|
||||
{
|
||||
m_shadow = new Shadow(m_kart_properties->getShadowTexture(),
|
||||
m_node,
|
||||
m_kart_properties->getShadowScale(),
|
||||
m_kart_properties->getShadowXOffset(),
|
||||
-m_kart_model->getLowestPoint(),
|
||||
m_kart_properties->getShadowZOffset());
|
||||
m_shadow = new Shadow(m_kart_properties, m_node,
|
||||
-m_kart_model->getLowestPoint());
|
||||
}
|
||||
World::getWorld()->kartAdded(this, m_node);
|
||||
} // loadData
|
||||
|
Loading…
Reference in New Issue
Block a user