mirror of https://github.com/axmolengine/axmol.git
rename BillBoard Model
This commit is contained in:
parent
58f4e84b9a
commit
4e65d070a1
|
@ -33,7 +33,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
BillBorad::BillBorad()
|
BillBorad::BillBorad()
|
||||||
: _zDepthInView(0.0f)
|
: _zDepthInView(0.0f)
|
||||||
, _mode(Mode::View_Oriented)
|
, _mode(Mode::View_Point_Oriented)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ void BillBorad::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
Vec3 camDir;
|
Vec3 camDir;
|
||||||
switch (_mode)
|
switch (_mode)
|
||||||
{
|
{
|
||||||
case Mode::View_Oriented:
|
case Mode::View_Point_Oriented:
|
||||||
camDir = Vec3(transform.m[12] - camWorldMat.m[12], transform.m[13] - camWorldMat.m[13], transform.m[14] - camWorldMat.m[14]);
|
camDir = Vec3(transform.m[12] - camWorldMat.m[12], transform.m[13] - camWorldMat.m[13], transform.m[14] - camWorldMat.m[14]);
|
||||||
break;
|
break;
|
||||||
case Mode::View_Plane_Oriented:
|
case Mode::View_Plane_Oriented:
|
||||||
|
@ -144,8 +144,8 @@ void BillBorad::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
|
|
||||||
//FIXME: frustum culling here
|
//FIXME: frustum culling here
|
||||||
{
|
{
|
||||||
_quadCommand.init(_zDepthInView, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, _billboardTransform);
|
_quadCommand.init(_zDepthInView, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, _billboardTransform);
|
||||||
renderer->addTransparentCommand(&_quadCommand);
|
renderer->addTransparentCommand(&_quadCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
|
|
||||||
enum class Mode
|
enum class Mode
|
||||||
{
|
{
|
||||||
View_Oriented,
|
View_Point_Oriented,
|
||||||
View_Plane_Oriented
|
View_Plane_Oriented
|
||||||
};
|
};
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -49,7 +49,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return An autoreleased BillBorad object.
|
* @return An autoreleased BillBorad object.
|
||||||
*/
|
*/
|
||||||
static BillBorad* create(Mode mode = Mode::View_Oriented);
|
static BillBorad* create(Mode mode = Mode::View_Point_Oriented);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a BillBorad with an image filename.
|
* Creates a BillBorad with an image filename.
|
||||||
|
@ -60,7 +60,7 @@ public:
|
||||||
* @param filename A path to image file, e.g., "scene1/monster.png"
|
* @param filename A path to image file, e.g., "scene1/monster.png"
|
||||||
* @return An autoreleased BillBorad object.
|
* @return An autoreleased BillBorad object.
|
||||||
*/
|
*/
|
||||||
static BillBorad* create(const std::string& filename, Mode mode = Mode::View_Oriented);
|
static BillBorad* create(const std::string& filename, Mode mode = Mode::View_Point_Oriented);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a BillBorad with an image filename and a rect.
|
* Creates a BillBorad with an image filename and a rect.
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
* @param rect A subrect of the image file
|
* @param rect A subrect of the image file
|
||||||
* @return An autoreleased BillBorad object
|
* @return An autoreleased BillBorad object
|
||||||
*/
|
*/
|
||||||
static BillBorad* create(const std::string& filename, const Rect& rect, Mode mode = Mode::View_Oriented);
|
static BillBorad* create(const std::string& filename, const Rect& rect, Mode mode = Mode::View_Point_Oriented);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a BillBorad with a Texture2D object.
|
* Creates a BillBorad with a Texture2D object.
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
* @param texture A pointer to a Texture2D object.
|
* @param texture A pointer to a Texture2D object.
|
||||||
* @return An autoreleased BillBorad object
|
* @return An autoreleased BillBorad object
|
||||||
*/
|
*/
|
||||||
static BillBorad* createWithTexture(Texture2D *texture, Mode mode = Mode::View_Oriented);
|
static BillBorad* createWithTexture(Texture2D *texture, Mode mode = Mode::View_Point_Oriented);
|
||||||
|
|
||||||
/** Set the billboard rotation mode. */
|
/** Set the billboard rotation mode. */
|
||||||
void setMode(Mode mode);
|
void setMode(Mode mode);
|
||||||
|
|
Loading…
Reference in New Issue