Project

General

Profile

« Previous | Next » 

Revision 1d292925

Added by Leszek Koltunski 2 days ago

bugfix. DistortedNodes work now.

View differences:

src/main/java/org/distorted/library/main/DistortedNode.kt
50 50
    private var mFOV: Float
51 51
    private var mNear: Float
52 52
    private var mLastTime: Long
53
    private var mSurface: InternalSurface? = null
53 54

  
54 55
    companion object
55 56
    {
......
161 162
    // return the total number of render calls issued
162 163
    fun drawNoBlend(currTime: Long, surface: InternalOutputSurface): Int
163 164
    {
164
        if ( mSurface!!.setAsInput() )
165
        if( setAsInput() )
165 166
        {
166 167
            mState.apply()
167 168
            GLES30.glDisable(GLES30.GL_BLEND)
......
179 180
    // Use the Order Independent Transparency method to draw a non-postprocessed child.
180 181
    fun drawOIT(currTime: Long, surface: InternalOutputSurface): Int
181 182
    {
182
        if (mSurface!!.setAsInput())
183
        if( setAsInput() )
183 184
        {
184 185
            mState.apply()
185 186
            if (mLastTime==0L) mLastTime = currTime
......
195 196
    // return the total number of render calls issued
196 197
    fun draw(currTime: Long, surface: InternalOutputSurface): Int
197 198
    {
198
        if (mSurface!!.setAsInput())
199
        if( setAsInput() )
199 200
        {
200 201
            mState.apply()
201 202
            if (mLastTime==0L) mLastTime = currTime
......
514 515

  
515 516
    ///////////////////////////////////////////////////////////////////////////////////////////////////
516 517
    /**
517
     * Returns the surface this object gets rendered to.
518
     *
519
     * @return The InternalSurface contained in the Node (if a leaf), or the FBO (if an internal Node)
518
     * Sets the surface this object gets rendered to as rendering input.
520 519
     */
521
    var mSurface: InternalSurface? = null
522
        get() = if (mChildren.numChildren==0) field else mData.mFBO
520
     fun setAsInput(): Boolean
521
     {
522
         return (if (mChildren.numChildren==0) mSurface!!.setAsInput() else mData.mFBO!!.setAsInput())
523
     }
523 524

  
524 525
    //////////////////////////////////////////////////////////////////////////////////////////////////
525 526
     /**
src/main/java/org/distorted/library/main/InternalOutputSurface.kt
352 352
        {
353 353
            val node = children.getChild(j)
354 354

  
355
            if (node.mSurface!!.setAsInput())
355
            if( node.setAsInput() )
356 356
            {
357 357
                buffer.setAsOutput()
358 358
                numRenders += queue.preprocess(buffer, node, buffer.mDistance, buffer.mMipmap, buffer.mProjectionMatrix)
......
360 360
        }
361 361
        numRenders += queue.postprocess(buffer)
362 362

  
363
        if (oit)
363
        if( oit )
364 364
        {
365 365
            numRenders += oitBuild(time, buffer, fbo)
366 366
            GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT or GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT)

Also available in: Unified diff