Project

General

Profile

« Previous | Next » 

Revision b2939df4

Added by Leszek Koltunski about 7 years ago

Now there's a single place one can have a look at all the Meshes being rendered to a OutputSurface: OutputSurface.renderChildren().
This will need to get modified for per-object post-processing.

View differences:

src/main/java/org/distorted/library/DistortedOutputSurface.java
101 101
    }
102 102

  
103 103
///////////////////////////////////////////////////////////////////////////////////////////////////
104
// PUBLIC API
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106
/**
107
 * Draws all the attached children to this OutputSurface.
108
 * <p>
109
 * Must be called from a thread holding OpenGL Context.
110
 *
111
 * @param time Current time, in milliseconds. This will be passed to all the Effects stored in the children Nodes.
112
 * @return Number of objects rendered.
113
 */
114
  public int render(long time)
115
    {
116
    DistortedAttachDaemon.toDo();
117
    toDo();
118
    DistortedRenderState.reset();
119

  
120
    int numRenders=0;
121 104

  
122
    for(int i=0; i<mNumChildren; i++)
123
      {
124
      numRenders += mChildren.get(i).renderRecursive(time);
125
      }
126

  
127
    setAsOutput();
105
  int renderChildren(long time, int num, ArrayList<DistortedNode> children)
106
    {
107
    int numRenders = 0;
128 108

  
129
    // 'renderChildren'
130
    for(int i=0; i<mNumChildren; i++)
109
    for(int i=0; i<num; i++)
131 110
      {
132
      numRenders += mChildren.get(i).draw(time,this);
111
      numRenders += children.get(i).draw(time,this);
133 112
      }
134 113

  
135 114
    return numRenders;
136 115
    }
137 116

  
117
///////////////////////////////////////////////////////////////////////////////////////////////////
118
// PUBLIC API
138 119
///////////////////////////////////////////////////////////////////////////////////////////////////
139 120
/**
140 121
 * Draws all the attached children to this OutputSurface.
......
144 125
 * @param time Current time, in milliseconds. This will be passed to all the Effects stored in the children Nodes.
145 126
 * @return Number of objects rendered.
146 127
 */
147
  public int renderOld(long time)
128
  public int render(long time)
148 129
    {
149 130
    // change tree topology (attach and detach children)
150 131
/*
......
179 160
    // mark OpenGL state as unknown
180 161
    DistortedRenderState.reset();
181 162

  
182
    int numRenders = 0;
163
    int numRenders=0;
183 164

  
184 165
    for(int i=0; i<mNumChildren; i++)
185 166
      {
186
      numRenders += mChildren.get(i).drawRecursive(time,this);
167
      numRenders += mChildren.get(i).renderRecursive(time);
187 168
      }
188 169

  
170
    setAsOutput();
171
    numRenders += renderChildren(time,mNumChildren,mChildren);
172

  
189 173
    return numRenders;
190 174
    }
191 175

  

Also available in: Unified diff