Thanks riq, I will change it and calcuate z depth properly.


On Fri, Dec 20, 2013 at 2:40 AM, Ricardo Quesada
<notifications@github.com>wrote:

> In cocos/2d/renderer/CCRenderCommand.cpp:
>
> > @@ -37,13 +37,24 @@
> >  {
> >  }
> >
> > +void RenderCommand::init(int viewport, float depth)
> > +{
> > +    _viewport = viewport;
> > +
> > +    //convert depth from float to unsigned int
> > +    //currently we only support 2 digits after decimal point
> > +    _depth = depth * 100 + CC_RENDERER_DEPTH_HALF;
> > +    _depth = MIN(_depth, CC_RENDERER_DEPTH_MAX);
> > +    _depth = MAX(_depth, CC_RENDERER_DEPTH_MIN);
> > +}
> > +
>
> This document explains how to convert a depth that is expressed in a floatinto a 24-bit integer:
> http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/cocos2d/cocos2d-x/pull/4556/files#r8478853>
> .
>