Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_animation3D

This commit is contained in:
samuele3hu 2014-07-04 09:53:09 +08:00
commit 526d032735
6 changed files with 67 additions and 62 deletions

View File

@ -237,7 +237,7 @@ void FastTMXLayer::updateTiles(const Rect& culledRect)
else
{
//do nothing, do not support
CCASSERT(0, "TMX invalid value");
//CCASSERT(0, "TMX invalid value");
}
_indicesVertexZNumber.clear();
@ -264,9 +264,8 @@ void FastTMXLayer::updateTiles(const Rect& culledRect)
int offset = iter->second;
iter->second++;
//CC_ASSERT(_tileToQuadIndex.find(tileIndex) != _tileToQuadIndex.end() && _tileToQuadIndex[tileIndex] <= _totalQuads.size()-1);
int quadIndex = (int)_tileToQuadIndex[tileIndex];
int quadIndex = _tileToQuadIndex[tileIndex];
CC_ASSERT(-1 != quadIndex);
_indices[6 * offset + 0] = quadIndex * 4 + 0;
_indices[6 * offset + 1] = quadIndex * 4 + 1;
_indices[6 * offset + 2] = quadIndex * 4 + 2;
@ -387,7 +386,13 @@ Mat4 FastTMXLayer::tileToNodeTransform()
}
case FAST_TMX_ORIENTATION_HEX:
{
_tileToNodeTransform = Mat4::IDENTITY;
_tileToNodeTransform = Mat4
(
h * sqrtf(0.75), 0, 0, 0,
-h/2, -h, 0, offY,
0, 0, 1, 0,
0, 0, 0, 1
);
return _tileToNodeTransform;
}
default:
@ -408,6 +413,7 @@ void FastTMXLayer::updateTotalQuads()
_tileToQuadIndex.clear();
_totalQuads.resize(int(_layerSize.width * _layerSize.height));
_indices.resize(6 * int(_layerSize.width * _layerSize.height));
_tileToQuadIndex.resize(int(_layerSize.width * _layerSize.height),-1);
_indicesVertexZOffsets.clear();
int quadIndex = 0;
@ -617,7 +623,7 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
ret = static_cast<int>(-(_layerSize.height-pos.y));
break;
case FAST_TMX_ORIENTATION_HEX:
CCASSERT(0, "TMX Hexa zOrder not supported");
CCASSERT(0, "TMX Hexa vertexZ not supported");
break;
default:
CCASSERT(0, "TMX invalid value");

View File

@ -239,7 +239,7 @@ protected:
Mat4 _tileToNodeTransform;
/** data for rendering */
bool _quadsDirty;
std::unordered_map<ssize_t, ssize_t> _tileToQuadIndex;
std::vector<int> _tileToQuadIndex;
std::vector<V3F_C4B_T2F_Quad> _totalQuads;
std::vector<int> _indices;
std::map<int/*vertexZ*/, int/*offset to _indices by quads*/> _indicesVertexZOffsets;

View File

@ -290,11 +290,14 @@ namespace cocostudio
panel->setLayoutType((Layout::Type)DICTOOL->getIntValue_json(options, P_LayoutType));
int bgimgcr = DICTOOL->getIntValue_json(options, P_ColorR);
int bgimgcg = DICTOOL->getIntValue_json(options, P_ColorG);
int bgimgcb = DICTOOL->getIntValue_json(options, P_ColorB);
int bgimgcr = DICTOOL->getIntValue_json(options, P_ColorR,255);
int bgimgcg = DICTOOL->getIntValue_json(options, P_ColorG,255);
int bgimgcb = DICTOOL->getIntValue_json(options, P_ColorB,255);
panel->setBackGroundImageColor(Color3B(bgimgcr, bgimgcg, bgimgcb));
int bgimgopacity = DICTOOL->getIntValue_json(options, "opacity",255);
panel->setBackGroundImageOpacity(bgimgopacity);
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
}

View File

@ -22,8 +22,8 @@
# Misc Information
* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.2beta0.zip
* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.2beta0/CHANGELOG
* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.2alpha0.zip
* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.2alpha0/CHANGELOG
* ~~API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.0/index.html~~
* v3.0 Release Notes can be found here: [v3.0 Release Notes](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md)
@ -113,68 +113,64 @@ Please refer to this document: [ReadMe](../README.md)
# Highlights of v3.2 alpha0
* Game controller support
* Fast tmx support
* `Sprite3D` supports binary format, and 20% performance improved
* Integrated physics engine supports scale and rotation
* Added `Node::getName`, `Node::setName`, `Node::enumerateChildren` and `utils::findChildren`
* `fbx-conv` can export binary format
* `Animation3D`/`Animate3d`, new nodes for 3d animation. lua-binding and WP8 is not supported now.
* Updated libcurl.a to use OpenSSL v1.0.1h, [news](http://cocos2d-x.org/news/286) for it
* Added `utils::captureScreen` to take screeshot
# Features in detail
## Game controller support
## Animation3D
There are many game controllers don't follow standard processes on Android. A Android device wants to run a game supports this type of game controller should install en extra application offered by the game controller maker. `Moga` and `Nibiru` are this kind of game controller.
Animation3D is skeletal animation in 3D Game. It allows the artist animate a 3D model using bone in 3D modeling tools. Then export the model file and use it in the game.
But don't be afraid, cocos2d-x do these things automatically for you. We put supported game controller applications in a server, engine will download application when it recognize a supported game controller. And install the application automatically.
Work flow
```c++
auto gameControllerListener = EventListenerController::create();
* Artist produce 3D models in modeling tools and then export it to FBX file
* Use `fbx-conv` convert FBX file to c3t file
* Load c3t file in the game
// add call backs for listener and added into EventDispatcher
...
Note
* The API may change in final version
* binary format of c3t will be added in final version
* the bones in the FBX file should not be more than 50.
Controller::startDiscoveryController();
### `fbx-conv` usage
* windows
```
cd COCOS2DX_ROOT/tools/fbx-convert/win32
fbx-conv FBXFile
```
* mac os x
Full document will be ready in final version.
## Fast tmx support
It has the same API as `TMXTileMap` except deprecated functions.
```c++
auto map = FastTMXTiledMap::create("test.tmx");
addChild(map);
```
cd COCOS2DX_ROOT/tools/fbx-convert/mac
./fbx-conv FBXFile
```
## fbx-conv
### Sample code
* Max OS X
```c++
//load Sprite3D
auto sprite = Sprite3D::create("girl.c3t");
addChild(sprite);
sprite->setPosition(Vec2( 0, 0));
```
$ cd -a|-b|t [path of fbx-conv]
$ ./fbx-conv [-a|-b|-t] FBXFile
```
//load animation and play it
auto animation = Animation3D::getOrCreate("girl.c3t");
if (animation)
{
auto animate = Animate3D::create(animation);
sprite->runAction(RepeatForever::create(animate));
}
```
* Windows
Full sample please refer to [Sprite3D test](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp).
```
cd [path of fbx-conv]
fbx-conv -a|-b|t FBXFile
```
## captureScreen
Options:
* -a export both c3t and c3b
* -b export c3b
* -t export c3t
`Note: the bones in the FBX file should not be more than 60.`
## Node::enumerateChildren
Please refer to [here](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp) for usage.

View File

@ -33,13 +33,13 @@ void CurlTest::onTouchesEnded(const std::vector<Touch*>& touches, Event *event)
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, "baidu.com");
curl_easy_setopt(curl, CURLOPT_URL, "http://webtest.cocos2d-x.org/curltest");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
if (res == 0)
{
_label->setString("0 response");
_label->setString("Connect successfully!");
}
else
{

View File

@ -43,7 +43,7 @@ namespace
CLN(TMXIsoTest1New),
CLN(TMXIsoTest2New),
CLN(TMXUncompressedTestNew),
//CLN(TMXHexTestNew),
CLN(TMXHexTestNew),
CLN(TMXReadWriteTestNew),
CLN(TMXTilesetTestNew),
CLN(TMXOrthoObjectsTestNew),
@ -55,8 +55,8 @@ namespace
CLN(TMXOrthoFlipRunTimeTestNew),
CLN(TMXOrthoFromXMLTestNew),
CLN(TMXOrthoXMLFormatTestNew),
// CLN(TileMapTestNew),
// CLN(TileMapEditTestNew),
CLN(TileMapTestNew),
CLN(TileMapEditTestNew),
CLN(TMXBug987New),
CLN(TMXBug787New),
CLN(TMXGIDObjectsTestNew),