Commit Graph

1113 Commits

Author SHA1 Message Date
SongChengJiang af8b9cc47c Support MultiView matrix array (#16723)
* Support MultiView matrix array

Support MultiView matrix array and add new interface in GLProgram to
support shader header definitions.

* support getMatrixStackSize

* optimize code

* remove indents

* rename resetMatrixStack(unsigned int stackCount)

* Add document to interfaces

* Supplement document of render interface
2016-10-28 09:33:31 +08:00
Wilson E. Alvarez c0e1e91373 Performance tweak: Use range-based for-loops and allocate std::vector size() and *end() on the stack where favorable. (#16716)
* Use range-based for-loops and allocate std::vector size(), end(), cend(), rend(), crend() on the stack where favorable.

Other minor trivial changes were applied.

* Fixed Android compilation error

* Fixed windows-universal compilation error
2016-10-27 15:10:24 +08:00
mogemimi 5b8919829c Fix typos in local variables (#16712) 2016-10-20 18:17:37 +08:00
mogemimi 63b3043dc0 Remove extra semicolon after member function definition (#16595) 2016-09-20 14:43:48 +08:00
Steve Tranby 2776d1e715 XCode sometimes gets confused with multiple 'Rect' types (#16579) 2016-09-14 10:46:17 -07:00
Jun Hyeon, Nam 4342aabe28 remove unnecessary comments (#16572) 2016-09-14 10:42:25 -07:00
mogemimi eca7b2392d Remove unnecessary inline keywords (#16562) 2016-09-12 09:44:21 +08:00
David DeSimone feb48aea9c Improving CCRef LEAK_DETECTION tools by making them thread safe. It is possible that ref's can be created and mutated off thread, and with leak detection on. This can cause ungaurded writes from two or more threads to a non-protected structure. Fixing a crash on iOS when using std::list instead of std::vector. (#16415) 2016-08-30 09:36:45 +08:00
Ricardo Quesada 9dea92b2e0 feat: add support for Game Controllers on Mac (#16461)
it shares 100% the same code with iOS.
it only adds a few #ifdefs.

github issue #16460
2016-08-29 16:58:44 -07:00
minggo 04fd2b16b2 merge v3.13 back to v3 2016-08-29 11:57:13 +08:00
mogemimi a9a8add717 Add missing class declaration and remove duplicate declaration (#16423) 2016-08-24 18:09:29 +08:00
pandamicro f0be4f3069 Merge part of Cocos2d-x-lite (#16380)
* Update js auto binding settings with new ndk version

* Remove unnecessary property from Ref

* Merge part of Cocos2d-x-lite :
1. Improve network bindings
2. Use nullptr instead of NULL
3. Remove usage of some deprecated APIs
4. Add some defensive code and cleanup

* Fix spine track entry circle referencing issue

* cocos2d/cocos2d-x#16327: Fix global object leak issue in JSB

* Improve ScriptingCore::evalString, old implementation have been deprecated in Spidermonkey

* Update JS versions

* Add docs for web v3.13

* Improve ScriptingCore

* Manual merge cocos2d/cocos2d-x#16383 by DavidDeSimone

* Fix auto bindings configurations

* Update web ref
2016-08-19 16:28:47 +08:00
Ricardo Quesada 3ecaa71944 fix: validates director before layout in iOS (#16394)
Adds Director::isValid()
removes DisplayLinkDirector()
removes virtual functions from Director()
Director is no longer an abstract class

github issue #14276
2016-08-18 18:13:15 -07:00
Ricardo Quesada 604312ac35 Revert "fix: uses correct constant for Eye in Director" (#16385) 2016-08-17 17:53:20 -07:00
Ricardo Quesada dcea1b65ae fix: uses correct constant for Eye in Director (#16369)
fixes github issue #8354
2016-08-15 23:27:20 -07:00
Ricardo Quesada d41124a5b1 check for correct GL extension (#16346)
uses `GL_IMG_texture_format_BGRA8888` instead of `GL_IMG_texture_format_BGRA888`

fixes issue #16336
2016-08-10 03:24:41 -07:00
JaryGuo f9abbf02f6 fix the problem in ccUTF8.cpp and CCLuaJavaBridge.cpp (#16314)
* fix the return value when return null in java

fix the return value when return null in java

* fix getStringUTFCharsJNI

fix getStringUTFCharsJNI when srcjStr is null

* remove a word

remove a word added by mistake

* make a indention

line 233 utf8Str
2016-08-08 10:43:14 +08:00
vlad-tkachenko c3130caf27 Fix Desktop App crash upon exit when NotificationNode exists. (#11274) 2016-08-08 10:20:15 +08:00
James Chen b135d512d2 Update copyright to 2016. (#16311) 2016-08-05 09:42:15 +08:00
halx99 a2adfaf7df #Improve node sort performance for 64-bit by std::sort + long long (_localZOrder) (#16262)
* #improve node sort performance by std::sort + unsigned long long (_localZOrder)

* Use bit field for make _localZOrder storage more clearly.

* #Comment _localZOrder members for meaningful.

* fix issues

* #use explicit bits integer of localZOrder storage

* #Fix compile error, add include <cstdint> to CCNode.h

* use the optimization for 64bit and no optimization solution for 32bit

* Use the optimization for 64bit and no optimization solution for 32bit

* #Improve node sort performance 64-bit by std::sort + long long (_localZOrder)

* fix issues

* test case

* Revert "test case"

This reverts commit 85471d07a433f2b7f0265c3b7dd483fcc28e3e2f.

* fix issues

* use lambda, and any other sort issues.

* skip sotNodes

* fix compile error

* fix  compile issue
2016-07-31 22:44:24 +08:00
mogemimi bf35e0f6b5 Avoid overhead of casting between float and double 2016-07-28 06:49:41 +09:00
mogemimi 15030ad4c3 Fix typos in log messages 2016-07-25 02:53:22 +09:00
Ricardo Quesada 1a834ebdbf fix: FPS appears again
Sets default glviewport() when the GLView::updateDesignResolutionSize()
is called

github issue #16139
2016-07-21 15:12:57 -07:00
minggo bb25bed6f2 Merge pull request #16164 from dumganhar/fix/iss16046-fps-clock
Uses std::chrono::steay_clock for calculating dt.
2016-07-21 16:01:58 +08:00
minggo e19393fa23 Merge pull request #16123 from ricardoquesada/issue_15805
Fix: not cransh on android when mapBuffer() is not present
2016-07-20 14:10:04 +08:00
James Chen ddb25ca563 Uses std::chrono::steay_clock for calculating dt. 2016-07-20 12:43:40 +08:00
Ricardo Quesada cd495f68ba Fix: not cransh on android when mapBuffer() is not present
more info:
https://www.khronos.org/registry/gles/extensions/OES/OES_mapbuffer.txt

add methods to check whether or not glMapBuffer exists
2016-07-19 21:00:50 -07:00
Ricardo Quesada 5f0c0163b3 fix: display FPS again on GLFW platforms
Apparently GLFW stop emitting some events that creation time.
2016-07-19 18:26:14 -07:00
James Chen 15ef80e27d [big refactoring] Audio latency fix for Android. Support to preload effects on Android now. (#15875)
* Audio latency fix for Android. Support preload effects on Android now.

Squashed commits:
[b6d80fe] log fix
[a0a918e] Fixes assetFd didn't be released while PcmData is returned from cache.
[4b956ba] Potential crash fix for PcmAudioPlayer while pause / resume.
[398ab8c] Updates LOG_TAG position in AudioEngine-inl.cpp
[e3634e7] include stdlib.h for posix_memalign
[9004074] fixes setVolume logical error.
[c96df46] Don't use another thread for mixing, enqueue is in a seperated thread, therefore doing mixing in another thread will waste more time.
[0a4c1a8] Adds setLoop, setVolume, setPostion support for Track
[c35fb20] Fixed include.
[cdd9d32] Do mixing by ourself. (TO BE POLISHED)
[6447025] µ -> u since µ could not be shown on some android devices.
[97be0c6] Don't send a silence clip.
[c1607ed] Make linter.py happy.
[0898b54] Puts enqueue & SetPlayState in PcmAudioPlayer::play to thread pool.
[b79fc01] Adds getDuration, getPosition support for PcmAudioPlayer
[80fa2ab] minor fix of the code position of resetting state to State::INITIALIZED
[d9c62f1] underrun fix for PcmAudioPlayer.
[9c2212a] UrlAudioPlayer, playOverMutex should be static, and should be used in update method.
[1519d2e] static variables
[19da936] _pcmAudioPlayer Null pointer check in AudioPlayerProvider.
[e6b0d14] Updates audio performance test.
[fc01dd4] Registers foreground & background event in AudioEngine-inl.cpp(android), the callback should invoke `provider`'s pause & resume method.
[e00a886] TBD: Pause & resume support for PcmAudioPlayerPool.
Since OpenSLES audio resources are expensive and device shared, we should delete all unused PcmAudioPlayers in pool while pause and re-create them while resume.
But this commit isn't finished yet, I don't find a better way to register pause&resume event in AudioEngine module.
[9e42ea3] Interleave mono audio to stereo audio. PcmAudioPlayerPool only contains PcmAudioPlayers with 2 channels.
[3f18d05] Adds a strategy for checking small size of different file formats.
[753ff49] Adds performance test for AudioEngine.
[09d3045] Releases an extra PcmAudioPlayer for UrlAudioPlayer while allocating PcmAudioPlayer fails.
[9dd4477] Using std::move for PcmData move constructor & move assignment.
[6ca3bcb] some fixes:
1) new -> new (std::nothrow)
2) break if allocate PcmAudioPlayer fails
3) renames 'initForPlayPcmData' to 'init'
4) PcmAudioPlayer destructor deadlock if 'init' failed
[54675b6] include path fix.
[a1903ca] More refactorings.
[19b9498] Makes linter.py happy. :)
[923c530] Fixes:
1) Avoid getFileInfo to be invoked twice
2) A critical bug fix for UrlAudioPlayer and adds detailed comments
3) __clang__ compiler option fix for AudioResamplerSinc.cpp.
[5ec4faf] minor fix.
[faaa0f3] output a log in the destructor of UrlAudioPlayer.
[9c20355] NewAudioEngineTest,TestControll crash fix.
[f114464] fixes an unused import.
[1dc5dab] Better algorithm for allocating PcmAudioPlayer.
[331a213] minor fix.
[e54084a] null -> nullptr
[f9a0389] Support uncache.
[89a364f] Removes unused update, and TODO uncache functionality.
[1732bf9] Supports AudioEngineImpl::setFinishCallback for android.
[43d1596] UrlAudioPlayer::stop fix.
[e2ee941] Test case fix in NewAudioEngineTest/AudioIssue11143Test
[5c5ba01] More fixes for making cpp-tests/New Audio Engine Test happy.
[8b554a3] Adds log while remove player from map.
[ed71322] If original file is larger than 30k bytes, consider it's a large audio file.
[fb1845a] Updates project.properties
[6f3839f] minor log output fix in AudioEngine-inl.cpp
[c68bc6c] Don't resample if the sample rate of the decoded pcm data matchs the device's.
[43ca45f] PcmAudioPlayers also need to be removed while they play over, but should not be deleted since their lifecycle is managed by PcmAudioPlayerPool.
[f5e63c9] Audio latency fix for Android. Support preload effects on Android now.

* Supports to loading audio files asynchronously.

* Crash fix for stop audio right after play2d.

* Minor fix for logic in AudioMixerController.cpp

* Adds missing files (CCThreadPool.h/.cpp).

* Minor fix for including.

* Minor fix for missing include <functional> in Track.h

* update license information in audio.h

* Don't use std::future/std::promise anymore since ndk counldn't support it well in armeabi arch.

* isSmallFile postion updated, fixes large audio file goto the checking logic of cache.

* std::atomic<int> isn't supported by ndk-r10e while compiling with `armeabi` arch, using a int with a mutex instead.

* fixes __isnanf & posix_memalign doesn't exist on low api (<=16) devices.

* namespace updated: cocos2d -> cocos2d::experimental

* Removes commented code in AudioMixerController.h/.cpp

* Removes unused code again, and fixes a memory leak of `Track` instance.

* Oops, namespace changed.

* Only outputs log in debug mode.

* Uses ALOGV for outputing logs in AudioEngine-inl.cpp

* const PcmData& ->  PcmData for Track

* Fixes a protential crash in NewAudioEngineTest

* Adds `COCOS` prefix in header #ifndef COCOS_BALABALA #define COCOS_BALABALA

* Uses _ prefix for cocos code style instead of `m` prefix.

* Deletes AudioResamplerSinc related files.

* Bug fix from @minggo's reply on github.

* Don't need to invoke pause after in UrlAudioPlayer::prepare.

* Updates ThreadPool class, uses enum class and adds const keyword.
2016-07-18 10:22:40 +08:00
halx99 9e80526251 #Use std::string reference instead of char* for utils::findChild (#16117)
* #Optimize, Use std::string reference instead of char* for utils::findChild

* Check Node::INVALID_TAG

* revert submodules
2016-07-14 13:52:30 +08:00
minggo 125b0601c3 Merge pull request #16091 from mtak-/data_clear_on_move
fix leak in Data on move assignment
2016-07-14 11:40:19 +08:00
mogemimi b9c78ac41c Use std::abs to avoid overhead of casting float to double 2016-07-13 00:55:11 +09:00
Tyler Kopf 5ecd016a9e fix leak in Data on move assignment 2016-07-11 15:33:51 -07:00
minggo 3d5789ee77 Merge pull request #16077 from mogemimi/fix-documentation-comments
Fix documentation when compile with -Wdocumentation and Clang
2016-07-11 15:49:28 +08:00
minggo a146f3eec7 use std::srand() instead 2016-07-11 11:17:28 +08:00
mogemimi 7531c5156b Fix documentation when compile with -Wdocumentation and Clang 2016-07-10 17:38:32 +09:00
mogemimi bed4e048b6 Fix various typos 2016-07-06 08:27:39 +09:00
mogemimi 2650fd1afd Add missing float suffix to avoid -Wdouble-promotion 2016-07-04 23:12:45 +09:00
minggo ca8ff36f2e Merge pull request #16016 from LeeMyoungYeol/v3
Update utils::getTimeInMilliseconds()
2016-07-04 10:55:41 +08:00
mogemimi 2443e09d29 Fix typos and other mistakes in docs 2016-07-04 00:42:10 +09:00
이명열 853e083c68 - The result comes across as negative.(device android) 2016-07-01 15:32:43 +09:00
mogemimi c0f2194961 Fix some minor typos in local variable names 2016-06-29 11:04:11 +09:00
minggo bbd837aefa merge v3.12 back to v3 2016-06-28 17:53:50 +08:00
mogemimi a287e696c9 Improve RefPtr to avoid casting when possible 2016-06-26 21:39:43 +09:00
Ricardo Quesada 04a01b65f4 fix: FPS appears on iOS
`glViewport()` has a default value so that it has a valid value
after `Scene::render()` exits

Github issue #15934
2016-06-24 11:44:55 -07:00
Ricardo Quesada 4f973044ac fix: FPS appears on iOS
`glViewport()` has a default value so that it has a valid value
after `Scene::render()` exits

github issue #15934
2016-06-24 11:40:13 -07:00
minggo b29fbf0fc8 Merge pull request #15885 from Sumxx/v3
fix restart game crash in FT_Get_Char_Index
2016-06-24 10:08:32 +08:00
minggo 1042b18999 Merge pull request #15936 from mogemimi/use-nullptr-instead
Use nullptr instead of 0 or NULL whenever possible
2016-06-24 09:54:15 +08:00
minggo ee7ceee007 Merge pull request #15874 from mogemimi/fix-unused-variable
Fix unused variable warnings when compiling release mode
2016-06-23 15:55:11 +08:00
minggo 08898db883 Merge pull request #15831 from j-jorge/premultiplied-alpha-config
Add a config option to enable or disable the premultiplied alpha code.
2016-06-23 13:57:41 +08:00