Hello,
I tried to reproduce “TMX Iso VertexZ” from samples.
My tiledmap has 2 layers :
- “First” layer with param cc_vertexz -1000
- “Top” layer with param cc_vertexz automatic
I move a tile from “Top” and set vertexz value but it has no effect on draw order(with calculated values, random values, fixed values …).
I also set projection to cc.Director.PROJECTION_2D.
There is an information in the doc : need to enable depth buffer. How to do it ?
Do you have this problem ? How to fix it ? Any configuration file or special settings ?
Thanks.
Vertexz feature is only available for WebGL or OpenGL
Thanks pandamicro for your answer.
In the project.json, renderMode = 0; (i also tried with 2 for webgl)
In ctor function of my first scene, i wrote cc.director.setDepthTest(true); (depth buffer ?)
If depth buffer is active, only tmxlayer with cc_vertexz > 0 are visible but in sample, tmx map has a layer with cc_vertexz = -1000 .
If cc_vertexz of top layer is automatic, it is not visible while game is running.
Tested on windows and android.
I don’t know what i’m missing…
Can you post some sample codes to reproduce the issue ?
A link with my src file (basic) https://www.dropbox.com/sh/49094uhi75q5nsx/AAA9vrfQUyJkfTyppsDbmdNna/vertexz_problem/tmx_vertexz_problem?dl=0
I used tmx file from sample iso-test-vertexz.tmx.
My main.js is :
cc.game.onStart = function(){
cc.view.adjustViewPort(true);
cc.view.setDesignResolutionSize(1280, 720, cc.ResolutionPolicy.EXACT_FIT);
cc.view.resizeWithBrowserSize(true);
cc.director.setProjection(cc.Director.PROJECTION_2D);
cc.game.setFrameRate(30);
//load resources
cc.LoaderScene.preload(g_resources, function () {
/**
* CAUSE BLACK SCREEN IF cc_vertexz < 0 or automatic
*/
//cc.director.setDepthTest(true);//<--------
//run test scene
cc.director.runScene(new TestScene());
}, this);
If i uncomment cc.director.setDepth(true), all layer with cc_vertexz <0 or automatic are invisible.
Thanks for your help.