Metal support RC0 released

Amazing!!
Thank you very much.

I want to try the lower version again.

spine 3.8

I actually have the spine-cocos2dx runtime structured in such a way that it automatically builds the correct code depending on whether itā€™s v3 or v4 of Cocos2d-x.

image

Each spine folder has these files:
image

The v3 version is just the official release from the spine runtimes repository here

The CMakeLists.txt I use is this:

get_target_property(COCOS2D_X_VERSION cocos2d VERSION)

if (COCOS2D_X_VERSION VERSION_GREATER_EQUAL 4.0)
	set(SPINE_COCOS_X_VERSION_DIR "v4")
else()
	set(SPINE_COCOS_X_VERSION_DIR "v3")
endif()

set(SPINE_COCOS2DX_HEADER
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/AttachmentVertices.h
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/SkeletonAnimation.h
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/SkeletonBatch.h
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/SkeletonRenderer.h
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/SkeletonTwoColorBatch.h
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/spine-cocos2dx.h
   )

set(SPINE_COCOS2DX_SRC
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/AttachmentVertices.cpp
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/SkeletonAnimation.cpp
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/SkeletonBatch.cpp
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/SkeletonRenderer.cpp
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/SkeletonTwoColorBatch.cpp
    ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src/spine/spine-cocos2dx.cpp
   )


list(APPEND SPINE_COCOS2DX_SRC ${SPINE_COCOS2DX_HEADER})

add_library(spine-cocos2dx-static STATIC ${SPINE_COCOS2DX_SRC})

set_target_properties(spine-cocos2dx-static
    PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

add_dependencies(spine-cocos2dx-static spine-static cocos2d)

target_link_libraries(spine-cocos2dx-static 
	PUBLIC spine-static 
	PRIVATE cocos2d
)
target_include_directories(spine-cocos2dx-static PUBLIC ${CMAKE_CURRENT_LIST_DIR}/${SPINE_COCOS_X_VERSION_DIR}/src)

This setup works for me, but Iā€™m certain there are other ways to set this all up that would also work.

In your root CMakeLists.txt, just add the spine library this way:

# spine cocos2d-x specific
add_subdirectory(${GAME_ROOT_PATH}/external/spine-cocos2dx ${PROJECT_BINARY_DIR}/spine-cocos2dx)
get_target_property(spine_cocos2dx_INCLUDE_DIRS spine-cocos2dx-static INTERFACE_INCLUDE_DIRECTORIES)

target_include_directories(${APP_NAME} PRIVATE ${spine_cocos2dx_INCLUDE_DIRS})
target_link_libraries(${APP_NAME} spine-cocos2dx-static)

you are awsome!!


lolā€¦666ā€¦

Hi! Thank you very much for the release, itā€™s great to see a new version! Iā€™ve noticed that on the v4 branch on github the html5/javascript implementation disappeared, is it JS dropped in this version or will it come later?
Happy to contribute to keep things rolling :slight_smile:!

JS is dropped in favor of Cocos Creator.

1 Like

SHADER Shader shader
There are still many problems.

Sprite ----ok
Spine ā€”donā€™t work
CocoStuido ā€” donā€™t work
LayerColor . ā€”I donā€™t know

@18180920700 can you provide some test cases?

I think Shader has a lot of problemsā€¦

example:

  1. Two shaders replace each other.
  2. Dynamic parameters transfer, such as: CC_Time

333

This is the cause of shader failure (Dynamic parameters transfer).

_programState->setUniform(_locUTime, &u_Time, sizeof(u_Time));

If the shader(e.gā€¦ update CC_Time) fails, comment out the ā€œreset()ā€, thatā€™s fine, BUT Leak !

Cocostudio
4444

Spine

It canā€™t be changed. Itā€™s called ā€œwrite to deathā€ in Chinese.

@18180920700 It would be easier if you copied and pasted code segments, rather than screenshots, and use the code formatting tags in the post to make it readable. Itā€™s tough to figure out the context of what you just posted, so what is the old code, and what is the new code with the fixes?

It canā€™t be changed.

Itā€™s called ā€œwrite to deathā€ in Chinese.

iā€™ve edited it

Where is that shader? I canā€™t find it in the Spine code. Is it your own shader?

Commenting out ā€œReset()ā€ may not be the actual fix. Commenting it out could simply be covering up the actual problem, which is more likely to be related to that shader snippet you posted.

void SkeletonBatch::update (float delta)
{
//++++++++++++++++
_programState->setUniform(_locUTime, &u_Time, sizeof(u_Time));
//++++++++++++++++
//reset();
}

That does not exist in the cocos2d-x spine runtime, so Iā€™m assuming itā€™s your own shader.

Posting up that commenting reset() is some fix for a very specific issue in your own custom code could mislead others into thinking that itā€™s a problem with the run-time code, when it is in fact not.

No problem with the code. But there are problems with shaderā€™s need for dynamic parameter transfer, such as shader animation, where parameters are not refresh. I looked at the example(ShaderTest initProgram.cpp). Update dynamic parameters like this:

Perhaps you should create a specific thread about your issue as this is a general thread about the RC0 release.

But I donā€™t know how to do it.:咧ē€å˜“ē¬‘:

I donā€™t think thatā€™s a special case. When you use Shader Animation you will encounter it.

Your issue isnā€™t about the RC0 in general so belongs in its own thread.