merge cocos

This commit is contained in:
yangxiao 2015-09-18 14:08:33 +08:00
commit 36d4f5564d
18 changed files with 1815 additions and 1 deletions

View File

@ -1320,6 +1320,10 @@
38F526411A48363B000DB7F7 /* ArmatureNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */; }; 38F526411A48363B000DB7F7 /* ArmatureNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */; };
38F526421A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */; }; 38F526421A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */; };
38F526431A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */; }; 38F526431A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */; };
3E2A09C21BAA91B70086B878 /* CCMotionStreak3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2A09C01BAA91B70086B878 /* CCMotionStreak3D.cpp */; };
3E2A09C31BAA91B70086B878 /* CCMotionStreak3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2A09C01BAA91B70086B878 /* CCMotionStreak3D.cpp */; };
3E2A09C41BAA91B70086B878 /* CCMotionStreak3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2A09C11BAA91B70086B878 /* CCMotionStreak3D.h */; };
3E2A09C51BAA91B70086B878 /* CCMotionStreak3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2A09C11BAA91B70086B878 /* CCMotionStreak3D.h */; };
3E2BDADE19C030ED0055CDCD /* AudioEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDADD19C030ED0055CDCD /* AudioEngine.h */; }; 3E2BDADE19C030ED0055CDCD /* AudioEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDADD19C030ED0055CDCD /* AudioEngine.h */; };
3E2BDAEC19C0436F0055CDCD /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; }; 3E2BDAEC19C0436F0055CDCD /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; };
3E2F27A619CFBFE100E7C490 /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; }; 3E2F27A619CFBFE100E7C490 /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; };
@ -4201,6 +4205,8 @@
38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArmatureNodeReader.cpp; sourceTree = "<group>"; }; 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArmatureNodeReader.cpp; sourceTree = "<group>"; };
38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArmatureNodeReader.h; sourceTree = "<group>"; }; 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArmatureNodeReader.h; sourceTree = "<group>"; };
38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSArmatureNode_generated.h; sourceTree = "<group>"; }; 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSArmatureNode_generated.h; sourceTree = "<group>"; };
3E2A09C01BAA91B70086B878 /* CCMotionStreak3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMotionStreak3D.cpp; sourceTree = "<group>"; };
3E2A09C11BAA91B70086B878 /* CCMotionStreak3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMotionStreak3D.h; sourceTree = "<group>"; };
3E2BDADD19C030ED0055CDCD /* AudioEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioEngine.h; sourceTree = "<group>"; }; 3E2BDADD19C030ED0055CDCD /* AudioEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioEngine.h; sourceTree = "<group>"; };
3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioEngine.cpp; sourceTree = "<group>"; }; 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioEngine.cpp; sourceTree = "<group>"; };
3E6176551960F89B00DE83F5 /* CCController-iOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "CCController-iOS.mm"; path = "../base/CCController-iOS.mm"; sourceTree = "<group>"; }; 3E6176551960F89B00DE83F5 /* CCController-iOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "CCController-iOS.mm"; path = "../base/CCController-iOS.mm"; sourceTree = "<group>"; };
@ -7937,6 +7943,8 @@
B29594B81926D61F003EEF37 /* 3d */ = { B29594B81926D61F003EEF37 /* 3d */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
3E2A09C01BAA91B70086B878 /* CCMotionStreak3D.cpp */,
3E2A09C11BAA91B70086B878 /* CCMotionStreak3D.h */,
B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */, B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */,
B603F1A71AC8EA0900A9579C /* CCTerrain.h */, B603F1A71AC8EA0900A9579C /* CCTerrain.h */,
B6D38B861AC3AFAC00043997 /* CCSkybox.cpp */, B6D38B861AC3AFAC00043997 /* CCSkybox.cpp */,
@ -9160,6 +9168,7 @@
B29A7DE519EE1B7700872B35 /* SkeletonAnimation.h in Headers */, B29A7DE519EE1B7700872B35 /* SkeletonAnimation.h in Headers */,
50ABBE871925AB6F00A911A9 /* ccMacros.h in Headers */, 50ABBE871925AB6F00A911A9 /* ccMacros.h in Headers */,
B665E32C1AA80A6500DDB1C5 /* CCPUOnCountObserver.h in Headers */, B665E32C1AA80A6500DDB1C5 /* CCPUOnCountObserver.h in Headers */,
3E2A09C41BAA91B70086B878 /* CCMotionStreak3D.h in Headers */,
15B3708A19EE414C00ABE682 /* Manifest.h in Headers */, 15B3708A19EE414C00ABE682 /* Manifest.h in Headers */,
50ABBE731925AB6F00A911A9 /* CCEventListenerMouse.h in Headers */, 50ABBE731925AB6F00A911A9 /* CCEventListenerMouse.h in Headers */,
1A570063180BC5A10088DEC7 /* CCAction.h in Headers */, 1A570063180BC5A10088DEC7 /* CCAction.h in Headers */,
@ -10222,6 +10231,7 @@
B665E3A91AA80A6500DDB1C5 /* CCPURandomiser.h in Headers */, B665E3A91AA80A6500DDB1C5 /* CCPURandomiser.h in Headers */,
15AE19AF19AAD39700C27E9E /* PageViewReader.h in Headers */, 15AE19AF19AAD39700C27E9E /* PageViewReader.h in Headers */,
B6CAB29A1AF9AA1A00B9B856 /* btConcaveShape.h in Headers */, B6CAB29A1AF9AA1A00B9B856 /* btConcaveShape.h in Headers */,
3E2A09C51BAA91B70086B878 /* CCMotionStreak3D.h in Headers */,
B6CAB2AE1AF9AA1A00B9B856 /* btConvexPointCloudShape.h in Headers */, B6CAB2AE1AF9AA1A00B9B856 /* btConvexPointCloudShape.h in Headers */,
B29A7DD419EE1B7700872B35 /* Skin.h in Headers */, B29A7DD419EE1B7700872B35 /* Skin.h in Headers */,
B6CAB2221AF9AA1A00B9B856 /* btBoxBoxDetector.h in Headers */, B6CAB2221AF9AA1A00B9B856 /* btBoxBoxDetector.h in Headers */,
@ -11689,6 +11699,7 @@
B6CAB2491AF9AA1A00B9B856 /* btConvexPlaneCollisionAlgorithm.cpp in Sources */, B6CAB2491AF9AA1A00B9B856 /* btConvexPlaneCollisionAlgorithm.cpp in Sources */,
B665E35A1AA80A6500DDB1C5 /* CCPUOnRandomObserver.cpp in Sources */, B665E35A1AA80A6500DDB1C5 /* CCPUOnRandomObserver.cpp in Sources */,
B6CAB2891AF9AA1A00B9B856 /* btCapsuleShape.cpp in Sources */, B6CAB2891AF9AA1A00B9B856 /* btCapsuleShape.cpp in Sources */,
3E2A09C21BAA91B70086B878 /* CCMotionStreak3D.cpp in Sources */,
B6CAB42F1AF9AA1A00B9B856 /* btWheelInfo.cpp in Sources */, B6CAB42F1AF9AA1A00B9B856 /* btWheelInfo.cpp in Sources */,
B29A7DFB19EE1B7700872B35 /* spine-cocos2dx.cpp in Sources */, B29A7DFB19EE1B7700872B35 /* spine-cocos2dx.cpp in Sources */,
B6CAB3391AF9AA1A00B9B856 /* btTriangleShapeEx.cpp in Sources */, B6CAB3391AF9AA1A00B9B856 /* btTriangleShapeEx.cpp in Sources */,
@ -12487,6 +12498,7 @@
B6CAB3741AF9AA1A00B9B856 /* btGjkEpa2.cpp in Sources */, B6CAB3741AF9AA1A00B9B856 /* btGjkEpa2.cpp in Sources */,
B665E3DB1AA80A6600DDB1C5 /* CCPUScriptTranslator.cpp in Sources */, B665E3DB1AA80A6600DDB1C5 /* CCPUScriptTranslator.cpp in Sources */,
B665E33B1AA80A6500DDB1C5 /* CCPUOnEventFlagObserver.cpp in Sources */, B665E33B1AA80A6500DDB1C5 /* CCPUOnEventFlagObserver.cpp in Sources */,
3E2A09C31BAA91B70086B878 /* CCMotionStreak3D.cpp in Sources */,
1A5702F3180BCE750088DEC7 /* CCTMXObjectGroup.cpp in Sources */, 1A5702F3180BCE750088DEC7 /* CCTMXObjectGroup.cpp in Sources */,
382384221A2590DA002C4610 /* GameMapReader.cpp in Sources */, 382384221A2590DA002C4610 /* GameMapReader.cpp in Sources */,
15AE1BAF19AADFDF00C27E9E /* UILayoutManager.cpp in Sources */, 15AE1BAF19AADFDF00C27E9E /* UILayoutManager.cpp in Sources */,

View File

@ -386,6 +386,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClCompile Include="..\3d\CCMesh.cpp" /> <ClCompile Include="..\3d\CCMesh.cpp" />
<ClCompile Include="..\3d\CCMeshSkin.cpp" /> <ClCompile Include="..\3d\CCMeshSkin.cpp" />
<ClCompile Include="..\3d\CCMeshVertexIndexData.cpp" /> <ClCompile Include="..\3d\CCMeshVertexIndexData.cpp" />
<ClCompile Include="..\3d\CCMotionStreak3D.cpp" />
<ClCompile Include="..\3d\CCOBB.cpp" /> <ClCompile Include="..\3d\CCOBB.cpp" />
<ClCompile Include="..\3d\CCObjLoader.cpp" /> <ClCompile Include="..\3d\CCObjLoader.cpp" />
<ClCompile Include="..\3d\CCPlane.cpp" /> <ClCompile Include="..\3d\CCPlane.cpp" />
@ -955,6 +956,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="..\3d\CCMesh.h" /> <ClInclude Include="..\3d\CCMesh.h" />
<ClInclude Include="..\3d\CCMeshSkin.h" /> <ClInclude Include="..\3d\CCMeshSkin.h" />
<ClInclude Include="..\3d\CCMeshVertexIndexData.h" /> <ClInclude Include="..\3d\CCMeshVertexIndexData.h" />
<ClInclude Include="..\3d\CCMotionStreak3D.h" />
<ClInclude Include="..\3d\CCOBB.h" /> <ClInclude Include="..\3d\CCOBB.h" />
<ClInclude Include="..\3d\CCObjLoader.h" /> <ClInclude Include="..\3d\CCObjLoader.h" />
<ClInclude Include="..\3d\CCPlane.h" /> <ClInclude Include="..\3d\CCPlane.h" />

View File

@ -832,6 +832,9 @@
<ClCompile Include="..\3d\CCSprite3DMaterial.cpp"> <ClCompile Include="..\3d\CCSprite3DMaterial.cpp">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\3d\CCMotionStreak3D.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="..\..\extensions\assets-manager\AssetsManager.cpp"> <ClCompile Include="..\..\extensions\assets-manager\AssetsManager.cpp">
<Filter>extension\AssetsManager</Filter> <Filter>extension\AssetsManager</Filter>
</ClCompile> </ClCompile>
@ -2561,6 +2564,9 @@
<ClInclude Include="..\3d\CCSprite3DMaterial.h"> <ClInclude Include="..\3d\CCSprite3DMaterial.h">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\3d\CCMotionStreak3D.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="..\3d\cocos3d.h"> <ClInclude Include="..\3d\cocos3d.h">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClInclude> </ClInclude>

View File

@ -221,6 +221,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMesh.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMesh.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshSkin.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshSkin.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMotionStreak3D.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCObjLoader.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCObjLoader.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCPlane.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCPlane.h" />
@ -849,6 +850,7 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMesh.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMesh.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshSkin.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshSkin.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMotionStreak3D.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCObjLoader.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCObjLoader.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCPlane.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCPlane.cpp" />

View File

@ -39,6 +39,9 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.h"> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.h">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMotionStreak3D.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.h"> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.h">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClInclude> </ClInclude>
@ -1910,6 +1913,9 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.cpp"> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMeshVertexIndexData.cpp">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCMotionStreak3D.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.cpp"> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCOBB.cpp">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClCompile> </ClCompile>

View File

@ -18,6 +18,7 @@ CCBundleReader.cpp \
CCMesh.cpp \ CCMesh.cpp \
CCMeshSkin.cpp \ CCMeshSkin.cpp \
CCMeshVertexIndexData.cpp \ CCMeshVertexIndexData.cpp \
CCMotionStreak3D.cpp \
CCSprite3DMaterial.cpp \ CCSprite3DMaterial.cpp \
CCObjLoader.cpp \ CCObjLoader.cpp \
CCSkeleton3D.cpp \ CCSkeleton3D.cpp \

View File

@ -0,0 +1,411 @@
/****************************************************************************
Copyright (c) 2011 ForzeField Studios S.L.
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN false EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/CCMotionStreak3D.h"
#include "math/CCVertex.h"
#include "base/CCDirector.h"
#include "renderer/CCTextureCache.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/CCTexture2D.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCRenderState.h"
NS_CC_BEGIN
MotionStreak3D::MotionStreak3D()
: _startingPositionInitialized(false)
, _texture(nullptr)
, _blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED)
, _stroke(0.0f)
, _fadeDelta(0.0f)
, _minSeg(0.0f)
, _maxPoints(0)
, _nuPoints(0)
, _previousNuPoints(0)
, _pointVertexes(nullptr)
, _pointState(nullptr)
, _vertices(nullptr)
, _colorPointer(nullptr)
, _texCoords(nullptr)
, _positionR2D(0.f, 0.f)
, _sweepAxis(0.f, 1.f, 0.f)
{
}
MotionStreak3D::~MotionStreak3D()
{
CC_SAFE_RELEASE(_texture);
CC_SAFE_FREE(_pointState);
CC_SAFE_FREE(_pointVertexes);
CC_SAFE_FREE(_vertices);
CC_SAFE_FREE(_colorPointer);
CC_SAFE_FREE(_texCoords);
}
MotionStreak3D* MotionStreak3D::create(float fade, float minSeg, float stroke, const Color3B& color, const std::string& path)
{
MotionStreak3D *ret = new (std::nothrow) MotionStreak3D();
if (ret && ret->initWithFade(fade, minSeg, stroke, color, path))
{
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return nullptr;
}
MotionStreak3D* MotionStreak3D::create(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture)
{
MotionStreak3D *ret = new (std::nothrow) MotionStreak3D();
if (ret && ret->initWithFade(fade, minSeg, stroke, color, texture))
{
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return nullptr;
}
bool MotionStreak3D::initWithFade(float fade, float minSeg, float stroke, const Color3B& color, const std::string& path)
{
CCASSERT(!path.empty(), "Invalid filename");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(path);
return initWithFade(fade, minSeg, stroke, color, texture);
}
bool MotionStreak3D::initWithFade(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture)
{
Node::setPosition(Vec2::ZERO);
setAnchorPoint(Vec2::ZERO);
ignoreAnchorPointForPosition(true);
_startingPositionInitialized = false;
_positionR.setZero();
_minSeg = (minSeg == -1.0f) ? stroke/5.0f : minSeg;
_minSeg *= _minSeg;
_stroke = stroke;
_fadeDelta = 1.0f/fade;
_maxPoints = (int)(fade*60.0f)+2;
_nuPoints = 0;
_pointState = (float *)malloc(sizeof(float) * _maxPoints);
_pointVertexes = (Vec3*)malloc(sizeof(Vec3) * _maxPoints);
_vertices = (Vec3*)malloc(sizeof(Vec3) * _maxPoints * 2);
_texCoords = (Tex2F*)malloc(sizeof(Tex2F) * _maxPoints * 2);
_colorPointer = (GLubyte*)malloc(sizeof(GLubyte) * _maxPoints * 2 * 4);
// Set blend mode
_blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
// shader state
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
setTexture(texture);
setColor(color);
scheduleUpdate();
return true;
}
void MotionStreak3D::setPosition(const Vec2& position)
{
if (!_startingPositionInitialized) {
_startingPositionInitialized = true;
}
_positionR = Vec3(position.x, position.y, 0);
}
void MotionStreak3D::setPosition(float x, float y)
{
if (!_startingPositionInitialized) {
_startingPositionInitialized = true;
}
_positionR.x = x;
_positionR.y = y;
}
void MotionStreak3D::setPosition3D(const Vec3& position)
{
if (!_startingPositionInitialized) {
_startingPositionInitialized = true;
}
_positionR = position;
}
const Vec2& MotionStreak3D::getPosition() const
{
_positionR2D.x = _positionR.x;
_positionR2D.y = _positionR.y;
return _positionR2D;
}
void MotionStreak3D::getPosition(float* x, float* y) const
{
*x = _positionR.x;
*y = _positionR.y;
}
float MotionStreak3D::getPositionX() const
{
return _positionR.x;
}
Vec3 MotionStreak3D::getPosition3D() const
{
return Vec3(_positionR.x, _positionR.y, getPositionZ());
}
void MotionStreak3D::setPositionX(float x)
{
if (!_startingPositionInitialized) {
_startingPositionInitialized = true;
}
_positionR.x = x;
}
float MotionStreak3D::getPositionY() const
{
return _positionR.y;
}
void MotionStreak3D::setPositionY(float y)
{
if (!_startingPositionInitialized) {
_startingPositionInitialized = true;
}
_positionR.y = y;
}
void MotionStreak3D::tintWithColor(const Color3B& colors)
{
setColor(colors);
// Fast assignation
for(unsigned int i = 0; i<_nuPoints*2; i++)
{
*((Color3B*) (_colorPointer+i*4)) = colors;
}
}
Texture2D* MotionStreak3D::getTexture(void) const
{
return _texture;
}
void MotionStreak3D::setTexture(Texture2D *texture)
{
if (_texture != texture)
{
CC_SAFE_RETAIN(texture);
CC_SAFE_RELEASE(_texture);
_texture = texture;
}
}
void MotionStreak3D::setBlendFunc(const BlendFunc &blendFunc)
{
_blendFunc = blendFunc;
}
const BlendFunc& MotionStreak3D::getBlendFunc(void) const
{
return _blendFunc;
}
void MotionStreak3D::setOpacity(GLubyte opacity)
{
CCASSERT(false, "Set opacity no supported");
}
GLubyte MotionStreak3D::getOpacity(void) const
{
CCASSERT(false, "Opacity no supported");
return 0;
}
void MotionStreak3D::setOpacityModifyRGB(bool bValue)
{
CC_UNUSED_PARAM(bValue);
}
bool MotionStreak3D::isOpacityModifyRGB(void) const
{
return false;
}
void MotionStreak3D::update(float delta)
{
if (!_startingPositionInitialized)
{
return;
}
delta *= _fadeDelta;
unsigned int newIdx, newIdx2, i, i2;
unsigned int mov = 0;
// Update current points
for(i = 0; i<_nuPoints; i++)
{
_pointState[i]-=delta;
if(_pointState[i] <= 0)
mov++;
else
{
newIdx = i-mov;
if(mov>0)
{
// Move data
_pointState[newIdx] = _pointState[i];
// Move point
_pointVertexes[newIdx] = _pointVertexes[i];
// Move vertices
i2 = i*2;
newIdx2 = newIdx*2;
_vertices[newIdx2] = _vertices[i2];
_vertices[newIdx2+1] = _vertices[i2+1];
// Move color
i2 *= 4;
newIdx2 *= 4;
_colorPointer[newIdx2+0] = _colorPointer[i2+0];
_colorPointer[newIdx2+1] = _colorPointer[i2+1];
_colorPointer[newIdx2+2] = _colorPointer[i2+2];
_colorPointer[newIdx2+4] = _colorPointer[i2+4];
_colorPointer[newIdx2+5] = _colorPointer[i2+5];
_colorPointer[newIdx2+6] = _colorPointer[i2+6];
}else
newIdx2 = newIdx*8;
const GLubyte op = (GLubyte)(_pointState[newIdx] * 255.0f);
_colorPointer[newIdx2+3] = op;
_colorPointer[newIdx2+7] = op;
}
}
_nuPoints-=mov;
// Append new point
bool appendNewPoint = true;
if(_nuPoints >= _maxPoints)
{
appendNewPoint = false;
}
else if(_nuPoints>0)
{
bool a1 = (_pointVertexes[_nuPoints-1] - _positionR).lengthSquared() < _minSeg;
bool a2 = (_nuPoints == 1) ? false : ((_pointVertexes[_nuPoints-2] - _positionR).lengthSquared() < (_minSeg * 2.0f));
if(a1 || a2)
{
appendNewPoint = false;
}
}
if(appendNewPoint)
{
_pointVertexes[_nuPoints] = _positionR;
_pointState[_nuPoints] = 1.0f;
// Color assignment
const unsigned int offset = _nuPoints*8;
*((Color3B*)(_colorPointer + offset)) = _displayedColor;
*((Color3B*)(_colorPointer + offset+4)) = _displayedColor;
// Opacity
_colorPointer[offset+3] = 255;
_colorPointer[offset+7] = 255;
// Generate polygon
{
float stroke = _stroke * 0.5f;
_vertices[_nuPoints * 2] = _pointVertexes[_nuPoints] + (_sweepAxis * stroke);
_vertices[_nuPoints * 2 + 1] = _pointVertexes[_nuPoints] - (_sweepAxis * stroke);
}
_nuPoints ++;
}
// Updated Tex Coords only if they are different than previous step
if( _nuPoints && _previousNuPoints != _nuPoints ) {
float texDelta = 1.0f / _nuPoints;
for( i=0; i < _nuPoints; i++ ) {
_texCoords[i*2] = Tex2F(0, texDelta*i);
_texCoords[i*2+1] = Tex2F(1, texDelta*i);
}
_previousNuPoints = _nuPoints;
}
}
void MotionStreak3D::reset()
{
_nuPoints = 0;
}
void MotionStreak3D::onDraw(const Mat4 &transform, uint32_t flags)
{
getGLProgram()->use();
getGLProgram()->setUniformsForBuiltins(transform);
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX );
GL::blendFunc( _blendFunc.src, _blendFunc.dst );
GL::bindTexture2D( _texture->getName() );
glDisable(GL_CULL_FACE);
RenderState::StateBlock::_defaultState->setCullFace(false);
glEnable(GL_DEPTH_TEST);
RenderState::StateBlock::_defaultState->setDepthTest(true);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, _vertices);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 0, _texCoords);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, _colorPointer);
glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nuPoints*2);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _nuPoints*2);
}
void MotionStreak3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
if(_nuPoints <= 1)
return;
_customCommand.init(_globalZOrder, transform, flags);
_customCommand.func = CC_CALLBACK_0(MotionStreak3D::onDraw, this, transform, flags);
renderer->addCommand(&_customCommand);
}
NS_CC_END

205
cocos/3d/CCMotionStreak3D.h Normal file
View File

@ -0,0 +1,205 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_MOTION_STREAK3D_H__
#define __CC_MOTION_STREAK3D_H__
#include "base/CCProtocols.h"
#include "2d/CCNode.h"
#include "renderer/CCCustomCommand.h"
NS_CC_BEGIN
class Texture2D;
/**
* @addtogroup _3d
* @{
*/
/** @class MotionStreak3D.
* @brief Creates a trailing path. It is created from a line segment sweeping along the path.
*/
class CC_DLL MotionStreak3D : public Node, public TextureProtocol
{
public:
/** Creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture filename.
*
* @param fade The fade time, in seconds.
* @param minSeg The minimum segments.
* @param stroke The width of stroke.
* @param color The color of stroke.
* @param path The texture file name of stoke.
* @return An autoreleased MotionStreak3D object.
*/
static MotionStreak3D* create(float fade, float minSeg, float stroke, const Color3B& color, const std::string& path);
/** Creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture.
*
* @param fade The fade time, in seconds.
* @param minSeg The minimum segments.
* @param stroke The width of stroke.
* @param color The color of stroke.
* @param texture The texture name of stoke.
* @return An autoreleased MotionStreak3D object.
*/
static MotionStreak3D* create(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
/** Color used for the tint.
*
* @param colors The color used for the tint.
*/
void tintWithColor(const Color3B& colors);
/** Remove all living segments of the ribbon.
*/
void reset();
/** Get stroke.
*
* @return float stroke.
*/
inline float getStroke() const { return _stroke; }
/** Set stroke.
*
* @param stroke The width of stroke.
*/
inline void setStroke(float stroke) { _stroke = stroke; }
/** Is the starting position initialized or not.
*
* @return True if the starting position is initialized.
*/
inline bool isStartingPositionInitialized() const { return _startingPositionInitialized; }
/** Sets the starting position initialized or not.
*
* @param bStartingPositionInitialized True if initialized the starting position.
*/
inline void setStartingPositionInitialized(bool bStartingPositionInitialized)
{
_startingPositionInitialized = bStartingPositionInitialized;
}
// Overrides
virtual void setPosition(const Vec2& position) override;
virtual void setPosition(float x, float y) override;
virtual void setPosition3D(const Vec3& position) override;
virtual void setRotation3D(const Vec3& rotation) override {}
virtual void setRotationQuat(const Quaternion& quat) override {}
virtual const Vec2& getPosition() const override;
virtual void getPosition(float* x, float* y) const override;
virtual void setPositionX(float x) override;
virtual void setPositionY(float y) override;
virtual float getPositionX(void) const override;
virtual float getPositionY(void) const override;
virtual Vec3 getPosition3D() const override;
/**
* @js NA
* @lua NA
*/
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
/**
* @lua NA
*/
virtual void update(float delta) override;
virtual Texture2D* getTexture() const override;
virtual void setTexture(Texture2D *texture) override;
/**
* @js NA
* @lua NA
*/
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
/**
* @js NA
* @lua NA
*/
virtual const BlendFunc& getBlendFunc() const override;
virtual GLubyte getOpacity() const override;
virtual void setOpacity(GLubyte opacity) override;
virtual void setOpacityModifyRGB(bool value) override;
virtual bool isOpacityModifyRGB() const override;
/**
* Set the direction of sweeping line segment.
* @param sweepAxis Direction of sweeping line segment
*/
void setSweepAxis(const Vec3& sweepAxis) { _sweepAxis = sweepAxis.getNormalized(); }
/**
* Get the direction of sweeping line segment
*/
const Vec3& getSweepAxis() const { return _sweepAxis; }
CC_CONSTRUCTOR_ACCESS:
MotionStreak3D();
virtual ~MotionStreak3D();
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, const std::string& path);
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
protected:
//renderer callback
void onDraw(const Mat4 &transform, uint32_t flags);
bool _startingPositionInitialized;
/** texture used for the motion streak */
Texture2D* _texture;
BlendFunc _blendFunc;
Vec3 _positionR;
mutable Vec2 _positionR2D;
Vec3 _sweepAxis;
float _stroke;
float _fadeDelta;
float _minSeg;
unsigned int _maxPoints;
unsigned int _nuPoints;
unsigned int _previousNuPoints;
/** Pointers */
Vec3* _pointVertexes;
float* _pointState;
// Opengl
Vec3* _vertices;
GLubyte* _colorPointer;
Tex2F* _texCoords;
CustomCommand _customCommand;
private:
CC_DISALLOW_COPY_AND_ASSIGN(MotionStreak3D);
};
// end of _3d group
/// @}
NS_CC_END
#endif //__CC_MOTION_STREAK3D_H__

View File

@ -16,6 +16,7 @@ set(COCOS_3D_SRC
3d/CCMesh.cpp 3d/CCMesh.cpp
3d/CCMeshSkin.cpp 3d/CCMeshSkin.cpp
3d/CCMeshVertexIndexData.cpp 3d/CCMeshVertexIndexData.cpp
3d/CCMotionStreak3D.cpp
3d/CCOBB.cpp 3d/CCOBB.cpp
3d/CCObjLoader.cpp 3d/CCObjLoader.cpp
3d/CCPlane.cpp 3d/CCPlane.cpp

View File

@ -292,6 +292,7 @@ THE SOFTWARE.
#include "3d/CCFrustum.h" #include "3d/CCFrustum.h"
#include "3d/CCMesh.h" #include "3d/CCMesh.h"
#include "3d/CCMeshSkin.h" #include "3d/CCMeshSkin.h"
#include "3d/CCMotionStreak3D.h"
#include "3d/CCMeshVertexIndexData.h" #include "3d/CCMeshVertexIndexData.h"
#include "3d/CCOBB.h" #include "3d/CCOBB.h"
#include "3d/CCPlane.h" #include "3d/CCPlane.h"

View File

@ -0,0 +1,237 @@
--------------------------------
-- @module MotionStreak3D
-- @extend Node,TextureProtocol
-- @parent_module cc
--------------------------------
-- Remove all living segments of the ribbon.
-- @function [parent=#MotionStreak3D] reset
-- @param self
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] setTexture
-- @param self
-- @param #cc.Texture2D texture
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] getTexture
-- @param self
-- @return Texture2D#Texture2D ret (return value: cc.Texture2D)
--------------------------------
-- Color used for the tint.<br>
-- param colors The color used for the tint.
-- @function [parent=#MotionStreak3D] tintWithColor
-- @param self
-- @param #color3b_table colors
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
-- Get the direction of sweeping line segment
-- @function [parent=#MotionStreak3D] getSweepAxis
-- @param self
-- @return vec3_table#vec3_table ret (return value: vec3_table)
--------------------------------
-- js NA<br>
-- lua NA
-- @function [parent=#MotionStreak3D] setBlendFunc
-- @param self
-- @param #cc.BlendFunc blendFunc
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
-- Sets the starting position initialized or not.<br>
-- param bStartingPositionInitialized True if initialized the starting position.
-- @function [parent=#MotionStreak3D] setStartingPositionInitialized
-- @param self
-- @param #bool bStartingPositionInitialized
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
-- js NA<br>
-- lua NA
-- @function [parent=#MotionStreak3D] getBlendFunc
-- @param self
-- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc)
--------------------------------
-- Is the starting position initialized or not.<br>
-- return True if the starting position is initialized.
-- @function [parent=#MotionStreak3D] isStartingPositionInitialized
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Get stroke.<br>
-- return float stroke.
-- @function [parent=#MotionStreak3D] getStroke
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- @overload self, float, float, float, color3b_table, cc.Texture2D
-- @overload self, float, float, float, color3b_table, string
-- @function [parent=#MotionStreak3D] initWithFade
-- @param self
-- @param #float fade
-- @param #float minSeg
-- @param #float stroke
-- @param #color3b_table color
-- @param #string path
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Set the direction of sweeping line segment.<br>
-- param sweepAxis Direction of sweeping line segment
-- @function [parent=#MotionStreak3D] setSweepAxis
-- @param self
-- @param #vec3_table sweepAxis
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
-- Set stroke.<br>
-- param stroke The width of stroke.
-- @function [parent=#MotionStreak3D] setStroke
-- @param self
-- @param #float stroke
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
-- @overload self, float, float, float, color3b_table, cc.Texture2D
-- @overload self, float, float, float, color3b_table, string
-- @function [parent=#MotionStreak3D] create
-- @param self
-- @param #float fade
-- @param #float minSeg
-- @param #float stroke
-- @param #color3b_table color
-- @param #string path
-- @return MotionStreak3D#MotionStreak3D ret (return value: cc.MotionStreak3D)
--------------------------------
-- js NA<br>
-- lua NA
-- @function [parent=#MotionStreak3D] draw
-- @param self
-- @param #cc.Renderer renderer
-- @param #mat4_table transform
-- @param #unsigned int flags
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] setOpacityModifyRGB
-- @param self
-- @param #bool value
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] setPositionY
-- @param self
-- @param #float y
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] setRotation3D
-- @param self
-- @param #vec3_table rotation
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] setPositionX
-- @param self
-- @param #float x
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] setPosition3D
-- @param self
-- @param #vec3_table position
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] getPositionY
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
--
-- @function [parent=#MotionStreak3D] getPositionX
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
--
-- @function [parent=#MotionStreak3D] getPosition3D
-- @param self
-- @return vec3_table#vec3_table ret (return value: vec3_table)
--------------------------------
--
-- @function [parent=#MotionStreak3D] setOpacity
-- @param self
-- @param #unsigned char opacity
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
-- lua NA
-- @function [parent=#MotionStreak3D] update
-- @param self
-- @param #float delta
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] setRotationQuat
-- @param self
-- @param #cc.Quaternion quat
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] getOpacity
-- @param self
-- @return unsigned char#unsigned char ret (return value: unsigned char)
--------------------------------
-- @overload self, float, float
-- @overload self, vec2_table
-- @function [parent=#MotionStreak3D] setPosition
-- @param self
-- @param #float x
-- @param #float y
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
-- @overload self, float, float
-- @overload self
-- @function [parent=#MotionStreak3D] getPosition
-- @param self
-- @param #float x
-- @param #float y
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
--------------------------------
--
-- @function [parent=#MotionStreak3D] isOpacityModifyRGB
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#MotionStreak3D] MotionStreak3D
-- @param self
-- @return MotionStreak3D#MotionStreak3D self (return value: cc.MotionStreak3D)
return nil

View File

@ -1311,4 +1311,9 @@
-- @field [parent=#cc] TileMapAtlas#TileMapAtlas TileMapAtlas preloaded module -- @field [parent=#cc] TileMapAtlas#TileMapAtlas TileMapAtlas preloaded module
--------------------------------------------------------
-- the cc MotionStreak3D
-- @field [parent=#cc] MotionStreak3D#MotionStreak3D MotionStreak3D preloaded module
return nil return nil

View File

@ -94372,6 +94372,818 @@ int lua_register_cocos2dx_TileMapAtlas(lua_State* tolua_S)
g_typeCast["TileMapAtlas"] = "cc.TileMapAtlas"; g_typeCast["TileMapAtlas"] = "cc.TileMapAtlas";
return 1; return 1;
} }
int lua_cocos2dx_MotionStreak3D_reset(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_reset'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_reset'", nullptr);
return 0;
}
cobj->reset();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:reset",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_reset'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_setTexture(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_setTexture'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::Texture2D* arg0;
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0, "cc.MotionStreak3D:setTexture");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_setTexture'", nullptr);
return 0;
}
cobj->setTexture(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:setTexture",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_setTexture'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_getTexture(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_getTexture'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_getTexture'", nullptr);
return 0;
}
cocos2d::Texture2D* ret = cobj->getTexture();
object_to_luaval<cocos2d::Texture2D>(tolua_S, "cc.Texture2D",(cocos2d::Texture2D*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:getTexture",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_getTexture'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_tintWithColor(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_tintWithColor'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::Color3B arg0;
ok &= luaval_to_color3b(tolua_S, 2, &arg0, "cc.MotionStreak3D:tintWithColor");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_tintWithColor'", nullptr);
return 0;
}
cobj->tintWithColor(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:tintWithColor",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_tintWithColor'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_getSweepAxis(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_getSweepAxis'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_getSweepAxis'", nullptr);
return 0;
}
const cocos2d::Vec3& ret = cobj->getSweepAxis();
vec3_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:getSweepAxis",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_getSweepAxis'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_setBlendFunc(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_setBlendFunc'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::BlendFunc arg0;
ok &= luaval_to_blendfunc(tolua_S, 2, &arg0, "cc.MotionStreak3D:setBlendFunc");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_setBlendFunc'", nullptr);
return 0;
}
cobj->setBlendFunc(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:setBlendFunc",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_setBlendFunc'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_setStartingPositionInitialized(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_setStartingPositionInitialized'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.MotionStreak3D:setStartingPositionInitialized");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_setStartingPositionInitialized'", nullptr);
return 0;
}
cobj->setStartingPositionInitialized(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:setStartingPositionInitialized",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_setStartingPositionInitialized'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_getBlendFunc(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_getBlendFunc'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_getBlendFunc'", nullptr);
return 0;
}
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
blendfunc_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:getBlendFunc",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_getBlendFunc'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_isStartingPositionInitialized(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_isStartingPositionInitialized'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_isStartingPositionInitialized'", nullptr);
return 0;
}
bool ret = cobj->isStartingPositionInitialized();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:isStartingPositionInitialized",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_isStartingPositionInitialized'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_getStroke(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_getStroke'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_getStroke'", nullptr);
return 0;
}
double ret = cobj->getStroke();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:getStroke",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_getStroke'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_initWithFade(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_initWithFade'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
do{
if (argc == 5) {
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
cocos2d::Color3B arg3;
ok &= luaval_to_color3b(tolua_S, 5, &arg3, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
cocos2d::Texture2D* arg4;
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 6, "cc.Texture2D",&arg4, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
bool ret = cobj->initWithFade(arg0, arg1, arg2, arg3, arg4);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
do{
if (argc == 5) {
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
cocos2d::Color3B arg3;
ok &= luaval_to_color3b(tolua_S, 5, &arg3, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
std::string arg4;
ok &= luaval_to_std_string(tolua_S, 6,&arg4, "cc.MotionStreak3D:initWithFade");
if (!ok) { break; }
bool ret = cobj->initWithFade(arg0, arg1, arg2, arg3, arg4);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:initWithFade",argc, 5);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_initWithFade'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_setSweepAxis(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_setSweepAxis'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::Vec3 arg0;
ok &= luaval_to_vec3(tolua_S, 2, &arg0, "cc.MotionStreak3D:setSweepAxis");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_setSweepAxis'", nullptr);
return 0;
}
cobj->setSweepAxis(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:setSweepAxis",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_setSweepAxis'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_setStroke(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::MotionStreak3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak3D_setStroke'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.MotionStreak3D:setStroke");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_setStroke'", nullptr);
return 0;
}
cobj->setStroke(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:setStroke",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_setStroke'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_create(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.MotionStreak3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 5)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.MotionStreak3D:create");
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.MotionStreak3D:create");
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.MotionStreak3D:create");
if (!ok) { break; }
cocos2d::Color3B arg3;
ok &= luaval_to_color3b(tolua_S, 5, &arg3, "cc.MotionStreak3D:create");
if (!ok) { break; }
cocos2d::Texture2D* arg4;
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 6, "cc.Texture2D",&arg4, "cc.MotionStreak3D:create");
if (!ok) { break; }
cocos2d::MotionStreak3D* ret = cocos2d::MotionStreak3D::create(arg0, arg1, arg2, arg3, arg4);
object_to_luaval<cocos2d::MotionStreak3D>(tolua_S, "cc.MotionStreak3D",(cocos2d::MotionStreak3D*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 5)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.MotionStreak3D:create");
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.MotionStreak3D:create");
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.MotionStreak3D:create");
if (!ok) { break; }
cocos2d::Color3B arg3;
ok &= luaval_to_color3b(tolua_S, 5, &arg3, "cc.MotionStreak3D:create");
if (!ok) { break; }
std::string arg4;
ok &= luaval_to_std_string(tolua_S, 6,&arg4, "cc.MotionStreak3D:create");
if (!ok) { break; }
cocos2d::MotionStreak3D* ret = cocos2d::MotionStreak3D::create(arg0, arg1, arg2, arg3, arg4);
object_to_luaval<cocos2d::MotionStreak3D>(tolua_S, "cc.MotionStreak3D",(cocos2d::MotionStreak3D*)ret);
return 1;
}
} while (0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.MotionStreak3D:create",argc, 5);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_create'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_MotionStreak3D_constructor(lua_State* tolua_S)
{
int argc = 0;
cocos2d::MotionStreak3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak3D_constructor'", nullptr);
return 0;
}
cobj = new cocos2d::MotionStreak3D();
cobj->autorelease();
int ID = (int)cobj->_ID ;
int* luaID = &cobj->_luaID ;
toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"cc.MotionStreak3D");
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak3D:MotionStreak3D",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak3D_constructor'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_MotionStreak3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (MotionStreak3D)");
return 0;
}
int lua_register_cocos2dx_MotionStreak3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.MotionStreak3D");
tolua_cclass(tolua_S,"MotionStreak3D","cc.MotionStreak3D","cc.Node",nullptr);
tolua_beginmodule(tolua_S,"MotionStreak3D");
tolua_function(tolua_S,"new",lua_cocos2dx_MotionStreak3D_constructor);
tolua_function(tolua_S,"reset",lua_cocos2dx_MotionStreak3D_reset);
tolua_function(tolua_S,"setTexture",lua_cocos2dx_MotionStreak3D_setTexture);
tolua_function(tolua_S,"getTexture",lua_cocos2dx_MotionStreak3D_getTexture);
tolua_function(tolua_S,"tintWithColor",lua_cocos2dx_MotionStreak3D_tintWithColor);
tolua_function(tolua_S,"getSweepAxis",lua_cocos2dx_MotionStreak3D_getSweepAxis);
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_MotionStreak3D_setBlendFunc);
tolua_function(tolua_S,"setStartingPositionInitialized",lua_cocos2dx_MotionStreak3D_setStartingPositionInitialized);
tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_MotionStreak3D_getBlendFunc);
tolua_function(tolua_S,"isStartingPositionInitialized",lua_cocos2dx_MotionStreak3D_isStartingPositionInitialized);
tolua_function(tolua_S,"getStroke",lua_cocos2dx_MotionStreak3D_getStroke);
tolua_function(tolua_S,"initWithFade",lua_cocos2dx_MotionStreak3D_initWithFade);
tolua_function(tolua_S,"setSweepAxis",lua_cocos2dx_MotionStreak3D_setSweepAxis);
tolua_function(tolua_S,"setStroke",lua_cocos2dx_MotionStreak3D_setStroke);
tolua_function(tolua_S,"create", lua_cocos2dx_MotionStreak3D_create);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::MotionStreak3D).name();
g_luaType[typeName] = "cc.MotionStreak3D";
g_typeCast["MotionStreak3D"] = "cc.MotionStreak3D";
return 1;
}
TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
{ {
tolua_open(tolua_S); tolua_open(tolua_S);
@ -94613,6 +95425,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
lua_register_cocos2dx_EventListenerTouchOneByOne(tolua_S); lua_register_cocos2dx_EventListenerTouchOneByOne(tolua_S);
lua_register_cocos2dx_ParticleRain(tolua_S); lua_register_cocos2dx_ParticleRain(tolua_S);
lua_register_cocos2dx_Waves(tolua_S); lua_register_cocos2dx_Waves(tolua_S);
lua_register_cocos2dx_MotionStreak3D(tolua_S);
lua_register_cocos2dx_EaseOut(tolua_S); lua_register_cocos2dx_EaseOut(tolua_S);
lua_register_cocos2dx_MenuItemFont(tolua_S); lua_register_cocos2dx_MenuItemFont(tolua_S);
lua_register_cocos2dx_TransitionFadeUp(tolua_S); lua_register_cocos2dx_TransitionFadeUp(tolua_S);

View File

@ -2089,6 +2089,22 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -234,6 +234,8 @@
"cocos/3d/CCMeshSkin.h", "cocos/3d/CCMeshSkin.h",
"cocos/3d/CCMeshVertexIndexData.cpp", "cocos/3d/CCMeshVertexIndexData.cpp",
"cocos/3d/CCMeshVertexIndexData.h", "cocos/3d/CCMeshVertexIndexData.h",
"cocos/3d/CCMotionStreak3D.cpp",
"cocos/3d/CCMotionStreak3D.h",
"cocos/3d/CCOBB.cpp", "cocos/3d/CCOBB.cpp",
"cocos/3d/CCOBB.h", "cocos/3d/CCOBB.h",
"cocos/3d/CCObjLoader.cpp", "cocos/3d/CCObjLoader.cpp",

View File

@ -27,6 +27,7 @@
#include "DrawNode3D.h" #include "DrawNode3D.h"
#include "2d/CCCameraBackgroundBrush.h" #include "2d/CCCameraBackgroundBrush.h"
#include "3d/CCSprite3DMaterial.h" #include "3d/CCSprite3DMaterial.h"
#include "3d/CCMotionStreak3D.h"
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h" #include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
@ -65,6 +66,7 @@ Sprite3DTests::Sprite3DTests()
ADD_TEST_CASE(Animate3DCallbackTest); ADD_TEST_CASE(Animate3DCallbackTest);
ADD_TEST_CASE(CameraBackgroundClearTest); ADD_TEST_CASE(CameraBackgroundClearTest);
ADD_TEST_CASE(Sprite3DVertexColorTest); ADD_TEST_CASE(Sprite3DVertexColorTest);
ADD_TEST_CASE(MotionStreak3DTest);
}; };
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -2470,3 +2472,47 @@ std::string CameraBackgroundClearTest::subtitle() const
{ {
return ""; return "";
} }
MotionStreak3DTest::MotionStreak3DTest()
{
auto s = Director::getInstance()->getWinSize();
auto camera = Camera::createPerspective(40, s.width / s.height, 0.01f, 1000.f);
camera->setCameraFlag(CameraFlag::USER1);
camera->setPosition3D(Vec3(0.f, 50.f, 200.f));
camera->lookAt(Vec3(0.f, 0.f, 0.f));
addChild(camera);
auto sprite = Sprite3D::create("Sprite3DTest/orc.c3b");
sprite->setPosition(20.f, 0.f);
addChild(sprite);
auto streak = MotionStreak3D::create(1.0f, 1.0f, 5.f, Color3B(255, 255, 0), "Images/Icon.png");
addChild(streak);
setCameraMask(2);
_sprite = sprite;
_streak = streak;
scheduleUpdate();
}
std::string MotionStreak3DTest::title() const
{
return "MotionStreak3D Test";
}
std::string MotionStreak3DTest::subtitle() const
{
return "";
}
void MotionStreak3DTest::update(float delta)
{
static float t = 0;
t += delta;
float angle = t * M_PI;
float r = 20.f;
_sprite->setPosition3D(Vec3(r * cosf(angle), 0, r * sinf(angle)));
_streak->setPosition3D(_sprite->getPosition3D());
_streak->setSweepAxis(Vec3(cosf(angle), 0, sinf(angle)));
}

View File

@ -35,6 +35,7 @@ namespace cocos2d {
class Ray; class Ray;
class DrawNode3D; class DrawNode3D;
class GLProgramState; class GLProgramState;
class MotionStreak3D;
} }
DEFINE_TEST_SUITE(Sprite3DTests); DEFINE_TEST_SUITE(Sprite3DTests);
@ -568,4 +569,18 @@ protected:
#endif #endif
}; };
class MotionStreak3DTest : public Sprite3DTestDemo
{
public:
CREATE_FUNC(MotionStreak3DTest);
MotionStreak3DTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void update(float delta) override;
protected:
cocos2d::Sprite3D* _sprite;
cocos2d::MotionStreak3D* _streak;
};
#endif #endif

View File

@ -512,6 +512,38 @@ var S9FrameNameSpriteSheetRotatedInsetsScaled = S9SpriteTestDemo.extend({
} }
}); });
var S9SpriteActionTest = S9SpriteTestDemo.extend({
_title:"Scale9Sprite from sprite sheet",
_subtitle:"Test Action for ccui.scale9Sprite : Rotate + Scale + Translate",
ctor:function() {
this._super();
var blocks = new cc.Scale9Sprite('blocks9.png');
blocks.x = winSize.width / 2;
blocks.y = winSize.height / 2;
this.addChild(blocks);
var delay = cc.delayTime(0.25);
var rotateBy = cc.rotateBy(2, 360);
var rotateByBack = rotateBy.reverse();
var ScaleTo = cc.scaleTo(2, -0.44, 0.47);
var ScaleToBack = cc.scaleTo(2, 1.0, 1.0);
var moveBy = cc.moveBy(1, cc.p(80, 80));
var moveByBack = moveBy.reverse();
blocks.runAction(cc.sequence(rotateBy, delay, rotateByBack));
blocks.runAction(cc.sequence(ScaleTo, delay.clone(), ScaleToBack));
blocks.runAction(cc.sequence(moveBy,moveByBack));
}
});
var S9SpriteTestScene = TestScene.extend({ var S9SpriteTestScene = TestScene.extend({
runThisTest:function (num) { runThisTest:function (num) {
sceneIdx = (num || num == 0) ? (num - 1) : -1; sceneIdx = (num || num == 0) ? (num - 1) : -1;
@ -538,7 +570,8 @@ var arrayOfS9SpriteTest = [
S9FrameNameSpriteSheetInsetsScaled, S9FrameNameSpriteSheetInsetsScaled,
S9FrameNameSpriteSheetRotatedInsets, S9FrameNameSpriteSheetRotatedInsets,
S9FrameNameSpriteSheetRotatedInsetsScaled, S9FrameNameSpriteSheetRotatedInsetsScaled,
S9_TexturePacker S9_TexturePacker,
S9SpriteActionTest
]; ];
var nextS9SpriteTest = function () { var nextS9SpriteTest = function () {