This commit is contained in:
flamefox 2015-02-03 13:49:40 +08:00
commit c195e1f88a
96 changed files with 3021 additions and 396 deletions

View File

@ -4,19 +4,23 @@ cocos2d-x-3.4 xxx
[FIX] C++: may crash if VAO is not supported
[FIX] EditBox: content is not clipped correctly on windows
[FIX] GLProgram: will cause crash on some devices that don't support more than 8 atrributes
[FIX] HttpClient: not set response code when connecting failed on Android
[FIX] Label: alpha channel of text color of system font has not effect
[FIX] Label: use int for dimensions that will lose the precision
[FIX] Label: labels will become white block after resume from background on some Android devices, such as xiaomi3
[FIX] Label: improved parsing performance of bitmap font
[FIX] Label: can not display `&` if using system font on windows
[FIX] Lua-binding:studio-support: AnimationInfo is not binded
[FIX] New audio: not close file descriptor leads to that may causes game freeze if playing two many times(may be more than 1000) on Android
[FIX] Node: anchor point has not effect to rotation, it always rotate along (0, 0)
[FIX] Physics integration: Scale9Sprite can't run `Move` action and `Scale` action if used physical scene
[FIX] SpriteFrameCache: `addSpriteFramesWithFil`e may crash if plist file doesn't exist
[FIX] Sprite3D: material files (.mtl) are not loaded for any object when creating from an .obj file
[FIX] UI::ImageView: rendered content size is wrong if `ignoreSize` is true and `Scale9` is not enabled
[FIX] UI::Slider: when scale9 is enabled, the progress bar's rendering height is wrong
[FIX] UI:Scale9Sprite: some position information will be lost when toggling `Scale9` state
[FIX] UI::TextField: will get wrong event message if clicking `TextField` twice
[FIX] UI::TextField: result of `getContentSize` is wrong if it is invoked in insert or delete event callback
[FIX] UI::WebView: base URL can not work
cocos2d-x-3.4rc1 Jan.15 2015

View File

@ -91,13 +91,6 @@ Camera::~Camera()
}
void Camera::setPosition3D(const Vec3& position)
{
Node::setPosition3D(position);
_transformUpdated = _transformDirty = _inverseDirty = true;
}
const Mat4& Camera::getProjectionMatrix() const
{
return _projection;

View File

@ -102,10 +102,6 @@ public:
/**get & set Camera flag*/
CameraFlag getCameraFlag() const { return (CameraFlag)_cameraFlag; }
void setCameraFlag(CameraFlag flag) { _cameraFlag = (unsigned short)flag; }
/**
* Sets the position (X, Y, and Z) in its parent's coordinate system
*/
virtual void setPosition3D(const Vec3& position) override;
/**
* Make Camera looks at target

View File

@ -219,6 +219,7 @@ void ClippingNode::drawFullScreenQuadClearStencil()
glProgram->setUniformsForBuiltins();
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
glBindBuffer(GL_ARRAY_BUFFER, 0);
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);

View File

@ -274,6 +274,8 @@ bool DrawNode::init()
glGenBuffers(1, &_vboGLPoint);
glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint);
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
CHECK_GL_ERROR_DEBUG();

View File

@ -126,6 +126,7 @@ Node::Node(void)
, _physicsScaleStartY(1.0f)
, _physicsRotation(0.0f)
, _physicsTransformDirty(true)
, _updateTransformFromPhysics(true)
#endif
, _displayedOpacity(255)
, _realOpacity(255)
@ -330,6 +331,11 @@ void Node::setRotation(float rotation)
_rotationZ_X = _rotationZ_Y = rotation;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
}
#endif
updateRotationQuat();
}
@ -466,6 +472,11 @@ void Node::setScale(float scale)
_scaleX = _scaleY = _scaleZ = scale;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
}
#endif
}
/// scaleX getter
@ -483,6 +494,11 @@ void Node::setScale(float scaleX,float scaleY)
_scaleX = scaleX;
_scaleY = scaleY;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
}
#endif
}
/// scaleX setter
@ -493,6 +509,11 @@ void Node::setScaleX(float scaleX)
_scaleX = scaleX;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
}
#endif
}
/// scaleY getter
@ -532,6 +553,11 @@ void Node::setScaleY(float scaleY)
_scaleY = scaleY;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
}
#endif
}
@ -563,6 +589,11 @@ void Node::setPosition(float x, float y)
_transformUpdated = _transformDirty = _inverseDirty = true;
_usingNormalizedPosition = false;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
}
#endif
}
void Node::setPosition3D(const Vec3& position)
@ -609,10 +640,6 @@ void Node::setPositionZ(float positionZ)
_transformUpdated = _transformDirty = _inverseDirty = true;
_positionZ = positionZ;
// FIXME: BUG
// Global Z Order should based on the modelViewTransform
setGlobalZOrder(positionZ);
}
/// position getter
@ -631,6 +658,11 @@ void Node::setNormalizedPosition(const Vec2& position)
_usingNormalizedPosition = true;
_normalizedPositionDirty = true;
_transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody && _physicsBody->getWorld()) {
_physicsBody->getWorld()->_updateBodyTransform = true;
}
#endif
}
ssize_t Node::getChildrenCount() const
@ -1271,8 +1303,15 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl
if(flags & FLAGS_DIRTY_MASK)
_modelViewTransform = this->transform(parentTransform);
#if CC_USE_PHYSICS
if (_updateTransformFromPhysics) {
_transformUpdated = false;
_contentSizeDirty = false;
}
#else
_transformUpdated = false;
_contentSizeDirty = false;
#endif
return flags;
}
@ -2021,7 +2060,7 @@ void Node::setPhysicsBody(PhysicsBody* body)
}
}
void Node::updatePhysicsBodyTransform(Scene* scene, const Mat4& parentTransform, uint32_t parentFlags, float parentScaleX, float parentScaleY)
void Node::updatePhysicsBodyTransform(const Mat4& parentTransform, uint32_t parentFlags, float parentScaleX, float parentScaleY)
{
_updateTransformFromPhysics = false;
auto flags = processParentFlags(parentTransform, parentFlags);
@ -2046,7 +2085,7 @@ void Node::updatePhysicsBodyTransform(Scene* scene, const Mat4& parentTransform,
for (auto node : _children)
{
node->updatePhysicsBodyTransform(scene, _modelViewTransform, flags, scaleX, scaleY);
node->updatePhysicsBodyTransform(_modelViewTransform, flags, scaleX, scaleY);
}
}

View File

@ -1122,7 +1122,7 @@ public:
*
* @return An Action pointer
*/
Action* runAction(Action* action);
virtual Action* runAction(Action* action);
/**
* Stops and removes all actions from the running action list .
@ -1543,7 +1543,7 @@ public:
void updateTransformFromPhysics(const Mat4& parentTransform, uint32_t parentFlags);
virtual void updatePhysicsBodyTransform(Scene* scene, const Mat4& parentTransform, uint32_t parentFlags, float parentScaleX, float parentScaleY);
virtual void updatePhysicsBodyTransform(const Mat4& parentTransform, uint32_t parentFlags, float parentScaleX, float parentScaleY);
#endif
// overrides

View File

@ -144,7 +144,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -162,7 +162,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -180,7 +180,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -198,7 +198,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -216,7 +216,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -234,7 +234,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -106,7 +106,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -124,7 +124,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -142,7 +142,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -160,7 +160,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -93,7 +93,7 @@
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\jpeg\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\tiff\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\png\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zm256 /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
<Link>
@ -114,7 +114,7 @@
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\jpeg\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\tiff\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\png\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zm256 /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
<Link>
@ -135,7 +135,7 @@
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\jpeg\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\tiff\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\png\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zm256 /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
<Link>
@ -156,7 +156,7 @@
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\jpeg\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\tiff\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\png\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zm256 /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
<Link>

View File

@ -102,6 +102,9 @@ void BillBoard::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t
{
return;
}
bool visibleByCamera = isVisitableByVisitingCamera();
if (!visibleByCamera && _children.empty())
return;
uint32_t flags = processParentFlags(parentTransform, parentFlags);
@ -119,7 +122,7 @@ void BillBoard::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
bool visibleByCamera = isVisitableByVisitingCamera();
int i = 0;
@ -158,7 +161,7 @@ bool BillBoard::calculateBillbaordTransform()
const Mat4& camWorldMat = camera->getNodeToWorldTransform();
//TODO: use math lib to calculate math lib Make it easier to read and maintain
if (memcmp(_camWorldMat.m, camWorldMat.m, sizeof(float) * 16) != 0 || _transformDirty || _modeDirty)
if (memcmp(_camWorldMat.m, camWorldMat.m, sizeof(float) * 16) != 0 || memcmp(_mvTransform.m, _modelViewTransform.m, sizeof(float) * 16) != 0 || _modeDirty || true)
{
//Rotate based on anchor point
Vec3 anchorPoint(_anchorPointInPoints.x , _anchorPointInPoints.y , 0.0f);
@ -190,12 +193,8 @@ bool BillBoard::calculateBillbaordTransform()
Quaternion rotationQuaternion;
this->getNodeToWorldTransform().getRotation(&rotationQuaternion);
// fetch the rotation angle of z
float rotationZ = atan2(2*(rotationQuaternion.w*rotationQuaternion.z + rotationQuaternion.x*rotationQuaternion.y),
(1 - 2* (rotationQuaternion.y*rotationQuaternion.y + rotationQuaternion.z *rotationQuaternion.z)));
Mat4 rotationMatrix;
rotationMatrix.setIdentity();
rotationMatrix.rotateZ(rotationZ);
Vec3 upAxis = Vec3(rotationMatrix.m[4],rotationMatrix.m[5],rotationMatrix.m[6]);
Vec3 x, y;
@ -217,7 +216,7 @@ bool BillBoard::calculateBillbaordTransform()
billboardTransform.m[12] = localToWorld.m[12]; billboardTransform.m[13] = localToWorld.m[13]; billboardTransform.m[14] = localToWorld.m[14];
billboardTransform.translate(-anchorPoint);
_modelViewTransform = billboardTransform;
_mvTransform = _modelViewTransform = billboardTransform;
_camWorldMat = camWorldMat;

View File

@ -105,6 +105,7 @@ protected:
bool calculateBillbaordTransform();
Mat4 _camWorldMat;
Mat4 _mvTransform;
Mode _mode;
bool _modeDirty;

View File

@ -289,7 +289,7 @@ std::string LoadMtl ( std::map<std::string, ObjLoader::material_t>& material_map
filepath = std::string(filename);
}
std::ifstream ifs(filepath.c_str());
std::istringstream ifs(FileUtils::getInstance()->getStringFromFile(filepath));
if (!ifs)
{
err << "Cannot open file [" << filepath << "]" << std::endl;

View File

@ -741,6 +741,10 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
}
//support tint and fade
meshCommand.setDisplayColor(Vec4(color.r, color.g, color.b, color.a));
if (_forceDepthWrite)
{
meshCommand.setDepthWriteEnabled(true);
}
meshCommand.setTransparent(isTransparent);
renderer->addCommand(&meshCommand);
}
@ -801,6 +805,12 @@ const AABB& Sprite3D::getAABB() const
return _aabb;
}
Action* Sprite3D::runAction(Action *action)
{
setForceDepthWrite(true);
return Node::runAction(action);
}
Rect Sprite3D::getBoundingBox() const
{
AABB aabb = getAABB();

View File

@ -126,6 +126,22 @@ public:
*/
const AABB& getAABB() const;
/**
* Executes an action, and returns the action that is executed. For Sprite3D special logic are needed to take care of Fading.
*
* This node becomes the action's target. Refer to Action::getTarget()
* @warning Actions don't retain their target.
*
* @return An Action pointer
*/
virtual Action* runAction(Action* action) override;
/**
* Force to write to depth buffer, this is useful if you want to achieve effects like fading.
*/
void setForceDepthWrite(bool value) { _forceDepthWrite = value; }
bool isForceDepthWrite() const { return _forceDepthWrite;};
/**
* Returns 2d bounding-box
* Note: the bouding-box is just get from the AABB which as Z=0, so that is not very accurate.
@ -200,6 +216,7 @@ protected:
bool _aabbDirty;
unsigned int _lightMask;
bool _shaderUsingLight; // is current shader using light ?
bool _forceDepthWrite; // Always write to depth buffer
struct AsyncLoadParam
{

View File

@ -300,6 +300,12 @@ void Director::drawScene()
_runningScene->render(_renderer);
_eventDispatcher->dispatchEvent(_eventAfterVisit);
#if CC_USE_PHYSICS
if(physicsWorld)
{
physicsWorld->_updateBodyTransform = false;
}
#endif
}
// draw the notifications node

View File

@ -311,9 +311,9 @@ void Scheduler::schedule(const ccSchedulerFunc& callback, void *target, float in
{
for (int i = 0; i < element->timers->num; ++i)
{
TimerTargetCallback *timer = static_cast<TimerTargetCallback*>(element->timers->arr[i]);
TimerTargetCallback *timer = dynamic_cast<TimerTargetCallback*>(element->timers->arr[i]);
if (key == timer->getKey())
if (timer && key == timer->getKey())
{
CCLOG("CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f", timer->getInterval(), interval);
timer->setInterval(interval);
@ -1012,9 +1012,9 @@ void Scheduler::schedule(SEL_SCHEDULE selector, Ref *target, float interval, uns
{
for (int i = 0; i < element->timers->num; ++i)
{
TimerTargetSelector *timer = static_cast<TimerTargetSelector*>(element->timers->arr[i]);
TimerTargetSelector *timer = dynamic_cast<TimerTargetSelector*>(element->timers->arr[i]);
if (selector == timer->getSelector())
if (timer && selector == timer->getSelector())
{
CCLOG("CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f", timer->getInterval(), interval);
timer->setInterval(interval);

View File

@ -182,6 +182,10 @@ ActionTimeline* ActionTimeline::clone() const
}
}
for( auto info : _animationInfos)
{
newAction->addAnimationInfo(info.second);
}
return newAction;
}

View File

@ -33,6 +33,13 @@ NS_TIMELINE_BEGIN
struct AnimationInfo
{
AnimationInfo():startIndex(0),endIndex(0){}
AnimationInfo(const std::string& otherName, int otherStartIndex, int otherEndIndex)
:name(otherName),
startIndex(otherStartIndex),
endIndex(otherEndIndex)
{
}
std::string name;
int startIndex;
int endIndex;

View File

@ -481,6 +481,9 @@ InnerActionFrame::InnerActionFrame()
void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
{
auto innerActiontimeline = static_cast<ActionTimeline*>(_node->getActionByTag(_node->getTag()));
if( nullptr == innerActiontimeline)
return;
if (InnerActionType::SingleFrame == _innerActionType)
{
innerActiontimeline->gotoFrameAndPause(_singleFrameIndex);

View File

@ -833,19 +833,22 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree)
auto projectNodeOptions = (ProjectNodeOptions*)options->data();
std::string filePath = projectNodeOptions->fileName()->c_str();
CCLOG("filePath = %s", filePath.c_str());
cocostudio::timeline::ActionTimeline* action = nullptr;
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
{
node = createNodeWithFlatBuffersFile(filePath);
reader->setPropsWithFlatBuffers(node, options->data());
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
if (action)
{
node->runAction(action);
action->gotoFrameAndPause(0);
}
action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
}
else
{
node = Node::create();
}
reader->setPropsWithFlatBuffers(node, options->data());
if (action)
{
node->runAction(action);
action->gotoFrameAndPause(0);
}
}
else if (classname == "SimpleAudio")
@ -1164,17 +1167,21 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
std::string filePath = projectNodeOptions->fileName()->c_str();
CCLOG("filePath = %s", filePath.c_str());
cocostudio::timeline::ActionTimeline* action = nullptr;
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
{
node = createNodeWithFlatBuffersForSimulator(filePath);
reader->setPropsWithFlatBuffers(node, options->data());
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator(filePath);
if (action)
{
node->runAction(action);
action->gotoFrameAndPause(0);
}
action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator(filePath);
}
else
{
node = Node::create();
}
reader->setPropsWithFlatBuffers(node, options->data());
if (action)
{
node->runAction(action);
action->gotoFrameAndPause(0);
}
}
else if (classname == "SimpleAudio")

View File

@ -267,6 +267,8 @@ namespace cocostudio
auto widgetReader = WidgetReader::getInstance();
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
labelAtlas->ignoreContentAdaptWithSize(true);
}
Node* TextAtlasReader::createNodeWithFlatBuffers(const flatbuffers::Table *textAtlasOptions)

View File

@ -241,6 +241,8 @@ namespace cocostudio
auto widgetReader = WidgetReader::getInstance();
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
labelBMFont->ignoreContentAdaptWithSize(true);
}
Node* TextBMFontReader::createNodeWithFlatBuffers(const flatbuffers::Table *textBMFontOptions)

View File

@ -687,6 +687,7 @@ static void processResponse(HttpResponse* response, std::string& responseMessage
{
response->setSucceed(false);
response->setErrorBuffer("connect failed");
response->setResponseCode(responseCode);
return;
}

View File

@ -334,7 +334,7 @@ void PhysicsWorld::rayCast(PhysicsRayCastCallbackFunc func, const Vec2& point1,
{
if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty())
{
_scene->updatePhysicsBodyTransform(_scene, _scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
_scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
updateBodies();
}
RayCastCallbackInfo info = { this, func, point1, point2, data };
@ -358,7 +358,7 @@ void PhysicsWorld::queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect
{
if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty())
{
_scene->updatePhysicsBodyTransform(_scene, _scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
_scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
updateBodies();
}
RectQueryCallbackInfo info = {this, func, data};
@ -381,7 +381,7 @@ void PhysicsWorld::queryPoint(PhysicsQueryPointCallbackFunc func, const Vec2& po
{
if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty())
{
_scene->updatePhysicsBodyTransform(_scene, _scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
_scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
updateBodies();
}
PointQueryCallbackInfo info = {this, func, data};
@ -823,9 +823,13 @@ void PhysicsWorld::update(float delta, bool userCall/* = false*/)
return;
}
_scene->updatePhysicsBodyTransform(_scene, _scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty())
if(_updateBodyTransform || !_delayAddBodies.empty())
{
_scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f);
updateBodies();
_updateBodyTransform = false;
}
else if (!_delayRemoveBodies.empty())
{
updateBodies();
}
@ -880,6 +884,7 @@ PhysicsWorld::PhysicsWorld()
, _autoStep(true)
, _debugDraw(nullptr)
, _debugDrawMask(DEBUGDRAW_NONE)
, _updateBodyTransform(false)
{
}

View File

@ -204,6 +204,7 @@ protected:
int _substeps;
cpSpace* _cpSpace;
bool _updateBodyTransform;
Vector<PhysicsBody*> _bodies;
std::list<PhysicsJoint*> _joints;
Scene* _scene;

View File

@ -246,6 +246,7 @@ public:
{
int nRet = 0;
wchar_t * pwszBuffer = 0;
wchar_t* fixedText = nullptr;
do
{
CC_BREAK_IF(! pszText);
@ -276,7 +277,37 @@ public:
memset(pwszBuffer, 0, sizeof(wchar_t)*nBufLen);
nLen = MultiByteToWideChar(CP_UTF8, 0, pszText, nLen, pwszBuffer, nBufLen);
SIZE newSize = sizeWithText(pwszBuffer, nLen, dwFmt, tSize.cx);
if (strchr(pszText, '&'))
{
fixedText = new wchar_t[nLen * 2 + 1];
int fixedIndex = 0;
for (int index = 0; index < nLen; ++index)
{
if (pwszBuffer[index] == '&')
{
fixedText[fixedIndex] = '&';
fixedText[fixedIndex + 1] = '&';
fixedIndex += 2;
}
else
{
fixedText[fixedIndex] = pwszBuffer[index];
fixedIndex += 1;
}
}
fixedText[fixedIndex] = '\0';
nLen = fixedIndex;
}
SIZE newSize;
if (fixedText)
{
newSize = sizeWithText(fixedText, nLen, dwFmt, tSize.cx);
}
else
{
newSize = sizeWithText(pwszBuffer, nLen, dwFmt, tSize.cx);
}
RECT rcText = {0};
// if content width is 0, use text size as content size
@ -343,13 +374,23 @@ public:
SetTextColor(_DC, RGB(255, 255, 255)); // white color
// draw text
nRet = DrawTextW(_DC, pwszBuffer, nLen, &rcText, dwFmt);
if (fixedText)
{
nRet = DrawTextW(_DC, fixedText, nLen, &rcText, dwFmt);
}
else
{
nRet = DrawTextW(_DC, pwszBuffer, nLen, &rcText, dwFmt);
}
//DrawTextA(_DC, pszText, nLen, &rcText, dwFmt);
SelectObject(_DC, hOldBmp);
SelectObject(_DC, hOldFont);
} while (0);
CC_SAFE_DELETE_ARRAY(pwszBuffer);
delete[] fixedText;
return nRet;
}

View File

@ -163,7 +163,7 @@ GLProgram::~GLProgram()
for (auto e : _hashForUniforms)
{
free(e.second);
free(e.second.first);
}
_hashForUniforms.clear();
}
@ -666,17 +666,24 @@ bool GLProgram::updateUniformLocation(GLint location, const GLvoid* data, unsign
{
GLvoid* value = malloc(bytes);
memcpy(value, data, bytes );
_hashForUniforms.insert(std::make_pair(location, value));
_hashForUniforms.insert(std::make_pair(location, std::make_pair(value, bytes)));
}
else
{
if (memcmp(element->second, data, bytes) == 0)
if (memcmp(element->second.first, data, bytes) == 0)
{
updated = false;
}
else
{
memcpy(element->second, data, bytes);
if (element->second.second < bytes)
{
GLvoid* value = realloc(element->second.first, bytes);
memcpy(value, data, bytes );
_hashForUniforms[location] = std::make_pair(value, bytes);
}
else
memcpy(element->second.first, data, bytes);
}
}
@ -937,7 +944,7 @@ void GLProgram::reset()
for (auto e: _hashForUniforms)
{
free(e.second);
free(e.second.first);
}
_hashForUniforms.clear();

View File

@ -361,7 +361,7 @@ protected:
std::unordered_map<std::string, Uniform> _userUniforms;
std::unordered_map<std::string, VertexAttrib> _vertexAttribs;
std::unordered_map<GLint, GLvoid*> _hashForUniforms;
std::unordered_map<GLint, std::pair<GLvoid*, unsigned int>> _hashForUniforms;
//cached director pointer for calling
Director* _director;
};

View File

@ -42,12 +42,6 @@
NS_CC_BEGIN
//render state
static bool s_cullFaceEnabled = false;
static GLenum s_cullFace = 0;
static bool s_depthTestEnabled = false;
static bool s_depthWriteEnabled = false;
static const char *s_dirLightUniformColorName = "u_DirLightSourceColor";
static std::vector<Vec3> s_dirLightUniformColorValues;
static const char *s_dirLightUniformDirName = "u_DirLightSourceDirection";
@ -89,6 +83,10 @@ MeshCommand::MeshCommand()
, _cullFace(GL_BACK)
, _depthTestEnabled(false)
, _depthWriteEnabled(false)
, _forceDepthWrite(false)
, _renderStateCullFace(false)
, _renderStateDepthTest(false)
, _renderStateDepthWrite(GL_FALSE)
, _lightMask(-1)
{
_type = RenderCommand::Type::MESH_COMMAND;
@ -159,6 +157,7 @@ void MeshCommand::setDepthTestEnabled(bool enable)
void MeshCommand::setDepthWriteEnabled(bool enable)
{
_forceDepthWrite = enable;
_depthWriteEnabled = enable;
}
@ -172,7 +171,15 @@ void MeshCommand::setTransparent(bool value)
_isTransparent = value;
//Skip batching for transparent mesh
_skipBatching = value;
setDepthWriteEnabled(!_isTransparent);
if (_isTransparent && !_forceDepthWrite)
{
_depthWriteEnabled = false;
}
else
{
_depthWriteEnabled = true;
}
}
MeshCommand::~MeshCommand()
@ -185,46 +192,48 @@ MeshCommand::~MeshCommand()
void MeshCommand::applyRenderState()
{
if (_cullFaceEnabled && !s_cullFaceEnabled)
_renderStateCullFace = glIsEnabled(GL_CULL_FACE);
_renderStateDepthTest = glIsEnabled(GL_DEPTH_TEST);
glGetBooleanv(GL_DEPTH_WRITEMASK, &_renderStateDepthWrite);
if (_cullFaceEnabled && !_renderStateCullFace)
{
glEnable(GL_CULL_FACE);
s_cullFaceEnabled = true;
}
if (s_cullFace != _cullFace)
{
glCullFace(_cullFace);
s_cullFace = _cullFace;
}
if (_depthTestEnabled && !s_depthTestEnabled)
glCullFace(_cullFace);
if (_depthTestEnabled && !_renderStateDepthTest)
{
glEnable(GL_DEPTH_TEST);
s_depthTestEnabled = true;
}
if (_depthWriteEnabled && !s_depthWriteEnabled)
if (_depthWriteEnabled && !_renderStateDepthWrite)
{
glDepthMask(GL_TRUE);
s_depthWriteEnabled = true;
}
}
void MeshCommand::restoreRenderState()
{
if (s_cullFaceEnabled)
if (_renderStateCullFace)
{
glEnable(GL_CULL_FACE);
}
else
{
glDisable(GL_CULL_FACE);
s_cullFaceEnabled = false;
}
if (s_depthTestEnabled)
if (_renderStateDepthTest)
{
glEnable(GL_DEPTH_TEST);
}
else
{
glDisable(GL_DEPTH_TEST);
s_depthTestEnabled = false;
}
if (s_depthWriteEnabled)
{
glDepthMask(GL_FALSE);
s_depthWriteEnabled = false;
}
s_cullFace = 0;
glDepthMask(_renderStateDepthTest);
}
void MeshCommand::genMaterialID(GLuint texID, void* glProgramState, GLuint vertexBuffer, GLuint indexBuffer, const BlendFunc& blend)

View File

@ -127,6 +127,11 @@ protected:
GLenum _cullFace;
bool _depthTestEnabled;
bool _depthWriteEnabled;
bool _forceDepthWrite;
bool _renderStateCullFace;
bool _renderStateDepthTest;
GLboolean _renderStateDepthWrite;
// ModelView transform
Mat4 _mv;

View File

@ -35,6 +35,7 @@ RenderCommand::RenderCommand()
, _isTransparent(true)
, _skipBatching(false)
, _is3D(false)
, _depth(0)
{
}
@ -44,14 +45,16 @@ RenderCommand::~RenderCommand()
void RenderCommand::init(float globalZOrder, const cocos2d::Mat4 &transform, uint32_t flags)
{
_globalOrder = globalZOrder;
if (flags & Node::FLAGS_RENDER_AS_3D)
{
_globalOrder = Camera::getVisitingCamera()->getDepthInView(transform);
_depth = Camera::getVisitingCamera()->getDepthInView(transform);
set3D(true);
}
else
{
_globalOrder = globalZOrder;
set3D(false);
_depth = 0;
}
}

View File

@ -78,6 +78,8 @@ public:
inline void set3D(bool value) { _is3D = value; }
inline float getDepth() const { return _depth; }
protected:
RenderCommand();
virtual ~RenderCommand();
@ -98,6 +100,9 @@ protected:
// is the command been rendered on 3D pass
bool _is3D;
// depth
float _depth;
};
NS_CC_END

View File

@ -53,7 +53,7 @@ static bool compareRenderCommand(RenderCommand* a, RenderCommand* b)
static bool compare3DCommand(RenderCommand* a, RenderCommand* b)
{
return a->getGlobalOrder() > b->getGlobalOrder();
return a->getDepth() > b->getDepth();
}
// queue
@ -61,74 +61,113 @@ static bool compare3DCommand(RenderCommand* a, RenderCommand* b)
void RenderQueue::push_back(RenderCommand* command)
{
float z = command->getGlobalOrder();
if(command->is3D())
if(z < 0)
{
if(command->isTransparent())
_commands[QUEUE_GROUP::GLOBALZ_NEG].push_back(command);
}
else if(z > 0)
{
_commands[QUEUE_GROUP::GLOBALZ_POS].push_back(command);
}
else
{
if(command->is3D())
{
_queue3DTransparent.push_back(command);
if(command->isTransparent())
{
_commands[QUEUE_GROUP::TRANSPARENT_3D].push_back(command);
}
else
{
_commands[QUEUE_GROUP::OPAQUE_3D].push_back(command);
}
}
else
{
_queue3DOpaque.push_back(command);
_commands[QUEUE_GROUP::GLOBALZ_ZERO].push_back(command);
}
}
else if(z < 0)
_queueNegZ.push_back(command);
else if(z > 0)
_queuePosZ.push_back(command);
else
_queue0.push_back(command);
}
ssize_t RenderQueue::size() const
{
return _queue3DOpaque.size() + _queue3DTransparent.size() + _queueNegZ.size() + _queue0.size() + _queuePosZ.size();
ssize_t result(0);
for(int index = 0; index < QUEUE_GROUP::QUEUE_COUNT; ++index)
{
result += _commands[index].size();
}
return result;
}
void RenderQueue::sort()
{
// Don't sort _queue0, it already comes sorted
std::sort(std::begin(_queue3DTransparent), std::end(_queue3DTransparent), compare3DCommand);
std::sort(std::begin(_queueNegZ), std::end(_queueNegZ), compareRenderCommand);
std::sort(std::begin(_queuePosZ), std::end(_queuePosZ), compareRenderCommand);
std::sort(std::begin(_commands[QUEUE_GROUP::TRANSPARENT_3D]), std::end(_commands[QUEUE_GROUP::TRANSPARENT_3D]), compare3DCommand);
std::sort(std::begin(_commands[QUEUE_GROUP::GLOBALZ_NEG]), std::end(_commands[QUEUE_GROUP::GLOBALZ_NEG]), compareRenderCommand);
std::sort(std::begin(_commands[QUEUE_GROUP::GLOBALZ_POS]), std::end(_commands[QUEUE_GROUP::GLOBALZ_POS]), compareRenderCommand);
}
RenderCommand* RenderQueue::operator[](ssize_t index) const
{
if(index < static_cast<ssize_t>(_queue3DOpaque.size()))
return _queue3DOpaque[index];
index -= _queue3DOpaque.size();
if(index < static_cast<ssize_t>(_queue3DTransparent.size()))
return _queue3DTransparent[index];
index -= _queue3DTransparent.size();
if(index < static_cast<ssize_t>(_queueNegZ.size()))
return _queueNegZ[index];
index -= _queueNegZ.size();
if(index < static_cast<ssize_t>(_queue0.size()))
return _queue0[index];
index -= _queue0.size();
if(index < static_cast<ssize_t>(_queuePosZ.size()))
return _queuePosZ[index];
for(int queIndex = 0; queIndex < QUEUE_GROUP::QUEUE_COUNT; ++queIndex)
{
if(index < static_cast<ssize_t>(_commands[queIndex].size()))
return _commands[queIndex][index];
else
{
index -= _commands[queIndex].size();
}
}
CCASSERT(false, "invalid index");
return nullptr;
}
void RenderQueue::clear()
{
_queue3DOpaque.clear();
_queue3DTransparent.clear();
_queueNegZ.clear();
_queue0.clear();
_queuePosZ.clear();
_commands.clear();
for(int index = 0; index < QUEUE_COUNT; ++index)
{
_commands.push_back(std::vector<RenderCommand*>());
}
}
void RenderQueue::saveRenderState()
{
_isDepthEnabled = glIsEnabled(GL_DEPTH_TEST);
_isCullEnabled = glIsEnabled(GL_CULL_FACE);
glGetBooleanv(GL_DEPTH_WRITEMASK, &_isDepthWrite);
CHECK_GL_ERROR_DEBUG();
}
void RenderQueue::restoreRenderState()
{
if (_isCullEnabled)
{
glEnable(GL_CULL_FACE);
}
else
{
glDisable(GL_CULL_FACE);
}
if (_isDepthEnabled)
{
glEnable(GL_DEPTH_TEST);
}
else
{
glDisable(GL_DEPTH_TEST);
}
glDepthMask(_isDepthWrite);
CHECK_GL_ERROR_DEBUG();
}
//
@ -465,48 +504,103 @@ void Renderer::processRenderCommand(RenderCommand* command)
}
}
void Renderer::visitRenderQueue(const RenderQueue& queue)
void Renderer::visitRenderQueue(RenderQueue& queue)
{
ssize_t size = queue.size();
queue.saveRenderState();
//Process Opaque Object
const std::vector<RenderCommand*>& opaqueQueue = queue.getOpaqueCommands();
if (opaqueQueue.size() > 0)
//
//Process Global-Z < 0 Objects
//
const auto& zNegQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_NEG);
if (zNegQueue.size() > 0)
{
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
for (auto it = opaqueQueue.cbegin(); it != opaqueQueue.cend(); ++it) {
if(_isDepthTestFor2D)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
}
else
{
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
}
for (auto it = zNegQueue.cbegin(); it != zNegQueue.cend(); ++it)
{
processRenderCommand(*it);
}
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
flush();
}
flush();
//Setup Transparent rendering
//
//Process Opaque Object
//
const auto& opaqueQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::OPAQUE_3D);
if (opaqueQueue.size() > 0)
{
glEnable(GL_DEPTH_TEST);
}
else
{
glDisable(GL_DEPTH_TEST);
}
if(_isDepthTestFor2D)
{
glEnable(GL_DEPTH_TEST);
//Clear depth to achieve layered rendering
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
for (auto it = opaqueQueue.cbegin(); it != opaqueQueue.cend(); ++it)
{
processRenderCommand(*it);
}
flush();
}
//Process Transparent Object
for (ssize_t index = queue.getOpaqueQueueSize(); index < size; ++index)
//
//Process 3D Transparent object
//
const auto& transQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::TRANSPARENT_3D);
if (transQueue.size() > 0)
{
processRenderCommand(queue[index]);
glEnable(GL_DEPTH_TEST);
glDepthMask(false);
for (auto it = transQueue.cbegin(); it != transQueue.cend(); ++it)
{
processRenderCommand(*it);
}
flush();
}
flush();
//
//Process Global-Z = 0 Queue
//
const auto& zZeroQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_ZERO);
if (zZeroQueue.size() > 0)
{
if(_isDepthTestFor2D)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
}
else
{
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
}
for (auto it = zZeroQueue.cbegin(); it != zZeroQueue.cend(); ++it)
{
processRenderCommand(*it);
}
flush();
}
//
//Process Global-Z > 0 Queue
//
const auto& zPosQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_POS);
if (zPosQueue.size() > 0)
{
for (auto it = zPosQueue.cbegin(); it != zPosQueue.cend(); ++it)
{
processRenderCommand(*it);
}
flush();
}
queue.restoreRenderState();
}
void Renderer::render()

View File

@ -47,22 +47,41 @@ class MeshCommand;
are the ones that have `z < 0` and `z > 0`.
*/
class RenderQueue {
public:
enum QUEUE_GROUP
{
GLOBALZ_NEG = 0,
OPAQUE_3D = 1,
TRANSPARENT_3D = 2,
GLOBALZ_ZERO = 3,
GLOBALZ_POS = 4,
QUEUE_COUNT = 5,
};
public:
RenderQueue()
{
clear();
}
void push_back(RenderCommand* command);
ssize_t size() const;
void sort();
RenderCommand* operator[](ssize_t index) const;
void clear();
ssize_t getOpaqueQueueSize() const { return _queue3DOpaque.size(); }
const std::vector<RenderCommand*>& getOpaqueCommands() const { return _queue3DOpaque; }
inline std::vector<RenderCommand*>& getSubQueue(QUEUE_GROUP group) { return _commands[group]; }
inline ssize_t getSubQueueSize(QUEUE_GROUP group) const { return _commands[group].size();}
void saveRenderState();
void restoreRenderState();
protected:
std::vector<RenderCommand*> _queue3DOpaque;
std::vector<RenderCommand*> _queue3DTransparent;
std::vector<RenderCommand*> _queueNegZ;
std::vector<RenderCommand*> _queue0;
std::vector<RenderCommand*> _queuePosZ;
std::vector<std::vector<RenderCommand*>> _commands;
//Render State related
bool _isCullEnabled;
bool _isDepthEnabled;
GLboolean _isDepthWrite;
};
struct RenderStackElement
@ -162,7 +181,7 @@ protected:
void flushTriangles();
void processRenderCommand(RenderCommand* command);
void visitRenderQueue(const RenderQueue& queue);
void visitRenderQueue(RenderQueue& queue);
void fillVerticesAndIndices(const TrianglesCommand* cmd);
void fillQuads(const QuadCommand* cmd);

View File

@ -14,6 +14,7 @@ include_directories(
${cocos_root}/cocos/ui
${cocos_root}/cocos/2d
${cocos_root}/cocos/3d
${cocos_root}/cocos/base
${cocos_root}/cocos/editor-support/spine
${cocos_root}/cocos/editor-support/cocostudio
${cocos_root}/cocos/editor-support/cocostudio/ActionTimeline

View File

@ -0,0 +1,26 @@
--------------------------------
-- @module AsyncTaskPool
-- @parent_module cc
--------------------------------
-- stop tasks<br>
-- param type task type you want to stop
-- @function [parent=#AsyncTaskPool] stopTasks
-- @param self
-- @param #int type
-- @return AsyncTaskPool#AsyncTaskPool self (return value: cc.AsyncTaskPool)
--------------------------------
-- destroy instance
-- @function [parent=#AsyncTaskPool] destoryInstance
-- @param self
-- @return AsyncTaskPool#AsyncTaskPool self (return value: cc.AsyncTaskPool)
--------------------------------
-- get instance
-- @function [parent=#AsyncTaskPool] getInstance
-- @param self
-- @return AsyncTaskPool#AsyncTaskPool ret (return value: cc.AsyncTaskPool)
return nil

View File

@ -115,11 +115,4 @@
-- @param self
-- @return Camera#Camera ret (return value: cc.Camera)
--------------------------------
-- Sets the position (X, Y, and Z) in its parent's coordinate system
-- @function [parent=#Camera] setPosition3D
-- @param self
-- @param #vec3_table position
-- @return Camera#Camera self (return value: cc.Camera)
return nil

View File

@ -254,6 +254,12 @@
-- @param #vec2_table anchorPoint
-- @return EditBox#EditBox self (return value: ccui.EditBox)
--------------------------------
-- Returns the "class name" of widget.
-- @function [parent=#EditBox] getDescription
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
--
-- @function [parent=#EditBox] setPosition

View File

@ -4,6 +4,12 @@
-- @extend Ref
-- @parent_module cc
--------------------------------
-- get mesh vertex attribute count
-- @function [parent=#Mesh] getMeshVertexAttribCount
-- @param self
-- @return long#long ret (return value: long)
--------------------------------
-- @overload self, cc.Texture2D
-- @overload self, string
@ -31,12 +37,25 @@
-- @param #cc.BlendFunc blendFunc
-- @return Mesh#Mesh self (return value: cc.Mesh)
--------------------------------
-- get per vertex size in bytes
-- @function [parent=#Mesh] getVertexSizeInBytes
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#Mesh] getBlendFunc
-- @param self
-- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc)
--------------------------------
-- get MeshVertexAttribute by index
-- @function [parent=#Mesh] getMeshVertexAttribute
-- @param self
-- @param #int idx
-- @return MeshVertexAttrib#MeshVertexAttrib ret (return value: cc.MeshVertexAttrib)
--------------------------------
--
-- @function [parent=#Mesh] isVisible

View File

@ -4,6 +4,12 @@
-- @extend Node,BlendProtocol
-- @parent_module cc
--------------------------------
--
-- @function [parent=#Sprite3D] isForceDepthWrite
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#Sprite3D] setCullFaceEnabled
@ -90,6 +96,13 @@
-- @param #int index
-- @return Mesh#Mesh ret (return value: cc.Mesh)
--------------------------------
-- Force to write to depth buffer, this is useful if you want to achieve effects like fading.
-- @function [parent=#Sprite3D] setForceDepthWrite
-- @param self
-- @param #bool value
-- @return Sprite3D#Sprite3D self (return value: cc.Sprite3D)
--------------------------------
-- get Mesh by Name, it returns the first one if there are more than one mesh with the same name
-- @function [parent=#Sprite3D] getMeshByName
@ -114,17 +127,6 @@
-- @param #string texturePath
-- @return Sprite3D#Sprite3D ret (return value: cc.Sprite3D)
--------------------------------
-- @overload self, string, string, function, void
-- @overload self, string, function, void
-- @function [parent=#Sprite3D] createAsync
-- @param self
-- @param #string modelPath
-- @param #string texturePath
-- @param #function callback
-- @param #void callbackparam
-- @return Sprite3D#Sprite3D self (return value: cc.Sprite3D)
--------------------------------
-- Returns 2d bounding-box<br>
-- Note: the bouding-box is just get from the AABB which as Z=0, so that is not very accurate.
@ -139,6 +141,16 @@
-- @param #cc.GLProgramState glProgramState
-- @return Sprite3D#Sprite3D self (return value: cc.Sprite3D)
--------------------------------
-- Executes an action, and returns the action that is executed. For Sprite3D special logic are needed to take care of Fading.<br>
-- This node becomes the action's target. Refer to Action::getTarget()<br>
-- warning Actions don't retain their target.<br>
-- return An Action pointer
-- @function [parent=#Sprite3D] runAction
-- @param self
-- @param #cc.Action action
-- @return Action#Action ret (return value: cc.Action)
--------------------------------
-- just rember bind attributes
-- @function [parent=#Sprite3D] setGLProgram

View File

@ -0,0 +1,31 @@
--------------------------------
-- @module Sprite3DCache
-- @parent_module cc
--------------------------------
--
-- @function [parent=#Sprite3DCache] removeSprite3DData
-- @param self
-- @param #string key
-- @return Sprite3DCache#Sprite3DCache self (return value: cc.Sprite3DCache)
--------------------------------
--
-- @function [parent=#Sprite3DCache] removeAllSprite3DData
-- @param self
-- @return Sprite3DCache#Sprite3DCache self (return value: cc.Sprite3DCache)
--------------------------------
--
-- @function [parent=#Sprite3DCache] destroyInstance
-- @param self
-- @return Sprite3DCache#Sprite3DCache self (return value: cc.Sprite3DCache)
--------------------------------
-- get & destroy
-- @function [parent=#Sprite3DCache] getInstance
-- @param self
-- @return Sprite3DCache#Sprite3DCache ret (return value: cc.Sprite3DCache)
return nil

View File

@ -11,6 +11,11 @@
-- @field [parent=#cc] Sprite3D#Sprite3D Sprite3D preloaded module
--------------------------------------------------------
-- the cc Sprite3DCache
-- @field [parent=#cc] Sprite3DCache#Sprite3DCache Sprite3DCache preloaded module
--------------------------------------------------------
-- the cc Mesh
-- @field [parent=#cc] Mesh#Mesh Mesh preloaded module

View File

@ -1246,4 +1246,9 @@
-- @field [parent=#cc] Component#Component Component preloaded module
--------------------------------------------------------
-- the cc AsyncTaskPool
-- @field [parent=#cc] AsyncTaskPool#AsyncTaskPool AsyncTaskPool preloaded module
return nil

View File

@ -372,6 +372,53 @@ int lua_register_cocos2dx_3d_Skeleton3D(lua_State* tolua_S)
return 1;
}
int lua_cocos2dx_3d_Sprite3D_isForceDepthWrite(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Sprite3D* 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.Sprite3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_isForceDepthWrite'", 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_3d_Sprite3D_isForceDepthWrite'", nullptr);
return 0;
}
bool ret = cobj->isForceDepthWrite();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:isForceDepthWrite",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_isForceDepthWrite'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3D_setCullFaceEnabled(lua_State* tolua_S)
{
int argc = 0;
@ -1009,6 +1056,56 @@ int lua_cocos2dx_3d_Sprite3D_getMeshByIndex(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Sprite3D_setForceDepthWrite(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Sprite3D* 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.Sprite3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_setForceDepthWrite'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite3D:setForceDepthWrite");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3D_setForceDepthWrite'", nullptr);
return 0;
}
cobj->setForceDepthWrite(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setForceDepthWrite",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_setForceDepthWrite'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3D_getMeshByName(lua_State* tolua_S)
{
int argc = 0;
@ -1170,79 +1267,6 @@ int lua_cocos2dx_3d_Sprite3D_create(lua_State* tolua_S)
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3D_createAsync(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.Sprite3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 4)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite3D:createAsync");
if (!ok) { break; }
std::string arg1;
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Sprite3D:createAsync");
if (!ok) { break; }
std::function<void (cocos2d::Sprite3D *, void *)> arg2;
do {
// Lambda binding for lua is not supported.
assert(false);
} while(0)
;
if (!ok) { break; }
void* arg3;
#pragma warning NO CONVERSION TO NATIVE FOR void*
ok = false;
if (!ok) { break; }
cocos2d::Sprite3D::createAsync(arg0, arg1, arg2, arg3);
lua_settop(tolua_S, 1);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 3)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite3D:createAsync");
if (!ok) { break; }
std::function<void (cocos2d::Sprite3D *, void *)> arg1;
do {
// Lambda binding for lua is not supported.
assert(false);
} while(0)
;
if (!ok) { break; }
void* arg2;
#pragma warning NO CONVERSION TO NATIVE FOR void*
ok = false;
if (!ok) { break; }
cocos2d::Sprite3D::createAsync(arg0, arg1, arg2);
lua_settop(tolua_S, 1);
return 1;
}
} while (0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Sprite3D:createAsync",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_createAsync'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_3d_Sprite3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Sprite3D)");
@ -1255,6 +1279,7 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S)
tolua_cclass(tolua_S,"Sprite3D","cc.Sprite3D","cc.Node",nullptr);
tolua_beginmodule(tolua_S,"Sprite3D");
tolua_function(tolua_S,"isForceDepthWrite",lua_cocos2dx_3d_Sprite3D_isForceDepthWrite);
tolua_function(tolua_S,"setCullFaceEnabled",lua_cocos2dx_3d_Sprite3D_setCullFaceEnabled);
tolua_function(tolua_S,"setTexture",lua_cocos2dx_3d_Sprite3D_setTexture);
tolua_function(tolua_S,"getLightMask",lua_cocos2dx_3d_Sprite3D_getLightMask);
@ -1268,10 +1293,10 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S)
tolua_function(tolua_S,"removeAttachNode",lua_cocos2dx_3d_Sprite3D_removeAttachNode);
tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_3d_Sprite3D_getSkeleton);
tolua_function(tolua_S,"getMeshByIndex",lua_cocos2dx_3d_Sprite3D_getMeshByIndex);
tolua_function(tolua_S,"setForceDepthWrite",lua_cocos2dx_3d_Sprite3D_setForceDepthWrite);
tolua_function(tolua_S,"getMeshByName",lua_cocos2dx_3d_Sprite3D_getMeshByName);
tolua_function(tolua_S,"getAttachNode",lua_cocos2dx_3d_Sprite3D_getAttachNode);
tolua_function(tolua_S,"create", lua_cocos2dx_3d_Sprite3D_create);
tolua_function(tolua_S,"createAsync", lua_cocos2dx_3d_Sprite3D_createAsync);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Sprite3D).name();
g_luaType[typeName] = "cc.Sprite3D";
@ -1279,6 +1304,241 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S)
return 1;
}
int lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Sprite3DCache* 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.Sprite3DCache",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Sprite3DCache*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite3DCache:removeSprite3DData");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData'", nullptr);
return 0;
}
cobj->removeSprite3DData(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3DCache:removeSprite3DData",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Sprite3DCache* 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.Sprite3DCache",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Sprite3DCache*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData'", 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_3d_Sprite3DCache_removeAllSprite3DData'", nullptr);
return 0;
}
cobj->removeAllSprite3DData();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3DCache:removeAllSprite3DData",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3DCache_destroyInstance(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.Sprite3DCache",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3DCache_destroyInstance'", nullptr);
return 0;
}
cocos2d::Sprite3DCache::destroyInstance();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite3DCache:destroyInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3DCache_destroyInstance'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3DCache_getInstance(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.Sprite3DCache",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3DCache_getInstance'", nullptr);
return 0;
}
cocos2d::Sprite3DCache* ret = cocos2d::Sprite3DCache::getInstance();
object_to_luaval<cocos2d::Sprite3DCache>(tolua_S, "cc.Sprite3DCache",(cocos2d::Sprite3DCache*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite3DCache:getInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3DCache_getInstance'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_3d_Sprite3DCache_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Sprite3DCache)");
return 0;
}
int lua_register_cocos2dx_3d_Sprite3DCache(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Sprite3DCache");
tolua_cclass(tolua_S,"Sprite3DCache","cc.Sprite3DCache","",nullptr);
tolua_beginmodule(tolua_S,"Sprite3DCache");
tolua_function(tolua_S,"removeSprite3DData",lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData);
tolua_function(tolua_S,"removeAllSprite3DData",lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData);
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_3d_Sprite3DCache_destroyInstance);
tolua_function(tolua_S,"getInstance", lua_cocos2dx_3d_Sprite3DCache_getInstance);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Sprite3DCache).name();
g_luaType[typeName] = "cc.Sprite3DCache";
g_typeCast["Sprite3DCache"] = "cc.Sprite3DCache";
return 1;
}
int lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Mesh* 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.Mesh",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount'", 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_3d_Mesh_getMeshVertexAttribCount'", nullptr);
return 0;
}
ssize_t ret = cobj->getMeshVertexAttribCount();
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.Mesh:getMeshVertexAttribCount",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Mesh_setTexture(lua_State* tolua_S)
{
int argc = 0;
@ -1478,6 +1738,53 @@ int lua_cocos2dx_3d_Mesh_setBlendFunc(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Mesh_getVertexSizeInBytes(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Mesh* 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.Mesh",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_getVertexSizeInBytes'", 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_3d_Mesh_getVertexSizeInBytes'", nullptr);
return 0;
}
int ret = cobj->getVertexSizeInBytes();
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.Mesh:getVertexSizeInBytes",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_getVertexSizeInBytes'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Mesh_getBlendFunc(lua_State* tolua_S)
{
int argc = 0;
@ -1525,6 +1832,56 @@ int lua_cocos2dx_3d_Mesh_getBlendFunc(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_3d_Mesh_getMeshVertexAttribute(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Mesh* 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.Mesh",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_getMeshVertexAttribute'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Mesh:getMeshVertexAttribute");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Mesh_getMeshVertexAttribute'", nullptr);
return 0;
}
const cocos2d::MeshVertexAttrib& ret = cobj->getMeshVertexAttribute(arg0);
mesh_vertex_attrib_to_luaval(tolua_S, ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Mesh:getMeshVertexAttribute",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_getMeshVertexAttribute'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Mesh_isVisible(lua_State* tolua_S)
{
int argc = 0;
@ -1634,11 +1991,14 @@ int lua_register_cocos2dx_3d_Mesh(lua_State* tolua_S)
tolua_cclass(tolua_S,"Mesh","cc.Mesh","cc.Ref",nullptr);
tolua_beginmodule(tolua_S,"Mesh");
tolua_function(tolua_S,"getMeshVertexAttribCount",lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount);
tolua_function(tolua_S,"setTexture",lua_cocos2dx_3d_Mesh_setTexture);
tolua_function(tolua_S,"getTexture",lua_cocos2dx_3d_Mesh_getTexture);
tolua_function(tolua_S,"getName",lua_cocos2dx_3d_Mesh_getName);
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_3d_Mesh_setBlendFunc);
tolua_function(tolua_S,"getVertexSizeInBytes",lua_cocos2dx_3d_Mesh_getVertexSizeInBytes);
tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_3d_Mesh_getBlendFunc);
tolua_function(tolua_S,"getMeshVertexAttribute",lua_cocos2dx_3d_Mesh_getMeshVertexAttribute);
tolua_function(tolua_S,"isVisible",lua_cocos2dx_3d_Mesh_isVisible);
tolua_function(tolua_S,"setVisible",lua_cocos2dx_3d_Mesh_setVisible);
tolua_endmodule(tolua_S);
@ -2635,6 +2995,7 @@ TOLUA_API int register_all_cocos2dx_3d(lua_State* tolua_S)
lua_register_cocos2dx_3d_Animate3D(tolua_S);
lua_register_cocos2dx_3d_Sprite3D(tolua_S);
lua_register_cocos2dx_3d_AttachNode(tolua_S);
lua_register_cocos2dx_3d_Sprite3DCache(tolua_S);
lua_register_cocos2dx_3d_BillBoard(tolua_S);
lua_register_cocos2dx_3d_Animation3D(tolua_S);
lua_register_cocos2dx_3d_Skeleton3D(tolua_S);

View File

@ -57,6 +57,15 @@ int register_all_cocos2dx_3d(lua_State* tolua_S);

View File

@ -1,6 +1,7 @@
#include "lua_cocos2dx_auto.hpp"
#include "cocos2d.h"
#include "CCProtectedNode.h"
#include "CCAsyncTaskPool.h"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
@ -72824,6 +72825,146 @@ int lua_register_cocos2dx_Component(lua_State* tolua_S)
g_typeCast["Component"] = "cc.Component";
return 1;
}
int lua_cocos2dx_AsyncTaskPool_stopTasks(lua_State* tolua_S)
{
int argc = 0;
cocos2d::AsyncTaskPool* 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.AsyncTaskPool",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::AsyncTaskPool*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_AsyncTaskPool_stopTasks'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::AsyncTaskPool::TaskType arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AsyncTaskPool:stopTasks");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AsyncTaskPool_stopTasks'", nullptr);
return 0;
}
cobj->stopTasks(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.AsyncTaskPool:stopTasks",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AsyncTaskPool_stopTasks'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_AsyncTaskPool_destoryInstance(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.AsyncTaskPool",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AsyncTaskPool_destoryInstance'", nullptr);
return 0;
}
cocos2d::AsyncTaskPool::destoryInstance();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AsyncTaskPool:destoryInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AsyncTaskPool_destoryInstance'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_AsyncTaskPool_getInstance(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.AsyncTaskPool",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AsyncTaskPool_getInstance'", nullptr);
return 0;
}
cocos2d::AsyncTaskPool* ret = cocos2d::AsyncTaskPool::getInstance();
object_to_luaval<cocos2d::AsyncTaskPool>(tolua_S, "cc.AsyncTaskPool",(cocos2d::AsyncTaskPool*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AsyncTaskPool:getInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AsyncTaskPool_getInstance'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_AsyncTaskPool_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (AsyncTaskPool)");
return 0;
}
int lua_register_cocos2dx_AsyncTaskPool(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.AsyncTaskPool");
tolua_cclass(tolua_S,"AsyncTaskPool","cc.AsyncTaskPool","",nullptr);
tolua_beginmodule(tolua_S,"AsyncTaskPool");
tolua_function(tolua_S,"stopTasks",lua_cocos2dx_AsyncTaskPool_stopTasks);
tolua_function(tolua_S,"destoryInstance", lua_cocos2dx_AsyncTaskPool_destoryInstance);
tolua_function(tolua_S,"getInstance", lua_cocos2dx_AsyncTaskPool_getInstance);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::AsyncTaskPool).name();
g_luaType[typeName] = "cc.AsyncTaskPool";
g_typeCast["AsyncTaskPool"] = "cc.AsyncTaskPool";
return 1;
}
TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
{
tolua_open(tolua_S);
@ -72925,6 +73066,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
lua_register_cocos2dx_Application(tolua_S);
lua_register_cocos2dx_DelayTime(tolua_S);
lua_register_cocos2dx_LabelAtlas(tolua_S);
lua_register_cocos2dx_AsyncTaskPool(tolua_S);
lua_register_cocos2dx_ParticleSnow(tolua_S);
lua_register_cocos2dx_EaseElasticIn(tolua_S);
lua_register_cocos2dx_EaseCircleActionInOut(tolua_S);

View File

@ -1637,6 +1637,10 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -116,6 +116,89 @@ tolua_lerror:
return 0;
}
int lua_cocos2dx_3d_Sprite3D_createAsync(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.Sprite3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 3)
{
std::string modelPath;
ok &= luaval_to_std_string(tolua_S, 2,&modelPath, "cc.Sprite3D:createAsync");
if (!ok)
break;
std::string texturePath;
ok &= luaval_to_std_string(tolua_S, 3,&texturePath, "cc.Sprite3D:createAsync");
if (!ok)
break;
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S,4,"LUA_FUNCTION",0,&tolua_err)) {
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = toluafix_ref_function(tolua_S,4,0);
cocos2d::Sprite3D::createAsync(modelPath, texturePath, [=](cocos2d::Sprite3D* sprite, void* callbackparam){
int id = (sprite) ? (int)sprite->_ID : -1;
int* luaID = (sprite) ? &sprite->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)sprite,"cc.Sprite3D");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 1);
}, nullptr);
lua_settop(tolua_S, 1);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 2)
{
std::string modelPath;
ok &= luaval_to_std_string(tolua_S, 2,&modelPath, "cc.Sprite3D:createAsync");
if (!ok)
break;
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S, 3, "LUA_FUNCTION", 0, &tolua_err)) {
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = toluafix_ref_function(tolua_S, 3, 0);
cocos2d::Sprite3D::createAsync(modelPath, [=](cocos2d::Sprite3D* sprite, void* callbackparam){
int id = (sprite) ? (int)sprite->_ID : -1;
int* luaID = (sprite) ? &sprite->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)sprite,"cc.Sprite3D");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 1);
}, nullptr);
lua_settop(tolua_S, 1);
return 1;
}
} while (0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Sprite3D:createAsync",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_createAsync'.",&tolua_err);
#endif
return 0;
}
static void extendSprite3D(lua_State* L)
{
lua_pushstring(L, "cc.Sprite3D");
@ -124,6 +207,7 @@ static void extendSprite3D(lua_State* L)
{
tolua_function(L, "setBlendFunc", lua_cocos2dx_3d_Sprite3D_setBlendFunc01);
tolua_function(L, "getAABB", lua_cocos2dx_3d_Sprite3D_getAABB);
tolua_function(L, "createAsync", lua_cocos2dx_3d_Sprite3D_createAsync);
}
lua_pop(L, 1);
}

View File

@ -6718,7 +6718,7 @@ static int lua_cocos2dx_GLProgramState_setVertexAttribPointer(lua_State* tolua_S
unsigned int arg2;
bool arg3;
int arg4;
int arg5;
long arg5;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.GLProgramState:setVertexAttribPointer");
@ -6730,11 +6730,11 @@ static int lua_cocos2dx_GLProgramState_setVertexAttribPointer(lua_State* tolua_S
ok &= luaval_to_int32(tolua_S, 6,(int *)&arg4, "cc.GLProgramState:setVertexAttribPointer");
ok &= luaval_to_int32(tolua_S, 7, (int *)&arg5, "cc.GLProgramState:setVertexAttribPointer");
ok &= luaval_to_long(tolua_S, 7, (long *)&arg5, "cc.GLProgramState:setVertexAttribPointer");
if(!ok)
return 0;
cobj->setVertexAttribPointer(arg0, arg1, arg2, arg3, arg4, (void*)&arg5);
cobj->setVertexAttribPointer(arg0, arg1, arg2, arg3, arg4, (void*)arg5);
lua_settop(tolua_S, 1);
return 1;
}
@ -7527,7 +7527,7 @@ static int tolua_cocos2d_Mat4_transformVector(lua_State* tolua_S)
!tolua_isnumber(tolua_S, 3, 0, &tolua_err) ||
!tolua_isnumber(tolua_S, 4, 0, &tolua_err) ||
!tolua_isnumber(tolua_S, 5, 0, &tolua_err) ||
!tolua_isnumber(tolua_S, 6, 0, &tolua_err))
!tolua_istable(tolua_S, 6, 0, &tolua_err) )
goto tolua_lerror;
else
#endif
@ -7566,10 +7566,11 @@ static int tolua_cocos2d_Mat4_decompose(lua_State* tolua_S)
{
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_istable(tolua_S, 1, 0, &tolua_err) ||
!tolua_istable(tolua_S, 2, 0, &tolua_err) ||
!tolua_istable(tolua_S, 3, 0, &tolua_err) ||
!tolua_istable(tolua_S, 4, 0, &tolua_err))
(!lua_isnil(tolua_S, 2) && !tolua_istable(tolua_S, 2, 0, &tolua_err)) ||
(!lua_isnil(tolua_S, 3) && !tolua_istable(tolua_S, 3, 0, &tolua_err)) ||
(!lua_isnil(tolua_S, 4) && !tolua_istable(tolua_S, 4, 0, &tolua_err)) )
goto tolua_lerror;
else
#endif
@ -7579,27 +7580,210 @@ static int tolua_cocos2d_Mat4_decompose(lua_State* tolua_S)
cocos2d::Quaternion rotation;
cocos2d::Vec3 translation;
bool ok = true;
ok &= luaval_to_mat4(tolua_S, 1, &mat);
if (!ok)
return 0;
ok &= luaval_to_vec3(tolua_S, 2, &scale);
if (!ok)
return 0;
if (lua_isnil(tolua_S, 2) && !lua_isnil(tolua_S, 3) && !lua_isnil(tolua_S, 4))
{
ok &= luaval_to_quaternion(tolua_S, 3, &rotation);
if (!ok)
return 0;
ok &= luaval_to_quaternion(tolua_S, 3, &rotation);
if (!ok)
return 0;
ok &= luaval_to_vec3(tolua_S, 2, &translation);
if (!ok)
return 0;
ok &= luaval_to_vec3(tolua_S, 4, &translation);
if (!ok)
return 0;
mat.decompose(&scale, &rotation, &translation);
vec3_to_luaval(tolua_S, scale);
quaternion_to_luaval(tolua_S, rotation);
vec3_to_luaval(tolua_S, translation);
return 3;
mat.decompose(nullptr, &rotation, &translation);
lua_newtable(tolua_S);
lua_pushstring(tolua_S, "scale");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "rotation");
quaternion_to_luaval(tolua_S, rotation);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "translation");
vec3_to_luaval(tolua_S, translation);
lua_rawset(tolua_S, -3);
return 1;
}
if (lua_isnil(tolua_S, 2) && lua_isnil(tolua_S, 3) && !lua_isnil(tolua_S, 4))
{
ok &= luaval_to_vec3(tolua_S, 4, &translation);
if (!ok)
return 0;
mat.decompose(nullptr, nullptr, &translation);
lua_newtable(tolua_S);
lua_pushstring(tolua_S, "scale");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "rotation");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "translation");
vec3_to_luaval(tolua_S, translation);
lua_rawset(tolua_S, -3);
return 1;
}
if (!lua_isnil(tolua_S, 2) && lua_isnil(tolua_S, 3) && !lua_isnil(tolua_S, 4))
{
ok &= luaval_to_vec3(tolua_S, 2, &scale);
if (!ok)
return 0;
ok &= luaval_to_vec3(tolua_S, 4, &translation);
if (!ok)
return 0;
mat.decompose(&scale, nullptr, &translation);
lua_newtable(tolua_S);
lua_pushstring(tolua_S, "scale");
vec3_to_luaval(tolua_S, scale);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "rotation");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "translation");
vec3_to_luaval(tolua_S, translation);
lua_rawset(tolua_S, -3);
return 1;
}
if (!lua_isnil(tolua_S, 2) && lua_isnil(tolua_S, 3) && lua_isnil(tolua_S, 4))
{
ok &= luaval_to_vec3(tolua_S, 2, &scale);
if (!ok)
return 0;
mat.decompose(&scale, nullptr, nullptr);
lua_newtable(tolua_S);
lua_pushstring(tolua_S, "scale");
vec3_to_luaval(tolua_S, scale);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "rotation");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "translation");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
return 1;
}
if (!lua_isnil(tolua_S, 2) && !lua_isnil(tolua_S, 3) && lua_isnil(tolua_S, 4))
{
ok &= luaval_to_vec3(tolua_S, 2, &scale);
if (!ok)
return 0;
ok &= luaval_to_quaternion(tolua_S, 3, &rotation);
if (!ok)
return 0;
mat.decompose(&scale, &rotation, nullptr);
lua_newtable(tolua_S);
lua_pushstring(tolua_S, "scale");
vec3_to_luaval(tolua_S, scale);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "rotation");
quaternion_to_luaval(tolua_S, rotation);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "translation");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
return 1;
}
if (lua_isnil(tolua_S, 2) && !lua_isnil(tolua_S, 3) && lua_isnil(tolua_S, 4))
{
ok &= luaval_to_quaternion(tolua_S, 3, &rotation);
if (!ok)
return 0;
mat.decompose(nullptr, &rotation, nullptr);
lua_newtable(tolua_S);
lua_pushstring(tolua_S, "scale");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "rotation");
quaternion_to_luaval(tolua_S, rotation);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "translation");
lua_pushnil(tolua_S);
lua_rawset(tolua_S, -3);
}
if (!lua_isnil(tolua_S, 2) && !lua_isnil(tolua_S, 3) && !lua_isnil(tolua_S, 4))
{
ok &= luaval_to_vec3(tolua_S, 2, &scale);
if (!ok)
return 0;
ok &= luaval_to_quaternion(tolua_S, 3, &rotation);
if (!ok)
return 0;
ok &= luaval_to_vec3(tolua_S, 4, &translation);
if (!ok)
return 0;
mat.decompose(&scale, &rotation, &translation);
lua_newtable(tolua_S);
lua_pushstring(tolua_S, "scale");
vec3_to_luaval(tolua_S, scale);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "rotation");
quaternion_to_luaval(tolua_S, rotation);
lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "translation");
vec3_to_luaval(tolua_S, translation);
lua_rawset(tolua_S, -3);
return 1;
}
return 0;
}
return 0;
#if COCOS2D_DEBUG >= 1
@ -7617,7 +7801,7 @@ static int tolua_cocos2d_Vec3_cross(lua_State* tolua_S)
tolua_Error tolua_err;
#endif
if (1 == argc)
if (2 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!tolua_istable(tolua_S, 1, 0, &tolua_err) ||
@ -7687,6 +7871,38 @@ tolua_lerror:
#endif
}
static int tolua_cocos2d_Mat4_multiply(lua_State* tolua_S)
{
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_istable(tolua_S, 1, 0, &tolua_err) ||
!tolua_istable(tolua_S, 2, 0, &tolua_err) )
goto tolua_lerror;
else
#endif
{
cocos2d::Mat4 mat1;
bool ok = luaval_to_mat4(tolua_S, 1, &mat1);
if(!ok)
return 0;
cocos2d::Mat4 mat2;
ok = luaval_to_mat4(tolua_S, 2, &mat2);
if(!ok)
return 0;
cocos2d::Mat4 ret = mat1 * mat2;
mat4_to_luaval(tolua_S, ret);
return 1;
}
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'mat4_multiply'.",&tolua_err);
return 0;
#endif
}
int register_all_cocos2dx_math_manual(lua_State* tolua_S)
{
if (nullptr == tolua_S)
@ -7698,6 +7914,7 @@ int register_all_cocos2dx_math_manual(lua_State* tolua_S)
tolua_function(tolua_S, "mat4_getInversed", tolua_cocos2d_Mat4_getInversed);
tolua_function(tolua_S, "mat4_transformVector", tolua_cocos2d_Mat4_transformVector);
tolua_function(tolua_S, "mat4_decompose", tolua_cocos2d_Mat4_decompose);
tolua_function(tolua_S, "mat4_multiply", tolua_cocos2d_Mat4_multiply);
tolua_function(tolua_S, "vec3_cross", tolua_cocos2d_Vec3_cross);
tolua_endmodule(tolua_S);
return 0;

View File

@ -277,7 +277,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\2d;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\ui;$(EngineRoot)external;$(EngineRoot)external\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -309,7 +309,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>

View File

@ -175,7 +175,7 @@ function cc.pIsSegmentIntersect(pt1,pt2,pt3,pt4)
ret,s,t =cc.pIsLineIntersect(pt1, pt2, pt3, pt4,s,t)
if ret and s >= 0.0 and s <= 1.0 and t >= 0.0 and t <= 0.0 then
return true;
return true
end
return false
@ -450,7 +450,6 @@ cc.mat4 = cc.mat4 or {}
function cc.mat4.new(...)
local params = {...}
local size = #params
local obj = {}
if 1 == size then
@ -463,10 +462,8 @@ function cc.mat4.new(...)
end
end
elseif 16 == size then
if params[i] ~= nil then
mat4[i] = params[i]
else
mat4[i] = 0
for i= 1, 16 do
obj[i] = params[i]
end
end
@ -482,3 +479,66 @@ end
function cc.mat4.transformVector(self, vector, dst)
return mat4_transformVector(self, vector, dst)
end
function cc.mat4.multiply(self, mat)
return mat4_multiply(self, mat)
end
function cc.mat4.decompose(self, scale, rotation, translation)
return mat4_decompose(self, scale ,rotation, translation)
end
function cc.mat4.createIdentity()
return cc.mat4.new(1.0 ,0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0)
end
function cc.mat4.createTranslation(translation, dst)
assert(type(translation) == "table" and type(dst) == "table", "The type of input parameters should be table")
dst = cc.mat4.createIdentity()
dst[13] = translation.x
dst[14] = translation.y
dst[15] = translation.z
return dst
end
function cc.mat4.createRotation(q, dst)
assert(type(q) == "table" and type(dst) == "table", "The type of input parameters should be table")
local x2 = q.x + q.x
local y2 = q.y + q.y
local z2 = q.z + q.z
local xx2 = q.x * x2
local yy2 = q.y * y2
local zz2 = q.z * z2
local xy2 = q.x * y2
local xz2 = q.x * z2
local yz2 = q.y * z2
local wx2 = q.w * x2
local wy2 = q.w * y2
local wz2 = q.w * z2
dst[1] = 1.0 - yy2 - zz2
dst[2] = xy2 + wz2
dst[3] = xz2 - wy2
dst[4] = 0.0
dst[5] = xy2 - wz2
dst[6] = 1.0 - xx2 - zz2
dst[7] = yz2 + wx2
dst[8] = 0.0
dst[9] = xz2 + wy2
dst[10] = yz2 - wx2
dst[11] = 1.0 - xx2 - yy2
dst[12] = 0.0
dst[13] = 0.0
dst[14] = 0.0
dst[15] = 0.0
dst[16] = 1.0
return dst
end

View File

@ -610,3 +610,12 @@ cc.LightFlag =
LIGHT14 = math.pow(2,14),
LIGHT15 = math.pow(2,15),
}
cc.AsyncTaskPool.TaskType =
{
TASK_IO = 0,
TASK_NETWORK = 1,
TASK_OTHER = 2,
TASK_MAX_TYPE = 3,
}

View File

@ -449,15 +449,9 @@ void Button::onPressStateChangedToPressed()
_buttonNormalRenderer->setScale(_pressedTextureScaleXInSize + _zoomScale, _pressedTextureScaleYInSize + _zoomScale);
_titleRenderer->stopAllActions();
Action *zoomTitleAction = ScaleTo::create(ZOOM_ACTION_TIME_STEP, 1.0f + _zoomScale, 1.0f + _zoomScale);
if (_unifySize)
{
_titleRenderer->runAction(zoomTitleAction);
}
else
{
_titleRenderer->runAction(zoomTitleAction->clone());
}
_titleRenderer->runAction(zoomTitleAction);
}
}
else

View File

@ -385,6 +385,11 @@ void EditBox::setAnchorPoint(const Vec2& anchorPoint)
}
}
std::string EditBox::getDescription() const
{
return "EditBox";
}
void EditBox::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
{
Widget::visit(renderer, parentTransform, parentFlags);

View File

@ -394,6 +394,12 @@ namespace ui {
virtual void setVisible(bool visible) override;
virtual void setContentSize(const Size& size) override;
virtual void setAnchorPoint(const Vec2& anchorPoint) override;
/**
* Returns the "class name" of widget.
*/
virtual std::string getDescription() const override;
/**
* @js NA
* @lua NA

View File

@ -193,6 +193,8 @@ void LoadingBar::loadTexture(const std::string& texture,TextureResType texType)
barRendererScaleChangedWithSize();
updateContentSizeWithTextureSize(_barRendererTextureSize);
this->updateProgressBar();
_barRendererAdaptDirty = true;
}
@ -216,7 +218,7 @@ void LoadingBar::setScale9Enabled(bool enabled)
ignoreContentAdaptWithSize(_prevIgnoreSize);
}
setCapInsets(_capInsets);
setPercent(_percent);
this->updateProgressBar();
_barRendererAdaptDirty = true;
}
@ -255,18 +257,24 @@ void LoadingBar::setPercent(float percent)
return;
}
_percent = percent;
if (_totalLength <= 0)
{
return;
}
float res = _percent / 100.0f;
this->updateProgressBar();
}
void LoadingBar::updateProgressBar()
{
if (_scale9Enabled)
{
setScale9Scale();
}
else
{
float res = _percent / 100.0f;
Sprite* spriteRenderer = _barRenderer->getSprite();
Rect rect = spriteRenderer->getTextureRect();
rect.size.width = _barRendererTextureSize.width * res;
@ -334,7 +342,7 @@ void LoadingBar::barRendererScaleChangedWithSize()
_totalLength = _contentSize.width;
if (_scale9Enabled)
{
setScale9Scale();
this->setScale9Scale();
_barRenderer->setScale(1.0f);
}
else

View File

@ -148,6 +148,7 @@ protected:
virtual void onSizeChanged() override;
void setScale9Scale();
void updateProgressBar();
void barRendererScaleChangedWithSize();
virtual void adaptRenderers() override;

View File

@ -599,26 +599,30 @@ void TextField::update(float dt)
detachWithIMEEvent();
setDetachWithIME(false);
}
if (getAttachWithIME())
{
attachWithIMEEvent();
setAttachWithIME(false);
}
if (getInsertText())
{
//we update the content size first such that when user call getContentSize() in event callback won't be wrong
_textFieldRendererAdaptDirty = true;
updateContentSizeWithTextureSize(_textFieldRenderer->getContentSize());
insertTextEvent();
setInsertText(false);
_textFieldRendererAdaptDirty = true;
updateContentSizeWithTextureSize(_textFieldRenderer->getContentSize());
}
if (getDeleteBackward())
{
deleteBackwardEvent();
setDeleteBackward(false);
_textFieldRendererAdaptDirty = true;
updateContentSizeWithTextureSize(_textFieldRenderer->getContentSize());
deleteBackwardEvent();
setDeleteBackward(false);
}
}

View File

@ -4909,6 +4909,7 @@
"cocos/scripting/lua-bindings/auto/api/ArmatureDisplayData.lua",
"cocos/scripting/lua-bindings/auto/api/AssetsManager.lua",
"cocos/scripting/lua-bindings/auto/api/AssetsManagerEx.lua",
"cocos/scripting/lua-bindings/auto/api/AsyncTaskPool.lua",
"cocos/scripting/lua-bindings/auto/api/AtlasNode.lua",
"cocos/scripting/lua-bindings/auto/api/AttachNode.lua",
"cocos/scripting/lua-bindings/auto/api/AudioEngine.lua",
@ -5189,6 +5190,7 @@
"cocos/scripting/lua-bindings/auto/api/SpotLight.lua",
"cocos/scripting/lua-bindings/auto/api/Sprite.lua",
"cocos/scripting/lua-bindings/auto/api/Sprite3D.lua",
"cocos/scripting/lua-bindings/auto/api/Sprite3DCache.lua",
"cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua",
"cocos/scripting/lua-bindings/auto/api/SpriteDisplayData.lua",
"cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua",

View File

@ -47,7 +47,7 @@ static std::function<Layer*()> createFunctions[] =
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
static Layer* nextSpriteTestAction()
static Layer* nextTest()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
@ -56,7 +56,7 @@ static Layer* nextSpriteTestAction()
return layer;
}
static Layer* backSpriteTestAction()
static Layer* backTest()
{
sceneIdx--;
int total = MAX_LAYER;
@ -67,7 +67,7 @@ static Layer* backSpriteTestAction()
return layer;
}
static Layer* restartSpriteTestAction()
static Layer* restartTest()
{
auto layer = (createFunctions[sceneIdx])();
return layer;
@ -137,6 +137,31 @@ std::string BillBoardRotationTest::subtitle() const
return "All the sprites should still facing camera";
}
void BillBoardRotationTest::restartCallback(Ref* sender)
{
auto s = new (std::nothrow) BillBoardTestScene();
s->addChild(restartTest());
Director::getInstance()->replaceScene(s);
s->release();
}
void BillBoardRotationTest::nextCallback(Ref* sender)
{
auto s = new (std::nothrow) BillBoardTestScene();
s->addChild(nextTest());
Director::getInstance()->replaceScene(s);
s->release();
}
void BillBoardRotationTest::backCallback(Ref* sender)
{
auto s = new (std::nothrow) BillBoardTestScene();
s->addChild(backTest());
Director::getInstance()->replaceScene(s);
s->release();
}
//------------------------------------------------------------------
//
// Billboard Rendering Test
@ -338,9 +363,35 @@ void BillBoardTest::rotateCameraCallback(Ref* sender,float value)
_camera->setRotation3D(rotation3D);
}
void BillBoardTest::restartCallback(Ref* sender)
{
auto s = new (std::nothrow) BillBoardTestScene();
s->addChild(restartTest());
Director::getInstance()->replaceScene(s);
s->release();
}
void BillBoardTest::nextCallback(Ref* sender)
{
auto s = new (std::nothrow) BillBoardTestScene();
s->addChild(nextTest());
Director::getInstance()->replaceScene(s);
s->release();
}
void BillBoardTest::backCallback(Ref* sender)
{
auto s = new (std::nothrow) BillBoardTestScene();
s->addChild(backTest());
Director::getInstance()->replaceScene(s);
s->release();
}
void BillBoardTestScene::runThisTest()
{
auto layer = nextSpriteTestAction();
auto layer = nextTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -43,6 +43,10 @@ public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void restartCallback(Ref* sender) override;
virtual void nextCallback(Ref* sender) override;
virtual void backCallback(Ref* sender) override;
protected:
};
@ -63,6 +67,10 @@ public:
void menuCallback_orientedPoint(Ref* sender);
void menuCallback_orientedPlane(Ref* sender);
virtual void restartCallback(Ref* sender) override;
virtual void nextCallback(Ref* sender) override;
virtual void backCallback(Ref* sender) override;
protected:
Camera* _camera;
Layer* _layerBillBorad;

View File

@ -130,7 +130,6 @@ CameraRotationTest::CameraRotationTest()
auto sp3d = Sprite3D::create();
sp3d->setPosition(s.width/2, s.height/2);
sp3d->setRotation3D(Vec3(90,90,0));
addChild(sp3d);
auto lship = Label::create();

View File

@ -34,7 +34,17 @@ Layer *CreateAnimationLayer(int index)
case TEST_TIMELINE_PERFORMACE:
pLayer = new (std::nothrow) TestTimelinePerformance();
break;
case TEST_TIMELINEACTION_ANIMATIONLIST:
pLayer = new (std::nothrow) TestTimelineAnimationList();
break;
case TEST_TIMELINEPROJECTNODE:
pLayer = new (std::nothrow) TestTimelineProjectNode();
break;
case TEST_PROJECTNODEFORSIMALATOR:
pLayer = new (std::nothrow) TestProjectNodeForSimulator;
break;
default:
CCLOG("NONE OF THIS TEST LAYER");
break;
}
@ -185,7 +195,8 @@ void ActionTimelineTestLayer::nextCallback(Ref *pSender)
void ActionTimelineTestLayer::backCallback(Ref *pSender)
{
Scene *s = new (std::nothrow) ActionTimelineTestScene();
s->addChild( BackAnimationTest() );
auto a = BackAnimationTest();
s->addChild( a);
Director::getInstance()->replaceScene(s);
s->release();
}
@ -324,3 +335,73 @@ std::string TestTimelinePerformance::title() const
return "Test ActionTimeline performance";
}
// TestTimelineAnimationList
void TestTimelineAnimationList::onEnter()
{
ActionTimelineTestLayer::onEnter();
Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
cocostudio::timeline::AnimationInfo standinfo("stand", 0, 40);
cocostudio::timeline::AnimationInfo walkinfo("walk", 41, 81);
action->addAnimationInfo(standinfo);
action->addAnimationInfo(walkinfo);
node->runAction(action);
action->play("walk", true);
node->setScale(0.2f);
node->setPosition(150,100);
addChild(node);
}
std::string TestTimelineAnimationList::title() const
{
return "Test ActionTimeline AnimationList";
}
//TestTimelineProjectNode
//InnerActionFrame make InnerAction Play until action's duration or next InnerActionFrame
void TestTimelineProjectNode::onEnter()
{
ActionTimelineTestLayer::onEnter();
Node* node = CSLoader::createNode("ActionTimeline/TestAnimation.csb");
ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/TestAnimation.csb");
node->runAction(action);
action->gotoFrameAndPlay(0, true);
node->setPosition(-300, -300);
addChild(node);
}
std::string TestTimelineProjectNode::title() const
{
return "Test ActionTimeline ProjectNode";
}
//TestProjectNodeForSimulator
//InnerActionFrame make InnerAction Play until action's duration or next InnerActionFrame
void TestProjectNodeForSimulator::onEnter()
{
ActionTimelineTestLayer::onEnter();
Node* node = CSLoader::getInstance()->createNodeWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd");
ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd");
node->runAction(action);
action->gotoFrameAndPlay(0, true);
node->setPosition(-300, -300);
addChild(node);
// test for when ProjectNode file lost
Node* lackProjectNodefileNode = CSLoader::getInstance()->createNodeWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd");
ActionTimeline* lackProjectNodefileAction = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd");
lackProjectNodefileNode->runAction(lackProjectNodefileAction);
lackProjectNodefileAction->gotoFrameAndPlay(0);
addChild(lackProjectNodefileNode);
}
std::string TestProjectNodeForSimulator::title() const
{
return "Test ProjectNode for Simalator";
}

View File

@ -25,6 +25,9 @@ enum {
TEST_CHANGE_PLAY_SECTION,
// TEST_TIMELINE_FRAME_EVENT,
TEST_TIMELINE_PERFORMACE,
TEST_TIMELINEACTION_ANIMATIONLIST,
TEST_TIMELINEPROJECTNODE,
TEST_PROJECTNODEFORSIMALATOR,
TEST_ANIMATION_LAYER_COUNT
};
@ -85,4 +88,25 @@ public:
virtual std::string title() const override;
};
class TestTimelineAnimationList : public ActionTimelineTestLayer
{
public:
virtual void onEnter();
virtual std::string title() const override;
};
class TestTimelineProjectNode : public ActionTimelineTestLayer
{
public:
virtual void onEnter();
virtual std::string title() const override;
};
class TestProjectNodeForSimulator : public ActionTimelineTestLayer
{
public:
virtual void onEnter();
virtual std::string title() const override;
};
#endif // __ANIMATION_SCENE_H__

View File

@ -81,7 +81,7 @@ SocketIOTestLayer::SocketIOTestLayer(void)
itemTestEndpointDisconnect->setPosition(Vec2(VisibleRect::right().x - labelTestEndpointDisconnect->getContentSize().width / 2 - 5, winSize.height - MARGIN - 4 * SPACE));
menuRequest->addChild(itemTestEndpointDisconnect);
// Sahred Status Label
// Shared Status Label
_sioClientStatus = Label::createWithTTF("Not connected...", "fonts/arial.ttf", 14, Size(320, 100), TextHAlignment::LEFT);
_sioClientStatus->setAnchorPoint(Vec2(0, 0));
_sioClientStatus->setPosition(Vec2(VisibleRect::left().x, VisibleRect::rightBottom().y));

View File

@ -1537,11 +1537,7 @@ TTFFontShadowAndStroke::TTFFontShadowAndStroke()
strokeShaodwTextDef._fontFillColor = tintColorBlue;
// shadow + stroke label
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
auto fontStrokeAndShadow = LabelTTF::createWithFontDefinition("Stroke && Shadow Blue Text", strokeShaodwTextDef);
#else
auto fontStrokeAndShadow = LabelTTF::createWithFontDefinition("Stroke &Shadow Blue Text", strokeShaodwTextDef);
#endif
auto fontStrokeAndShadow = LabelTTF::createWithFontDefinition("Stroke & Shadow Blue Text", strokeShaodwTextDef);
// add label to the scene
this->addChild(fontStrokeAndShadow);

View File

@ -1,6 +1,7 @@
#include "PhysicsTest.h"
#include <cmath>
#include "../testResource.h"
#include "ui/CocosGUI.h"
USING_NS_CC;
namespace
@ -23,6 +24,7 @@ namespace
CL(Bug5482),
CL(PhysicsFixedUpdate),
CL(PhysicsTransformTest),
CL(PhysicsIssue9959)
#else
CL(PhysicsDemoDisabled),
#endif
@ -1865,4 +1867,37 @@ std::string PhysicsTransformTest::title() const
return "Physics transform test";
}
void PhysicsIssue9959::onEnter()
{
PhysicsDemo::onEnter();
auto origin = Director::getInstance()->getVisibleOrigin();
auto visibleSize = Director::getInstance()->getVisibleSize();
auto scale9Sprite1 = ui::Scale9Sprite::create("Images/ball.png");
scale9Sprite1->setPosition(origin + visibleSize/2);
addChild(scale9Sprite1);
scale9Sprite1->runAction(RepeatForever::create(Sequence::create(MoveBy::create(2.0f, Vec2(100.0f,0.0f)), MoveBy::create(2.0f, Vec2(-100.0f, 0.0f)), NULL)));
auto scale9Sprite2 = ui::Scale9Sprite::create("Images/ball.png");
scale9Sprite2->setPosition(origin + visibleSize/2 + Vec2(0.0f, 50.0f));
addChild(scale9Sprite2);
scale9Sprite2->runAction(RepeatForever::create(Sequence::create(ScaleTo::create(2.0f, 1.5f), ScaleTo::create(2.0f, 1.0f), NULL)));
auto scale9Sprite3 = ui::Scale9Sprite::create("Images/ball.png");
scale9Sprite3->setPosition(origin + visibleSize/2 + Vec2(0.0f, -50.0f));
addChild(scale9Sprite3);
scale9Sprite3->runAction(RepeatForever::create(RotateBy::create(2.0f, 360.0f)));
}
std::string PhysicsIssue9959::title() const
{
return "Reorder issue #9959";
}
std::string PhysicsIssue9959::subtitle() const
{
return "Test Scale9Sprite run scale/move/rotation action in physics scene";
}
#endif // ifndef CC_USE_PHYSICS

View File

@ -278,5 +278,16 @@ public:
bool onTouchBegan(Touch* touch, Event* event);
};
class PhysicsIssue9959 : public PhysicsDemo
{
public:
CREATE_FUNC(PhysicsIssue9959);
void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
#endif
#endif

View File

@ -29,7 +29,8 @@ static std::function<Layer*()> createFunctions[] = {
CL(SchedulerDelayAndRepeat),
CL(SchedulerIssue2268),
CL(ScheduleCallbackTest),
CL(ScheduleUpdatePriority)
CL(ScheduleUpdatePriority),
CL(SchedulerIssue10232)
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
@ -1212,3 +1213,29 @@ void SchedulerTestScene::runThisTest()
Director::getInstance()->replaceScene(this);
}
void SchedulerIssue10232::onEnter()
{
SchedulerTestLayer::onEnter();
this->scheduleOnce(SEL_SCHEDULE(&SchedulerIssue2268::update), 0.25f);
this->scheduleOnce([](float dt){
log("SchedulerIssue10232:Schedules a lambda function");
}, 0.25f,"SchedulerIssue10232");
}
void SchedulerIssue10232::update(float dt)
{
log("SchedulerIssue10232:Schedules a selector");
}
std::string SchedulerIssue10232::title() const
{
return "Issue #10232";
}
std::string SchedulerIssue10232::subtitle() const
{
return "Should not crash";
}

View File

@ -330,4 +330,16 @@ public:
virtual void runThisTest();
};
class SchedulerIssue10232 : public SchedulerTestLayer
{
public:
CREATE_FUNC(SchedulerIssue10232);
virtual std::string title() const override;
virtual std::string subtitle() const override;
void onEnter();
void update(float dt);
};
#endif

View File

@ -70,7 +70,8 @@ static std::function<Layer*()> createFunctions[] =
CL(Sprite3DMirrorTest),
CL(QuaternionTest),
CL(Sprite3DEmptyTest),
CL(UseCaseSprite3D)
CL(UseCaseSprite3D),
CL(Sprite3DForceDepthTest)
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
@ -156,6 +157,42 @@ void Sprite3DTestDemo::backCallback(Ref* sender)
s->release();
}
//------------------------------------------------------------------
//
// Sprite3DForceDepthTest
//
//------------------------------------------------------------------
Sprite3DForceDepthTest::Sprite3DForceDepthTest()
{
auto orc = Sprite3D::create("Sprite3DTest/orc.c3b");
orc->setScale(5);
orc->setNormalizedPosition(Vec2(.5,.3));
orc->setPositionZ(40);
orc->setRotation3D(Vec3(0,180,0));
orc->setGlobalZOrder(-1);
addChild(orc);
auto ship = Sprite3D::create("Sprite3DTest/boss1.obj");
ship->setScale(5);
ship->setTexture("Sprite3DTest/boss.png");
ship->setNormalizedPosition(Vec2(.5,.5));
ship->setRotation3D(Vec3(90,0,0));
ship->setForceDepthWrite(true);
addChild(ship);
}
std::string Sprite3DForceDepthTest::title() const
{
return "Force Depth Write Error Test";
}
std::string Sprite3DForceDepthTest::subtitle() const
{
return "Ship should always appear behind orc";
}
//------------------------------------------------------------------
//
// Sprite3DEmptyTest
@ -2109,19 +2146,17 @@ void QuaternionTest::update(float delta)
UseCaseSprite3D::UseCaseSprite3D()
: _caseIdx(0)
, _sprite3d(nullptr)
, _sprite2d(nullptr)
{
auto s = Director::getInstance()->getWinSize();
_useCaseTitles[0] = "transparent 3d sprite and 2d sprite";
_useCaseTitles[1] = "ui - 3d - ui";
auto itemPrev = MenuItemImage::create("Images/b1.png", "Images/b2.png",
[&](Ref *sender) {
_caseIdx--;
if (_caseIdx < 0)
_caseIdx = 0;
_caseIdx = (int)USECASE::MAX_CASE_NUM - 1;
this->switchCase();
});
@ -2129,7 +2164,7 @@ UseCaseSprite3D::UseCaseSprite3D()
[&](Ref *sender) {
_caseIdx++;
if (_caseIdx >= (int)USECASE::MAX_CASE_NUM)
_caseIdx = (int)USECASE::MAX_CASE_NUM - 1;
_caseIdx = 0;
this->switchCase();
});
@ -2167,25 +2202,15 @@ std::string UseCaseSprite3D::subtitle() const
void UseCaseSprite3D::switchCase()
{
if (_sprite3d)
{
removeChild(_sprite3d);
_sprite3d = nullptr;
}
if (_sprite2d)
{
removeChild(_sprite2d);
_sprite2d = nullptr;
}
removeChildByTag(101);
auto s = Director::getInstance()->getWinSize();
_label->setString(_useCaseTitles[_caseIdx]);
if (_caseIdx == 0)
if (_caseIdx == 0) // use case 1, 3d transparent sprite + 2d sprite
{
std::string filename = "Sprite3DTest/girl.c3b";
auto sprite = Sprite3D::create(filename);
sprite->setScale(0.15f);
addChild(sprite);
auto animation = Animation3D::create(filename);
if (animation)
{
@ -2202,32 +2227,99 @@ void UseCaseSprite3D::switchCase()
circleBack->setRotation3D(Vec3(90, 0, 0));
addChild(circleBack);
auto pos = sprite->getPosition3D();
circleBack->setPosition3D(Vec3(pos.x, pos.y, pos.z - 1));
_sprite3d = sprite;
_sprite2d = circleBack;
_sprite3d->setOpacity(250);
_sprite3d->setCameraMask(2);
_sprite2d->setCameraMask(2);
}
sprite->setOpacity(250);
sprite->setCameraMask(2);
circleBack->setCameraMask(2);
sprite->setTag(3);
circleBack->setTag(2);
scheduleUpdate();
update(0.f);
auto node = Node::create();
node->addChild(sprite);
node->addChild(circleBack);
node->setTag(101);
addChild(node);
scheduleUpdate();
update(0.f);
}
else if (_caseIdx == 1) // use case 2, ui - 3d - ui, last ui should on the top
{
auto layer = LayerColor::create(Color4B(0, 0, 100, 255), s.width / 2.f, s.height / 2.f);
layer->setPosition(s.width * 0.25f, s.height * 0.25f);
layer->setGlobalZOrder(-1);
addChild(layer);
std::string filename = "Sprite3DTest/girl.c3b";
auto sprite = Sprite3D::create(filename);
sprite->setScale(0.5f);
auto animation = Animation3D::create(filename);
if (animation)
{
auto animate = Animate3D::create(animation);
sprite->runAction(RepeatForever::create(animate));
}
sprite->setPosition(s.width * 0.25f, s.height * 0.125f);
layer->addChild(sprite);
TTFConfig ttfConfig("fonts/arial.ttf", 15);
auto label1 = Label::createWithTTF(ttfConfig,"Message");
auto item1 = MenuItemLabel::create(label1,CC_CALLBACK_1(UseCaseSprite3D::menuCallback_Message,this) );
auto label2 = Label::createWithTTF(ttfConfig,"Message");
auto item2 = MenuItemLabel::create(label2, CC_CALLBACK_1(UseCaseSprite3D::menuCallback_Message,this) );
item1->setPosition( Vec2(s.width * 0.5f - item1->getContentSize().width * 0.5f, s.height * 0.5f - item1->getContentSize().height ) );
item2->setPosition( Vec2(s.width * 0.5f - item1->getContentSize().width * 0.5f, s.height * 0.5f - item1->getContentSize().height * 2.f ) );
auto pMenu1 = CCMenu::create(item1, item2, nullptr);
pMenu1->setPosition(Vec2(0,0));
layer->addChild(pMenu1);
layer->setTag(101);
}
}
void UseCaseSprite3D::menuCallback_Message(Ref* sender)
{
auto layer = getChildByTag(101);
auto message = layer->getChildByTag(102); // message layer
if (message)
layer->removeChild(message);
else
{
// create a new message layer on the top
auto s = layer->getContentSize();
auto messagelayer = LayerColor::create(Color4B(100, 100, 0, 255));
messagelayer->setContentSize(Size(s.width * 0.5f, s.height * 0.5f));
messagelayer->setPosition(Vec2(s.width * 0.25f, s.height * 0.25f));
auto label = Label::create();
label->setString("This Message Layer \n Should Be On Top");
label->setPosition(Vec2(s.width * 0.25f, s.height * 0.25f));
messagelayer->addChild(label);
messagelayer->setTag(102);
layer->addChild(messagelayer);
}
}
void UseCaseSprite3D::update(float delta)
{
static float accAngle = 0.f;
accAngle += delta * CC_DEGREES_TO_RADIANS(60);
if (_caseIdx == 0)
{
static float accAngle = 0.f;
accAngle += delta * CC_DEGREES_TO_RADIANS(60);
float radius = 30.f;
float x = cosf(accAngle) * radius, z = sinf(accAngle) * radius;
float radius = 30.f;
float x = cosf(accAngle) * radius, z = sinf(accAngle) * radius;
_sprite3d->setPositionX(x);
_sprite3d->setPositionZ(z);
_sprite2d->setPositionX(x);
_sprite2d->setPositionZ(z);
auto node = getChildByTag(101);
auto sprite3d = node->getChildByTag(3);
auto circle = node->getChildByTag(2);
sprite3d->setPositionX(x);
sprite3d->setPositionZ(z);
circle->setPositionX(x);
circle->setPositionZ(z);
}
}

View File

@ -54,6 +54,15 @@ public:
virtual void onEnter() override;
};
class Sprite3DForceDepthTest : public Sprite3DTestDemo
{
public:
CREATE_FUNC(Sprite3DForceDepthTest);
Sprite3DForceDepthTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class Sprite3DEmptyTest : public Sprite3DTestDemo
{
public:
@ -455,6 +464,7 @@ protected:
float _accAngle;
};
// 3d + 2d use case
class UseCaseSprite3D : public Sprite3DTestDemo
{
public:
@ -465,20 +475,20 @@ public:
virtual void update(float delta) override;
void menuCallback_Message(Ref* sender);
protected:
void switchCase();
enum class USECASE{
_3D_WITH_2D,
_UI_3D_UI,
MAX_CASE_NUM,
};
cocos2d::Label* _label;
int _caseIdx; // use case index
std::string _useCaseTitles[(int)USECASE::MAX_CASE_NUM];
cocos2d::Sprite3D* _sprite3d;
cocos2d::Sprite3D* _sprite2d;
};
class Sprite3DTestScene : public TestScene

View File

@ -139,7 +139,7 @@ g_guisTests[] =
UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
sceneManager->setCurrentUISceneId(kUILoadingBarTest_Left);
sceneManager->setMinUISceneId(kUILoadingBarTest_Left);
sceneManager->setMaxUISceneId(kUILoadingBarTest_Right_Scale9);
sceneManager->setMaxUISceneId(kUILoadingBarReloadTexture);
Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(scene);
}

View File

@ -397,3 +397,89 @@ bool UILoadingBarTest_Scale9_State_Change::init()
}
return false;
}
// UILoadingBarReloadTexture
UILoadingBarReloadTexture::UILoadingBarReloadTexture()
: _count(0)
{
}
UILoadingBarReloadTexture::~UILoadingBarReloadTexture()
{
}
bool UILoadingBarReloadTexture::init()
{
if (UIScene::init())
{
Size widgetSize = _widget->getContentSize();
// Add the alert
Text *alert = Text::create("Click button to Toggle Scale9 and switch Texture.", "fonts/Marker Felt.ttf", 20);
alert->setColor(Color3B(159, 168, 176));
alert->setPosition(Vec2(widgetSize.width / 2.0f,
widgetSize.height / 2.0f - alert->getContentSize().height * 2.7f));
_uiLayer->addChild(alert);
LoadingBar* loadingBar = LoadingBar::create("cocosui/slider_bar_active_9patch.png");
loadingBar->setTag(0);
loadingBar->ignoreContentAdaptWithSize(false);
// loadingBar->setScale9Enabled(true);
loadingBar->setCapInsets(Rect(0, 0, 0, 0));
loadingBar->setContentSize(Size(300, 13));
loadingBar->setName("texture0");
loadingBar->setDirection(LoadingBar::Direction::RIGHT);
loadingBar->setPercent(70);
loadingBar->setPosition(Vec2(widgetSize.width / 2.0f,
widgetSize.height / 2.0f + loadingBar->getContentSize().height / 4.0f));
_uiLayer->addChild(loadingBar);
auto buttonScale9 = Button::create("cocosui/animationbuttonnormal.png",
"cocosui/animationbuttonpressed.png");
buttonScale9->setTitleText("ToggleScale9");
buttonScale9->addClickEventListener([=](Ref*){
loadingBar->setScale9Enabled(!loadingBar->isScale9Enabled());
});
buttonScale9->setPosition(loadingBar->getPosition() + Vec2(-50,50));
_uiLayer->addChild(buttonScale9);
auto buttonChangeTexture = Button::create("cocosui/animationbuttonnormal.png",
"cocosui/animationbuttonpressed.png");
buttonChangeTexture->setTitleText("ChangeTexture");
buttonChangeTexture->addClickEventListener([=](Ref*){
auto name = loadingBar->getName();
if (name == "texture0")
{
loadingBar->loadTexture("cocosui/slider_bar_active_9patch2.png");
loadingBar->setName("texture1");
}
else
{
loadingBar->loadTexture("cocosui/slider_bar_active_9patch.png");
loadingBar->setName("texture0");
}
});
buttonChangeTexture->setPosition(loadingBar->getPosition() + Vec2(50,50));
_uiLayer->addChild(buttonChangeTexture);
this->scheduleUpdate();
return true;
}
return false;
}
void UILoadingBarReloadTexture::update(float delta)
{
_count++;
if (_count > 100)
{
_count = 0;
}
LoadingBar* loadingBar = static_cast<LoadingBar*>(_uiLayer->getChildByTag(0));
loadingBar->setPercent(_count);
}

View File

@ -104,7 +104,21 @@ public:
protected:
UI_SCENE_CREATE_FUNC(UILoadingBarTest_Scale9_State_Change)
int _count;
int _count;
};
class UILoadingBarReloadTexture : public UIScene
{
public:
UILoadingBarReloadTexture();
~UILoadingBarReloadTexture();
void update(float dt);
bool init();
protected:
UI_SCENE_CREATE_FUNC(UILoadingBarReloadTexture);
int _count;
};
#endif /* defined(__TestCpp__UILoadingBarTest__) */

View File

@ -71,6 +71,7 @@ static const char* s_testArray[] =
"UILoadingBarTest_Scale9_State_Change",
"UILoadingBarTest_Left_Scale9",
"UILoadingBarTest_Right_Scale9",
"UILoadingBarReloadTexture",
"UITextAtlasTest",
"UITextTest",
@ -284,6 +285,8 @@ Scene *UISceneManager::currentUIScene()
case kUILoadingBarTest_Right_Scale9:
return UILoadingBarTest_Right_Scale9::sceneWithTitle(s_testArray[_currentUISceneId]);
case kUILoadingBarReloadTexture:
return UILoadingBarReloadTexture::sceneWithTitle(s_testArray[_currentUISceneId]);
case kUITextAtlasTest:
return UITextAtlasTest::sceneWithTitle(s_testArray[_currentUISceneId]);

View File

@ -66,6 +66,7 @@ enum
kUILoadingBarTest_Scale9_State_Change,
kUILoadingBarTest_Left_Scale9,
kUILoadingBarTest_Right_Scale9,
kUILoadingBarReloadTexture,
kUITextAtlasTest,
kUITextTest,
kUITextTest_LineWrap,

View File

@ -426,7 +426,7 @@ bool UITextFieldTest_PlaceHolderColor::init()
Size widgetSize = _widget->getContentSize();
// Add a label in which the textfield events will be displayed
_displayValueLabel = Text::create("Set place hold color","fonts/Marker Felt.ttf",32);
_displayValueLabel = Text::create("You should see 16.50000, 34.0000 in the output window the first time you type","fonts/Marker Felt.ttf",12);
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f));
_uiLayer->addChild(_displayValueLabel);
@ -473,7 +473,10 @@ void UITextFieldTest_PlaceHolderColor::textFieldEvent(Ref *pSender, TextField::E
break;
case TextField::EventType::INSERT_TEXT:
{
_displayValueLabel->setString(String::createWithFormat("insert words")->getCString());
CCLOG("%f, %f", dynamic_cast<TextField*>(pSender)->getContentSize().width, dynamic_cast<TextField*>(pSender)->getContentSize().height);
}
break;
case TextField::EventType::DELETE_BACKWARD:

Binary file not shown.

View File

@ -0,0 +1,47 @@
<GameProjectFile>
<PropertyGroup Type="Node" Name="Animation" ID="2a4d9523-ddf0-453e-9409-3dbb8d333900" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="20" Speed="1.0000">
<Timeline ActionTag="-33769691" Property="Position">
<PointFrame FrameIndex="0" X="-564.9990" Y="380.0005" />
<PointFrame FrameIndex="20" X="57.8571" Y="-0.7137" />
</Timeline>
<Timeline ActionTag="-33769691" Property="Scale">
<ScaleFrame FrameIndex="0" X="1.0000" Y="1.0000" />
<ScaleFrame FrameIndex="20" X="1.0000" Y="1.0000" />
</Timeline>
<Timeline ActionTag="-33769691" Property="RotationSkew">
<ScaleFrame FrameIndex="0" X="0.0000" Y="0.0000" />
<ScaleFrame FrameIndex="20" X="0.0000" Y="0.0000" />
</Timeline>
</Animation>
<AnimationList>
<AnimationInfo Name="Move" StartIndex="0" EndIndex="20">
<RenderColor A="150" R="255" G="240" B="245" />
</AnimationInfo>
</AnimationList>
<ObjectData Name="Node" FrameEvent="" Tag="162" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="0.0000" Y="0.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Sprite_1" ActionTag="-33769691" FrameEvent="" Tag="163" ObjectIndex="1" LeftMargin="-587.9990" RightMargin="541.9990" TopMargin="-403.0005" BottomMargin="357.0005" ctype="SpriteObjectData">
<Position X="-564.9990" Y="380.0005" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="46.0000" Y="46.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Default" Path="Default/Sprite.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

View File

@ -0,0 +1,34 @@
<GameProjectFile>
<PropertyGroup Type="Scene" Name="TestAnimation" ID="af6d0383-1faa-4b7f-bcf6-d5f4568374b6" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="30" Speed="1.0000">
<Timeline ActionTag="-762514418" Property="ActionValue">
<InnerActionFrame FrameIndex="0" InnerActionType="LoopAction" CurrentAniamtionName="Move" SingleFrameIndex="0" />
<InnerActionFrame FrameIndex="30" InnerActionType="SingleFrame" CurrentAniamtionName="Move" SingleFrameIndex="0" />
</Timeline>
</Animation>
<ObjectData Name="Scene" FrameEvent="" Tag="164" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640.0000" Y="960.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="ProjectNode_1" ActionTag="-762514418" FrameEvent="" Tag="165" ObjectIndex="1" IconVisible="True" LeftMargin="714.5830" RightMargin="-74.5830" TopMargin="642.4999" BottomMargin="317.5002" ctype="ProjectNodeObjectData">
<Position X="714.5830" Y="317.5002" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="0.0000" Y="0.0000" />
<PrePosition X="1.1165" Y="0.3307" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Normal" Path="Animation.csd" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

View File

@ -0,0 +1,28 @@
<GameProjectFile>
<PropertyGroup Type="Scene" Name="TestNullProjectNode" ID="691cf8eb-87a6-4100-b178-07ab0993261f" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Scene" FrameEvent="" Tag="114" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640.0000" Y="960.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="ProjectNode_1" ActionTag="-181137099" FrameEvent="" Tag="146" ObjectIndex="1" IconVisible="True" ctype="ProjectNodeObjectData">
<Position X="131.6666" Y="523.3334" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="0.0000" Y="0.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

@ -1 +1 @@
Subproject commit 615f52a6c5fc1f60c6f01832d110c78a65be3a11
Subproject commit ce5606d4e520d2671a678b0ba3d5a0b84fdb5ab9

Binary file not shown.

View File

@ -0,0 +1,47 @@
<GameProjectFile>
<PropertyGroup Type="Node" Name="Animation" ID="2a4d9523-ddf0-453e-9409-3dbb8d333900" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="20" Speed="1.0000">
<Timeline ActionTag="-33769691" Property="Position">
<PointFrame FrameIndex="0" X="-564.9990" Y="380.0005" />
<PointFrame FrameIndex="20" X="57.8571" Y="-0.7137" />
</Timeline>
<Timeline ActionTag="-33769691" Property="Scale">
<ScaleFrame FrameIndex="0" X="1.0000" Y="1.0000" />
<ScaleFrame FrameIndex="20" X="1.0000" Y="1.0000" />
</Timeline>
<Timeline ActionTag="-33769691" Property="RotationSkew">
<ScaleFrame FrameIndex="0" X="0.0000" Y="0.0000" />
<ScaleFrame FrameIndex="20" X="0.0000" Y="0.0000" />
</Timeline>
</Animation>
<AnimationList>
<AnimationInfo Name="Move" StartIndex="0" EndIndex="20">
<RenderColor A="150" R="255" G="240" B="245" />
</AnimationInfo>
</AnimationList>
<ObjectData Name="Node" FrameEvent="" Tag="162" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="0.0000" Y="0.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Sprite_1" ActionTag="-33769691" FrameEvent="" Tag="163" ObjectIndex="1" LeftMargin="-587.9990" RightMargin="541.9990" TopMargin="-403.0005" BottomMargin="357.0005" ctype="SpriteObjectData">
<Position X="-564.9990" Y="380.0005" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="46.0000" Y="46.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Default" Path="Default/Sprite.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -23,7 +23,9 @@ local CameraType =
local scheduler = cc.Director:getInstance():getScheduler()
local Camera3DTestDemo = class("Camera3DTestDemo", function ()
return cc.Layer:create()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer
end)
function Camera3DTestDemo:ctor()
@ -442,6 +444,9 @@ function Camera3DTestDemo:onExit()
end
function Camera3DTestDemo:init()
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
self:registerScriptHandler(function (event)
if event == "enter" then
self:onEnter()
@ -451,10 +456,625 @@ function Camera3DTestDemo:init()
end)
end
local CameraRotationTest = class("CameraRotationTest", function ()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer
end)
function CameraRotationTest:ctor()
-- body
self:init()
end
function CameraRotationTest:init()
-- body
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
self:registerScriptHandler(function (event)
if event == "enter" then
self:onEnter()
elseif event == "exit" then
self:onExit()
end
end)
end
function CameraRotationTest:onEnter()
local s = cc.Director:getInstance():getWinSize()
camControlNode = cc.Node:create()
camControlNode:setNormalizedPosition(cc.p(0.5, 0.5))
self:addChild(camControlNode)
camNode = cc.Node:create()
camNode:setPositionZ(cc.Camera:getDefaultCamera():getPosition3D().z)
camControlNode:addChild(camNode)
local sp3d = cc.Sprite3D:create()
sp3d:setPosition(s.width/2, s.height/2)
self:addChild(sp3d)
local lship = cc.Label:create()
lship:setString("Ship")
lship:setPosition(0, 20)
sp3d:addChild(lship)
--Billboards
--Yellow is at the back
bill1 = cc.BillBoard:create("Images/Icon.png")
bill1:setPosition3D(cc.vec3(s.width/2 + 50, s.height/2 + 10, -10))
bill1:setColor(cc.c3b(255, 255, 0))
bill1:setScale(0.6)
self:addChild(bill1)
l1 = cc.Label:create()
l1:setPosition(cc.p(0,-10))
l1:setString("Billboard1")
l1:setColor(cc.c3b(255, 255, 255))
l1:setScale(3)
bill1:addChild(l1)
local p1 = cc.ParticleSystemQuad:create("Particles/SmallSun.plist")
p1:setPosition(30,80)
bill1:addChild(p1)
bill2 = cc.BillBoard:create("Images/Icon.png")
bill2:setPosition3D(cc.vec3(s.width/2 - 50, s.height/2 - 10, 10))
bill2:setScale(0.6)
self:addChild(bill2)
l2 = cc.Label:create()
l2:setString("Billboard2")
l2:setPosition(cc.p(0,-10))
l2:setColor(cc.c3b(255, 255, 255))
l2:setScale(3)
bill2:addChild(l2)
local p2 = cc.ParticleSystemQuad:create("Particles/SmallSun.plist")
p2:setPosition(30,80)
bill2:addChild(p2)
--3D models
local model = cc.Sprite3D:create("Sprite3DTest/boss1.obj")
model:setScale(4)
model:setTexture("Sprite3DTest/boss.png")
model:setPosition3D(cc.vec3(s.width/2, s.height/2, 0))
self:addChild(model)
--Listener
lis = cc.EventListenerTouchOneByOne:create()
lis:registerScriptHandler(function (touch, event)
return true
end,cc.Handler.EVENT_TOUCH_BEGAN )
lis:registerScriptHandler(function (touch, event)
local dx = touch:getDelta().x
local rot = camControlNode:getRotation3D()
rot.y = rot.y + dx
camControlNode:setRotation3D(rot)
local worldPos = cc.vec3(0.0, 0.0, 0.0)
local decompose = cc.mat4.new(camNode:getNodeToWorldTransform()):decompose(nil, nil, worldPos)
worldPos = decompose.translation
cc.Camera:getDefaultCamera():setPosition3D(worldPos)
cc.Camera:getDefaultCamera():lookAt(camControlNode:getPosition3D())
end, cc.Handler.EVENT_TOUCH_MOVED)
local eventDispatcher = self:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(lis, self)
end
function CameraRotationTest:onExit()
end
function CameraRotationTest:title()
return "Camera Rotation Test"
end
function CameraRotationTest:subtitle()
return "Slide to rotate"
end
local FogTestDemo = class("FogTestDemo", function ()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer
end)
function FogTestDemo:ctor()
-- body
self:init()
end
function FogTestDemo:init()
-- body
self._layer3D = nil
self._cameraType = CameraType.FreeCamera
self._camera = nil
self._shader = nil
self._state = nil
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
self:registerScriptHandler(function (event)
if event == "enter" then
self:onEnter()
elseif event == "exit" then
self:onExit()
end
end)
end
function FogTestDemo:setEventListener()
local listener = cc.EventListenerTouchAllAtOnce:create()
listener:registerScriptHandler(function(touches, event)
if #touches == 1 then
local touch = touches[1]
local prelocation = touch:getPreviousLocationInView()
local location = touch:getLocationInView()
local newPos = cc.p(prelocation.x - location.x, prelocation.y - location.y)
if self._cameraType == CameraType.FreeCamera then
local transformMat = self._camera:getNodeToWorldTransform()
local cameraDir = { x = -transformMat[9], y = -transformMat[10], z = -transformMat[11] }
cameraDir = cc.vec3normalize(cameraDir)
cameraDir.y = 0
transformMat = self._camera:getNodeToWorldTransform()
local cameraRightDir = { x = transformMat[1], y = transformMat[2], z = transformMat[3]}
cameraRightDir = cc.vec3normalize(cameraRightDir)
cameraRightDir.y = 0
local cameraPos = self._camera:getPosition3D()
cameraPos = {x = cameraPos.x - cameraDir.x * newPos.y * 0.1, y = cameraPos.y - cameraDir.y * newPos.y * 0.1, z = cameraPos.z - cameraDir.z * newPos.y * 0.1}
cameraPos = {x = cameraPos.x + cameraRightDir.x * newPos.x * 0.1, y = cameraPos.y + cameraRightDir.y * newPos.x * 0.1, z = cameraPos.z + cameraRightDir.z * newPos.x * 0.1}
self._camera:setPosition3D(cameraPos)
end
end
end, cc.Handler.EVENT_TOUCHES_MOVED)
local eventDispatcher = self:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
end
function FogTestDemo:createMenu()
-- body
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 20
local label1 = cc.Label:createWithTTF(ttfConfig,"Linear ")
local menuItem1 = cc.MenuItemLabel:create(label1)
menuItem1:registerScriptTapHandler(function (tag, sender )
self._state:setUniformVec4("u_fogColor", cc.vec4(0.5,0.5,0.5,1.0))
self._state:setUniformFloat("u_fogStart",10)
self._state:setUniformFloat("u_fogEnd",60)
self._state:setUniformInt("u_fogEquation" ,0)
self._sprite3D1:setGLProgramState(self._state)
self._sprite3D2:setGLProgramState(self._state)
end)
local label2 = cc.Label:createWithTTF(ttfConfig,"Exp")
local menuItem2 = cc.MenuItemLabel:create(label2)
menuItem2:registerScriptTapHandler(function (tag, sender )
self._state:setUniformVec4("u_fogColor", cc.vec4(0.5,0.5,0.5,1.0))
self._state:setUniformFloat("u_fogDensity",0.03)
self._state:setUniformInt("u_fogEquation" ,1)
self._sprite3D1:setGLProgramState(self._state)
self._sprite3D2:setGLProgramState(self._state)
end)
local label3 = cc.Label:createWithTTF(ttfConfig,"Exp2")
local menuItem3 = cc.MenuItemLabel:create(label3)
menuItem3:registerScriptTapHandler(function (tag, sender )
self._state:setUniformVec4("u_fogColor", cc.vec4(0.5,0.5,0.5,1.0))
self._state:setUniformFloat("u_fogDensity",0.03)
self._state:setUniformInt("u_fogEquation" ,2)
self._sprite3D1:setGLProgramState(self._state)
self._sprite3D2:setGLProgramState(self._state)
end)
local menu = cc.Menu:create(menuItem1, menuItem2, menuItem3)
menu:setPosition(cc.p(0.0, 0.0))
menuItem1:setPosition(VisibleRect:left().x + 60, VisibleRect:top().y - 50)
menuItem2:setPosition(VisibleRect:left().x + 60, VisibleRect:top().y - 100)
menuItem3:setPosition(VisibleRect:left().x + 60, VisibleRect:top().y - 150)
self:addChild(menu, 0)
end
function FogTestDemo:createLayer3D()
-- body
local s = cc.Director:getInstance():getWinSize()
local layer3D = cc.Layer:create()
self:addChild(layer3D,0)
self._layer3D = layer3D
self._shader = cc.GLProgram:createWithFilenames("Sprite3DTest/fog.vert","Sprite3DTest/fog.frag")
self._state = cc.GLProgramState:create(self._shader)
self._sprite3D1 = cc.Sprite3D:create("Sprite3DTest/teapot.c3b")
self._sprite3D2 = cc.Sprite3D:create("Sprite3DTest/teapot.c3b")
self._sprite3D1:setGLProgramState(self._state)
self._sprite3D2:setGLProgramState(self._state)
--pass mesh's attribute to shader
local attributeNames =
{
"a_position",
"a_color",
"a_texCoord",
"a_texCoord1",
"a_texCoord2",
"a_texCoord3",
"a_normal",
"a_blendWeight",
"a_blendIndex",
}
local offset = 0
local attributeCount = self._sprite3D1:getMesh():getMeshVertexAttribCount()
for i = 1, attributeCount do
local meshattribute = self._sprite3D1:getMesh():getMeshVertexAttribute(i - 1)
self._state:setVertexAttribPointer(attributeNames[meshattribute.vertexAttrib + 1],
meshattribute.size,
meshattribute.type,
false,
self._sprite3D1:getMesh():getVertexSizeInBytes(),
offset)
offset = offset + meshattribute.attribSizeBytes
end
local offset1 = 0
local attributeCount1 = self._sprite3D2:getMesh():getMeshVertexAttribCount()
for i = 1, attributeCount1 do
local meshattribute = self._sprite3D2:getMesh():getMeshVertexAttribute(i - 1)
self._state:setVertexAttribPointer(attributeNames[meshattribute.vertexAttrib + 1],
meshattribute.size,
meshattribute.type,
false,
self._sprite3D2:getMesh():getVertexSizeInBytes(),
offset1)
offset1 = offset1 + meshattribute.attribSizeBytes
end
self._state:setUniformVec4("u_fogColor", cc.vec4(0.5,0.5,0.5,1.0))
self._state:setUniformFloat("u_fogStart",10)
self._state:setUniformFloat("u_fogEnd",60)
self._state:setUniformInt("u_fogEquation" ,0)
self._layer3D:addChild(self._sprite3D1)
self._sprite3D1:setPosition3D( cc.vec3( 0, 0,0 ) )
self._sprite3D1:setScale(2.0)
self._sprite3D1:setRotation3D(cc.vec3(-90,180,0))
self._layer3D:addChild(self._sprite3D2)
self._sprite3D2:setPosition3D( cc.vec3( 0, 0,-20 ) )
self._sprite3D2:setScale(2.0)
self._sprite3D2:setRotation3D(cc.vec3(-90,180,0))
if self._camera == nil then
self._camera = cc.Camera:createPerspective(60, s.width/s.height, 1, 1000)
self._camera:setCameraFlag(cc.CameraFlag.USER1)
self._camera:setPosition3D(cc.vec3(0, 30, 40))
self._camera:lookAt(cc.vec3(0,0,0), cc.vec3(0, 1, 0))
self._layer3D:addChild(self._camera)
end
self._layer3D:setCameraMask(2)
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
if targetPlatform == cc.PLATFORM_OS_ANDROID or targetPlatform == cc.PLATFORM_OS_WINRT or targetPlatform == cc.PLATFORM_OS_WP8 then
self._backToForegroundListener = cc.EventListenerCustom:create("event_renderer_recreated", function (eventCustom)
-- body
cc.Director:getInstance():setClearColor(cc.c4f(0.5,0.5,0.5,1))
local glProgram = self._state:getGLProgram()
glProgram:reset()
glProgram:initWithFilenames("Sprite3DTest/fog.vert","Sprite3DTest/fog.frag")
glProgram:link()
glProgram:updateUniforms()
self._state:setUniformVec4("u_fogColor", cc.vec4(0.5,0.5,0.5,1.0))
self._state:setUniformFloat("u_fogStart",10)
self._state:setUniformFloat("u_fogEnd",60)
self._state:setUniformInt("u_fogEquation" ,0)
end)
cc.Director:getInstance():getEventDispatcher():addEventListenerWithFixedPriority(self._backToForegroundListener, -1)
end
end
function FogTestDemo:onEnter()
cc.Director:getInstance():setClearColor(cc.c4f(0.5,0.5,0.5,1))
self:setEventListener()
self:createMenu()
self:createLayer3D()
end
function FogTestDemo:onExit()
cc.Director:getInstance():setClearColor(cc.c4f(0,0,0,1))
if nil ~= self._camera then
self._camera = nil
end
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
if targetPlatform == cc.PLATFORM_OS_ANDROID or targetPlatform == cc.PLATFORM_OS_WINRT or targetPlatform == cc.PLATFORM_OS_WP8 then
cc.Director:getInstance():getEventDispatcher():removeEventListener(self._backToForegroundListener)
end
end
function FogTestDemo:title()
return "Fog Test Demo"
end
function FogTestDemo:subtitle()
return ""
end
local OperateCamType =
{
MoveCamera = 0,
RotateCamera = 1,
}
local CameraArcBallDemo = class("CameraArcBallDemo", function ()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer
end)
function CameraArcBallDemo:ctor()
-- body
self:init()
end
function CameraArcBallDemo:init()
self._layer3D = nil
self._cameraType = CameraType.FreeCamera
self._camera = nil
self._drawGrid = nil
self._sprite3D1 = nil
self._sprite3D2 = nil
self._radius = 1.0
self._distanceZ = 50.0
self._operate = OperateCamType.RotateCamera
self._center = cc.vec3(0, 0, 0)
self._target = 0
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
self:registerScriptHandler(function (event)
if event == "enter" then
self:onEnter()
elseif event == "exit" then
self:onExit()
end
end)
end
function CameraArcBallDemo:projectToSphere(r, x, y)
local d, t, z
d = math.sqrt(x*x + y*y)
--inside sphere
if d < r * 0.70710678118654752440 then
z = math.sqrt(r*r - d*d)
else--on hyperbola
t = r / 1.41421356237309504880
z = t*t / d
end
return z
end
function CameraArcBallDemo:calculateArcBall(axis, angle, p1x, p1y, p2x, p2y)
local rotation_matrix = cc.mat4.createRotation(self._rotationQuat, cc.mat4.createIdentity())
--rotation y
local uv = mat4_transformVector(rotation_matrix , 0.0, 1.0, 0.0, 0.0, cc.vec3(0.0, 0.0, 0.0))
--rotation x
local sv = mat4_transformVector(rotation_matrix, 1.0, 0.0, 0.0, 0.0, cc.vec3(0.0, 0.0, 0.0))
--rotation z
local lv = mat4_transformVector(rotation_matrix, 0.0, 0.0, -1.0, 0.0, cc.vec3(0.0, 0.0, 0.0))
--start point screen transform to 3d
local projectZ1 = self:projectToSphere(self._radius, p1x, p1y)
local p1 = cc.vec3(sv.x * p1x + uv.x * p1y - lv.x * projectZ1, sv.y * p1x + uv.y * p1y - lv.y * projectZ1 , sv.z * p1x + uv.z * p1y - lv.z * projectZ1)
--end point screen transform to 3d
local projectZ2 = self:projectToSphere(self._radius, p2x, p2y)
local p2 = cc.vec3(sv.x * p2x + uv.x * p2y - lv.x * projectZ2, sv.y * p2x + uv.y * p2y - lv.y * projectZ2 , sv.z * p2x + uv.z * p2y - lv.z * projectZ2)
--calculate rotation axis
axis = vec3_cross(p2, p1, axis)
axis = cc.vec3normalize(axis)
local t = math.sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y) + (p2.z - p1.z) * (p2.z - p1.z)) / (2.0 * self._radius)
--clamp -1 to 1
if t > 1.0 then
t = 1.0
end
if t < -1.0 then
t = -1.0
end
--rotation angle
angle = math.asin(t)
return axis, angle
end
function CameraArcBallDemo:setEventListener()
local listener = cc.EventListenerTouchAllAtOnce:create()
listener:registerScriptHandler(function(touchs, event)
if #touchs ~= 0 then
if self._operate == OperateCamType.RotateCamera then
local visibleSize = cc.Director:getInstance():getVisibleSize()
local prelocation = touchs[1]:getPreviousLocationInView()
local location = touchs[1]:getLocationInView()
location.x = 2.0 * (location.x) / (visibleSize.width) - 1.0
location.y = 2.0 * (visibleSize.height - location.y) / (visibleSize.height) - 1.0
prelocation.x = 2.0 * (prelocation.x) / (visibleSize.width) - 1.0
prelocation.y = 2.0 * (visibleSize.height - prelocation.y) / (visibleSize.height) - 1.0
local axes = cc.vec3(0,0,0)
local angle = 0.0
--calculate rotation quaternion parameters
axes , angle = self:calculateArcBall(axes, angle, prelocation.x, prelocation.y, location.x, location.y)
--get rotation quaternion
local halfAngle = angle * 0.5
local sinHalfAngle = math.sin(math.deg(halfAngle))
local normal = axes
normal = cc.vec3normalize(normal)
local quat = cc.quaternion(normal.x * sinHalfAngle, normal.y * sinHalfAngle, normal.z * sinHalfAngle, math.cos(math.deg(halfAngle)))
local x = quat.w * self._rotationQuat.x + quat.x * self._rotationQuat.w + quat.y * self._rotationQuat.z - quat.z * self._rotationQuat.y
local y = quat.w * self._rotationQuat.y - quat.x * self._rotationQuat.z + quat.y * self._rotationQuat.w + quat.z * self._rotationQuat.x
local z = quat.w * self._rotationQuat.z + quat.x * self._rotationQuat.y - quat.y * self._rotationQuat.x + quat.z * self._rotationQuat.w
local w = quat.w * self._rotationQuat.w - quat.x * self._rotationQuat.x - quat.y * self._rotationQuat.y - quat.z * self._rotationQuat.z
self._rotationQuat = cc.quaternion(x, y, z, w)
self:updateCameraTransform()
elseif self._operate == OperateCamType.MoveCamera then
local previousLocation = touchs[1]:getPreviousLocation()
local location = touchs[1]:getLocation()
local newPos = cc.p(previousLocation.x - location.x, previousLocation.y - location.y)
self._distanceZ = self._distanceZ - newPos.y * 0.1
self:updateCameraTransform()
end
end
end, cc.Handler.EVENT_TOUCHES_MOVED)
local eventDispatcher = self:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
end
function CameraArcBallDemo:createLayer3D()
local s = cc.Director:getInstance():getWinSize()
cc.MenuItemFont:setFontName("fonts/arial.ttf")
cc.MenuItemFont:setFontSize(20)
local menuItem1 = cc.MenuItemFont:create("Switch Operation")
menuItem1:setColor(cc.c3b(0,200,20))
menuItem1:registerScriptTapHandler(function (tag, sender )
if self._operate == OperateCamType.MoveCamera then
self._operate = OperateCamType.RotateCamera
elseif self._operate == OperateCamType.RotateCamera then
self._operate = OperateCamType.MoveCamera
end
end)
local menuItem2 = cc.MenuItemFont:create("Switch Target")
menuItem2:setColor(cc.c3b(0,200,20))
menuItem2:registerScriptTapHandler(function (tag, sender )
if self._target == 0 then
self._target = 1
self._center = self._sprite3D2:getPosition3D()
self:updateCameraTransform()
elseif self._target == 1 then
self._target = 0
self._center = self._sprite3D1:getPosition3D()
self:updateCameraTransform()
end
end)
local menu = cc.Menu:create(menuItem1,menuItem2)
menu:setPosition(cc.p(0.0, 0.0))
menuItem1:setPosition(VisibleRect:left().x + 80, VisibleRect:top().y -70)
menuItem2:setPosition(VisibleRect:left().x + 80, VisibleRect:top().y -100)
self:addChild(menu, 1)
local layer3D = cc.Layer:create()
self:addChild(layer3D,0)
self._layer3D = layer3D
if self._camera == nil then
self._camera = cc.Camera:createPerspective(60, s.width/s.height, 1, 1000)
self._camera:setCameraFlag(cc.CameraFlag.USER1)
self._camera:setPosition3D(cc.vec3(0, 10, 50))
self._camera:lookAt(cc.vec3(0, 0, 0), cc.vec3(0, 1, 0))
self._layer3D:addChild(self._camera)
end
self._sprite3D1 = cc.Sprite3D:create("Sprite3DTest/orc.c3b")
self._sprite3D1:setScale(0.5)
self._sprite3D1:setRotation3D(cc.vec3(0,180,0))
self._sprite3D1:setPosition3D(cc.vec3(0,0,0))
self._layer3D:addChild(self._sprite3D1)
self._sprite3D2 = cc.Sprite3D:create("Sprite3DTest/boss.c3b")
self._sprite3D2:setScale(0.6)
self._sprite3D2:setRotation3D(cc.vec3(-90,0,0))
self._sprite3D2:setPosition3D(cc.vec3(20,0,0))
self._layer3D:addChild(self._sprite3D2)
self._drawGrid = cc.DrawNode3D:create()
--draw x
for j = -20, 20 do
self._drawGrid:drawLine(cc.vec3(-100, 0, 5*j), cc.vec3(100, 0, 5*j),cc.c4f(1, 0, 0, 1))
end
--draw z
for j = -20, 20 do
self._drawGrid:drawLine(cc.vec3(5*j, 0, -100), cc.vec3(5*j, 0, 100),cc.c4f(0,0,1,1))
end
--draw y
self._drawGrid:drawLine(cc.vec3(0, 0, 0), cc.vec3(0,50,0), cc.c4f(0,1,0,1))
self._layer3D:addChild(self._drawGrid)
self._layer3D:setCameraMask(2)
self:updateCameraTransform()
end
function CameraArcBallDemo:updateCameraTransform()
-- body
local trans = cc.mat4.createTranslation(cc.vec3(0.0, 10.0, self._distanceZ), cc.mat4.createIdentity())
local rot = cc.mat4.createRotation(self._rotationQuat, cc.mat4.createIdentity())
local center = cc.mat4.createTranslation(self._center, cc.mat4.createIdentity())
local result = cc.mat4.new(center:multiply(rot)):multiply(trans)
self._camera:setNodeToParentTransform(result)
end
function CameraArcBallDemo:onEnter()
self._rotationQuat = cc.quaternion(0.0, 0.0, 0.0, 1.0)
self:setEventListener()
self:createLayer3D()
end
function CameraArcBallDemo:onExit()
if self._camera ~= nil then
self._camera = nil
end
end
function CameraArcBallDemo:title()
return "Camera ArcBall Moving"
end
function CameraArcBallDemo:subtitle()
return ""
end
function Camera3DTestMain()
cclog("Camera3DTestMain")
local scene = cc.Scene:create()
scene:addChild(Camera3DTestDemo.new())
Helper.createFunctionTable =
{
Camera3DTestDemo.create,
CameraRotationTest.create,
FogTestDemo.create,
CameraArcBallDemo.create,
}
scene:addChild(Helper.createFunctionTable[1]())
scene:addChild(CreateBackMenuItem())

View File

@ -919,6 +919,113 @@ function Sprite3DMirrorTest.create()
return layer
end
----------------------------------------
----AsyncLoadSprite3DTest
----------------------------------------
local AsyncLoadSprite3DTest = class("AsyncLoadSprite3DTest", function ()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer
end)
function AsyncLoadSprite3DTest:ctor()
-- body
self:init()
end
function AsyncLoadSprite3DTest:init()
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
self:registerScriptHandler(function (event)
if event == "enter" then
self:onEnter()
elseif event == "exit" then
self:onExit()
end
end)
end
function AsyncLoadSprite3DTest:title()
return "Testing Sprite3D:createAsync"
end
function AsyncLoadSprite3DTest:subtitle()
return ""
end
function AsyncLoadSprite3DTest:onEnter()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 15
local paths = {"Sprite3DTest/boss.obj", "Sprite3DTest/girl.c3b", "Sprite3DTest/orc.c3b", "Sprite3DTest/ReskinGirl.c3b", "Sprite3DTest/axe.c3b"}
local label1 = cc.Label:createWithTTF(ttfConfig,"AsyncLoad Sprite3D")
local item1 = cc.MenuItemLabel:create(label1)
function menuCallback_asyncLoadSprite(tag, sender)
--Note that you must stop the tasks before leaving the scene.
cc.AsyncTaskPool:getInstance():stopTasks(cc.AsyncTaskPool.TaskType.TASK_IO)
local node = self:getChildByTag(101)
--remove all loaded sprite
node:removeAllChildren()
--remove cache data
cc.Sprite3DCache:getInstance():removeAllSprite3DData()
local function callback(sprite, index)
local node = self:getChildByTag(101)
local s = cc.Director:getInstance():getWinSize()
local width = s.width / (#paths)
local point = cc.p(width * (0.5 + index), s.height / 2.0)
sprite:setPosition(point)
node:addChild(sprite)
end
cc.Sprite3D:createAsync(paths[1], function(sprite)
callback(sprite, 0)
end)
cc.Sprite3D:createAsync(paths[2], function(sprite)
callback(sprite, 1)
end)
cc.Sprite3D:createAsync(paths[3], function(sprite)
callback(sprite, 2)
end)
cc.Sprite3D:createAsync(paths[4], function(sprite)
callback(sprite, 3)
end)
cc.Sprite3D:createAsync(paths[5], function(sprite)
callback(sprite, 4)
end)
end
item1:registerScriptTapHandler(menuCallback_asyncLoadSprite)
local s = cc.Director:getInstance():getWinSize()
item1:setPosition( s.width * 0.5, s.height * 0.8)
local menu = cc.Menu:create(item1)
menu:setPosition(cc.p(0,0))
self:addChild(menu, 10)
local node = cc.Node:create()
node:setTag(101)
self:addChild(node)
menuCallback_asyncLoadSprite()
end
function AsyncLoadSprite3DTest:onExit()
end
function Sprite3DTest()
local scene = cc.Scene:create()
@ -932,6 +1039,7 @@ function Sprite3DTest()
Sprite3DReskinTest.create,
Sprite3DWithOBBPerfromanceTest.create,
Sprite3DMirrorTest.create,
AsyncLoadSprite3DTest.create
}
scene:addChild(Sprite3DBasicTest.create())

View File

@ -22,11 +22,11 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/base/CCAsyncTaskPool.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$ AsyncTaskPool
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also

View File

@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/cocos2d.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard
classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard Sprite3DCache
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@ -35,11 +35,12 @@ classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = Mesh::[create getAABB getVertexBuffer hasVertexAttrib getMeshVertexAttribCount getMeshVertexAttribute getVertexSizeInBytes getSkin getMeshIndexData getGLProgramState getPrimitiveType getIndexCount getIndexFormat getIndexBuffer],
Sprite3D::[getSkin getAABB getMeshArrayByName],
skip = Mesh::[create getAABB getVertexBuffer hasVertexAttrib getSkin getMeshIndexData getGLProgramState getPrimitiveType getIndexCount getIndexFormat getIndexBuffer],
Sprite3D::[getSkin getAABB getMeshArrayByName createAsync],
Skeleton3D::[create],
Animation3D::[getBoneCurveByName],
BillBoard::[draw]
BillBoard::[draw],
Sprite3DCache::[addSprite3DData getSpriteData]
rename_functions =