Fix spelling: billborad -> billboard (#17560)

This commit is contained in:
mogemimi 2017-03-22 10:21:34 +09:00 committed by minggo
parent b0179340be
commit f90691eb63
4 changed files with 78 additions and 78 deletions

View File

@ -119,13 +119,13 @@ BillBoardTest::BillBoardTest()
auto layer3D=Layer::create();
addChild(layer3D,0);
_layerBillBorad=layer3D;
_layerBillBoard = layer3D;
auto s = Director::getInstance()->getWinSize();
if (_camera == nullptr)
{
_camera=Camera::createPerspective(60, (GLfloat)s.width/s.height, 1, 500);
_camera->setCameraFlag(CameraFlag::USER1);
_layerBillBorad->addChild(_camera);
_layerBillBoard->addChild(_camera);
}
//Create rotating billboards
@ -139,7 +139,7 @@ BillBoardTest::BillBoardTest()
billboard->setOpacity(CCRANDOM_0_1() * 128 + 128);
_billboards.push_back(billboard);
layer->addChild(billboard);
_layerBillBorad->addChild(layer);
_layerBillBoard->addChild(layer);
layer->runAction( RepeatForever::create( RotateBy::create( CCRANDOM_0_1() * 10, Vec3(0.0f, 45.0f, 0.0f) ) ) );
}
@ -158,20 +158,20 @@ BillBoardTest::BillBoardTest()
sprite3d->setScale(2.0f);
sprite3d->addChild(billboard);
sprite3d->runAction( RepeatForever::create( RotateBy::create( 10.0f, Vec3(0.0f, 360.0f, 0.0f) ) ) );
_layerBillBorad->addChild(sprite3d);
_layerBillBoard->addChild(sprite3d);
}
addNewBillBoradWithCoords(Vec3(20,5,0));
addNewBillBoradWithCoords(Vec3(60,5,0));
addNewBillBoradWithCoords(Vec3(100,5,0));
addNewBillBoradWithCoords(Vec3(140,5,0));
addNewBillBoradWithCoords(Vec3(180,5,0));
addNewBillBoardWithCoords(Vec3(20,5,0));
addNewBillBoardWithCoords(Vec3(60,5,0));
addNewBillBoardWithCoords(Vec3(100,5,0));
addNewBillBoardWithCoords(Vec3(140,5,0));
addNewBillBoardWithCoords(Vec3(180,5,0));
addNewAniBillBoradWithCoords(Vec3(-20,0,0));
addNewAniBillBoradWithCoords(Vec3(-60,0,0));
addNewAniBillBoradWithCoords(Vec3(-100,0,0));
addNewAniBillBoradWithCoords(Vec3(-140,0,0));
addNewAniBillBoradWithCoords(Vec3(-180,0,0));
addNewAniBillBoardWithCoords(Vec3(-20,0,0));
addNewAniBillBoardWithCoords(Vec3(-60,0,0));
addNewAniBillBoardWithCoords(Vec3(-100,0,0));
addNewAniBillBoardWithCoords(Vec3(-140,0,0));
addNewAniBillBoardWithCoords(Vec3(-180,0,0));
_camera->setPosition3D(Vec3(0, 100, 230));
_camera->lookAt(Vec3(0,0,0), Vec3(0,1,0));
@ -186,7 +186,7 @@ BillBoardTest::BillBoardTest()
menuItem1->setPosition( Vec2( s.width-80, VisibleRect::top().y-160) );
menuItem2->setPosition( Vec2( s.width-80, VisibleRect::top().y-190) );
addChild(menu, 0);
_layerBillBorad->setCameraMask(2);
_layerBillBoard->setCameraMask(2);
label1 = Label::createWithTTF(ttfConfig,"Point Oriented");
menuItem1 = MenuItemLabel::create(label1,CC_CALLBACK_1(BillBoardTest::menuCallback_orientedPoint,this) );
@ -232,28 +232,28 @@ std::string BillBoardTest::subtitle() const
{
return "";
}
void BillBoardTest::addNewBillBoradWithCoords(Vec3 p)
void BillBoardTest::addNewBillBoardWithCoords(Vec3 p)
{
std::string imgs[3] = {"Images/Icon.png", "Images/r2.png"};
for (unsigned int i = 0; i < 10; ++i)
{
auto billborad = BillBoard::create(imgs[(unsigned int)(CCRANDOM_0_1() * 1 + 0.5)]);
billborad->setScale(0.5f);
billborad->setPosition3D(Vec3(p.x, p.y, -150.0f + 30 * i));
billborad->setOpacity(CCRANDOM_0_1() * 128 + 128);
auto billboard = BillBoard::create(imgs[(unsigned int)(CCRANDOM_0_1() * 1 + 0.5)]);
billboard->setScale(0.5f);
billboard->setPosition3D(Vec3(p.x, p.y, -150.0f + 30 * i));
billboard->setOpacity(CCRANDOM_0_1() * 128 + 128);
_layerBillBorad->addChild(billborad);
_billboards.push_back(billborad);
_layerBillBoard->addChild(billboard);
_billboards.push_back(billboard);
}
}
void BillBoardTest::addNewAniBillBoradWithCoords(Vec3 p)
void BillBoardTest::addNewAniBillBoardWithCoords(Vec3 p)
{
for (unsigned int i = 0; i < 10; ++i)
{
auto billboardAni = BillBoard::create("Images/grossini.png");
billboardAni->setScale(0.5f);
billboardAni->setPosition3D(Vec3(p.x, p.y, -150.0f + 30 * i));
_layerBillBorad->addChild(billboardAni);
_layerBillBoard->addChild(billboardAni);
auto animation = Animation::create();
for( int i=1;i<15;i++)

View File

@ -54,8 +54,8 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void update(float dt) override;
void addNewBillBoradWithCoords(cocos2d::Vec3 p);
void addNewAniBillBoradWithCoords(cocos2d::Vec3 p);
void addNewBillBoardWithCoords(cocos2d::Vec3 p);
void addNewAniBillBoardWithCoords(cocos2d::Vec3 p);
void rotateCameraCallback(cocos2d::Ref* sender,float value);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
@ -64,7 +64,7 @@ public:
protected:
cocos2d::Camera* _camera;
cocos2d::Layer* _layerBillBorad;
cocos2d::Layer* _layerBillBoard;
std::vector<cocos2d::BillBoard*> _billboards;
};

View File

@ -160,7 +160,7 @@ var BillBoardTest = BillBoardTestDemo.extend({
_title:"BillBoard Test",
_subtitle:"",
_camera:null,
_layerBillBorad:null,
_layerBillBoard:null,
_billboards:[],
ctor:function(){
@ -174,13 +174,13 @@ var BillBoardTest = BillBoardTestDemo.extend({
var layer3D = new cc.Layer();
this.addChild(layer3D, 0);
this._layerBillBorad = layer3D;
this._layerBillBoard = layer3D;
var s = cc.winSize;
if(!this._camera){
this._camera = new cc.Camera(cc.Camera.Mode.PERSPECTIVE, 60, s.width/s.height, 1, 500);
this._camera.setCameraFlag(cc.CameraFlag.USER1);
this._layerBillBorad.addChild(this._camera);
this._layerBillBoard.addChild(this._camera);
}
//Create rotating billboards
@ -193,7 +193,7 @@ var BillBoardTest = BillBoardTestDemo.extend({
billboard.setOpacity(Math.random() * 128 + 128);
this._billboards.push(billboard);
layer.addChild(billboard);
this._layerBillBorad.addChild(layer);
this._layerBillBoard.addChild(layer);
layer.runAction(cc.rotateBy(Math.random() * 10, cc.math.vec3(0, 45, 0)).repeatForever());
}
@ -212,25 +212,25 @@ var BillBoardTest = BillBoardTestDemo.extend({
sprite3d.setScale(2);
sprite3d.addChild(billboard1);
sprite3d.runAction(cc.rotateBy(10, cc.math.vec3(0, 360, 0)).repeatForever());
this._layerBillBorad.addChild(sprite3d);
this._layerBillBoard.addChild(sprite3d);
}
this.addNewBillBoradWithCoords(cc.math.vec3(20, 5, 0));
this.addNewBillBoradWithCoords(cc.math.vec3(60, 5, 0));
this.addNewBillBoradWithCoords(cc.math.vec3(100, 5, 0));
this.addNewBillBoradWithCoords(cc.math.vec3(140, 5, 0));
this.addNewBillBoradWithCoords(cc.math.vec3(180, 5, 0));
this.addNewBillBoardWithCoords(cc.math.vec3(20, 5, 0));
this.addNewBillBoardWithCoords(cc.math.vec3(60, 5, 0));
this.addNewBillBoardWithCoords(cc.math.vec3(100, 5, 0));
this.addNewBillBoardWithCoords(cc.math.vec3(140, 5, 0));
this.addNewBillBoardWithCoords(cc.math.vec3(180, 5, 0));
this.addNewAniBillBoradWithCoords(cc.math.vec3(-20, 0, 0));
this.addNewAniBillBoradWithCoords(cc.math.vec3(-60, 0, 0));
this.addNewAniBillBoradWithCoords(cc.math.vec3(-100, 0, 0));
this.addNewAniBillBoradWithCoords(cc.math.vec3(-140, 0, 0));
this.addNewAniBillBoradWithCoords(cc.math.vec3(-180, 0, 0));
this.addNewAniBillBoardWithCoords(cc.math.vec3(-20, 0, 0));
this.addNewAniBillBoardWithCoords(cc.math.vec3(-60, 0, 0));
this.addNewAniBillBoardWithCoords(cc.math.vec3(-100, 0, 0));
this.addNewAniBillBoardWithCoords(cc.math.vec3(-140, 0, 0));
this.addNewAniBillBoardWithCoords(cc.math.vec3(-180, 0, 0));
this._camera.setPosition3D(cc.math.vec3(0, 100, 230));
this._camera.lookAt(cc.math.vec3(0, 0, 0), cc.math.vec3(0, 1, 0));
this._layerBillBorad.setCameraMask(2);
this._layerBillBoard.setCameraMask(2);
var label1 = new cc.LabelTTF("rotate+", "Arial", 16);
var item1 = new cc.MenuItemLabel(label1, function(){
@ -259,24 +259,24 @@ var BillBoardTest = BillBoardTestDemo.extend({
menu.setPosition(0, 0);
},
addNewBillBoradWithCoords:function(position){
addNewBillBoardWithCoords:function(position){
var imgs = ["Images/Icon.png", "Images/r2.png"];
for(var i = 0; i < 10; ++i){
var billboard = new jsb.BillBoard(imgs[Math.floor(Math.random() + 0.5)]);
billboard.setScale(0.5);
billboard.setPosition3D(cc.math.vec3(position.x, position.y, -150+30*i));
billboard.setOpacity(Math.random() * 128 + 128);
this._layerBillBorad.addChild(billboard);
this._layerBillBoard.addChild(billboard);
this._billboards.push(billboard);
}
},
addNewAniBillBoradWithCoords:function(position){
addNewAniBillBoardWithCoords:function(position){
for(var i = 0; i < 10; ++i){
var billboardAni = new jsb.BillBoard("Images/grossini.png");
billboardAni.setScale(0.5);
billboardAni.setPosition3D(cc.math.vec3(position.x, position.y, -150+30*i));
this._layerBillBorad.addChild(billboardAni);
this._layerBillBoard.addChild(billboardAni);
var animation = new cc.Animation();
for(var j = 1; j < 15; ++j){

View File

@ -7,7 +7,7 @@ end)
function BillBoardTest:ctor()
self._camera = nil
self._layerBillBorad = nil
self._layerBillBoard = nil
self._billboards = {}
self:init()
end
@ -20,24 +20,24 @@ function BillBoardTest:subtitle()
return ""
end
function BillBoardTest:addNewBillBoradWithCoords(p)
function BillBoardTest:addNewBillBoardWithCoords(p)
local imgs = {"Images/Icon.png", "Images/r2.png"}
for i= 1, 10 do
local billborad = cc.BillBoard:create(imgs[math.ceil(math.random() + 0.5)])
billborad:setScale(0.5)
billborad:setPosition3D(cc.vec3(p.x, p.y, -150.0 + 30 * i))
billborad:setOpacity(math.random() * 128 + 128)
self._layerBillBorad:addChild(billborad)
table.insert(self._billboards, billborad)
local billboard = cc.BillBoard:create(imgs[math.ceil(math.random() + 0.5)])
billboard:setScale(0.5)
billboard:setPosition3D(cc.vec3(p.x, p.y, -150.0 + 30 * i))
billboard:setOpacity(math.random() * 128 + 128)
self._layerBillBoard:addChild(billboard)
table.insert(self._billboards, billboard)
end
end
function BillBoardTest:addNewAniBillBoradWithCoords(p)
function BillBoardTest:addNewAniBillBoardWithCoords(p)
for i = 1, 10 do
local billboradAni = cc.BillBoard:create("Images/grossini.png")
billboradAni:setScale(0.5)
billboradAni:setPosition3D(cc.vec3(p.x, p.y, -150.0 + 30 * (i - 1)))
self._layerBillBorad:addChild(billboradAni)
local billboardAni = cc.BillBoard:create("Images/grossini.png")
billboardAni:setScale(0.5)
billboardAni:setPosition3D(cc.vec3(p.x, p.y, -150.0 + 30 * (i - 1)))
self._layerBillBoard:addChild(billboardAni)
local animation = cc.Animation:create()
for i=1,14 do
@ -50,9 +50,9 @@ function BillBoardTest:addNewAniBillBoradWithCoords(p)
animation:setRestoreOriginalFrame(true)
local action = cc.Animate:create(animation)
billboradAni:runAction(cc.RepeatForever:create(action))
billboradAni:setOpacity( math.random() * 128 + 128)
table.insert(self._billboards, billboradAni)
billboardAni:runAction(cc.RepeatForever:create(action))
billboardAni:setOpacity( math.random() * 128 + 128)
table.insert(self._billboards, billboardAni)
end
end
@ -93,13 +93,13 @@ function BillBoardTest:init()
local layer3D = cc.Layer:create()
self:addChild(layer3D,0)
self._layerBillBorad = layer3D
self._layerBillBoard = layer3D
local s = cc.Director:getInstance():getWinSize()
if self._camera == nil then
self._camera = cc.Camera:createPerspective(60, s.width/s.height, 1, 500)
self._camera:setCameraFlag(cc.CameraFlag.USER1)
self._layerBillBorad:addChild(self._camera)
self._layerBillBoard:addChild(self._camera)
end
local imgs = {"Images/Icon.png", "Images/r2.png"}
@ -112,7 +112,7 @@ function BillBoardTest:init()
billboard:setOpacity(math.random() * 128 + 128)
table.insert(self._billboards, billboard)
layer:addChild(billboard)
self._layerBillBorad:addChild(layer)
self._layerBillBoard:addChild(layer)
layer:runAction( cc.RepeatForever:create( cc.RotateBy:create( math.random() * 10, cc.vec3(0.0, 45.0, 0.0) ) ) )
end
@ -130,18 +130,18 @@ function BillBoardTest:init()
sprite3d:setScale(2.0)
sprite3d:addChild(billboard)
sprite3d:runAction( cc.RepeatForever:create( cc.RotateBy:create( 10.0, cc.vec3(0.0, 360.0, 0.0) ) ) )
self._layerBillBorad:addChild(sprite3d)
self._layerBillBoard:addChild(sprite3d)
self:addNewBillBoradWithCoords(cc.vec3(20,5,0))
self:addNewBillBoradWithCoords(cc.vec3(60,5,0))
self:addNewBillBoradWithCoords(cc.vec3(100,5,0))
self:addNewBillBoradWithCoords(cc.vec3(140,5,0))
self:addNewBillBoradWithCoords(cc.vec3(180,5,0))
self:addNewAniBillBoradWithCoords(cc.vec3(-20,0,0))
self:addNewAniBillBoradWithCoords(cc.vec3(-60,0,0))
self:addNewAniBillBoradWithCoords(cc.vec3(-100,0,0))
self:addNewAniBillBoradWithCoords(cc.vec3(-140,0,0))
self:addNewAniBillBoradWithCoords(cc.vec3(-180,0,0))
self:addNewBillBoardWithCoords(cc.vec3(20,5,0))
self:addNewBillBoardWithCoords(cc.vec3(60,5,0))
self:addNewBillBoardWithCoords(cc.vec3(100,5,0))
self:addNewBillBoardWithCoords(cc.vec3(140,5,0))
self:addNewBillBoardWithCoords(cc.vec3(180,5,0))
self:addNewAniBillBoardWithCoords(cc.vec3(-20,0,0))
self:addNewAniBillBoardWithCoords(cc.vec3(-60,0,0))
self:addNewAniBillBoardWithCoords(cc.vec3(-100,0,0))
self:addNewAniBillBoardWithCoords(cc.vec3(-140,0,0))
self:addNewAniBillBoardWithCoords(cc.vec3(-180,0,0))
self._camera:setPosition(cc.vec3(0, 130, 230))
self._camera:lookAt(cc.vec3(0, 0, 100), cc.vec3(0, 1, 0))
@ -170,7 +170,7 @@ function BillBoardTest:init()
menuItem1:setPosition( cc.p( s.width-80, VisibleRect:top().y-160) )
menuItem2:setPosition( cc.p( s.width-80, VisibleRect:top().y-190) )
self:addChild(menu, 0)
self._layerBillBorad:setCameraMask(2)
self._layerBillBoard:setCameraMask(2)
label1 = cc.Label:createWithTTF(ttfConfig,"Point Oriented")
menuItem1 = cc.MenuItemLabel:create(label1)