Skip to content

Commit

Permalink
Deploy preview for PR 757 🛫
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoMendonc-a committed Oct 30, 2023
1 parent 6b4d566 commit 6ae25fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pr-preview/pr-757/classcubos_1_1engine_1_1Gizmos.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,19 +283,19 @@ <h3>
</tr>
<tr>
<td>firstBaseCenter</td>
<td>center of one of the bases.</td>
<td>Center of one of the bases.</td>
</tr>
<tr>
<td>firstBaseRadius</td>
<td>radius of one of the bases.</td>
<td>Radius of one of the bases.</td>
</tr>
<tr>
<td>secondBaseCenter</td>
<td>center of the second base.</td>
<td>Center of the second base.</td>
</tr>
<tr>
<td>secondBaseRadius</td>
<td>radius of the second base.</td>
<td>Radius of the second base.</td>
</tr>
<tr>
<td>lifespan</td>
Expand Down
5 changes: 3 additions & 2 deletions pr-preview/pr-757/examples-engine-gizmos.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ <h1>
<span class="p">}</span></pre><p>This code will draw a red line from the top-left of the screen to the bottom right, and it will stay there for 10 seconds.</p><p>In this other example, we draw lines, a box, and a wire box. Unlike the one in the previous example, this system is not a start-up system, so the draw functions get called every single frame. When this happens, you should set the lifetime of a gizmo to 0, which means it will be drawn for a single frame only. This way we avoid drawing gizmos on top of identical ones that were already there, or in the case of moving gizmos, leaving a trail of old version behind them.</p><p>Let&#x27;s start with the lines. We are using four cameras in our scene, so let&#x27;s add two lines to separate each camera. These lines will be in Screen space, as we want them to be just drawn once, indepently of the number of cameras; and we want them to use screen coordinates, as they should be drawn in the middle of the screen.</p><pre class="m-code"><span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">color</span><span class="p">({</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">});</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">drawLine</span><span class="p">(</span><span class="s">&quot;separator line&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mf">1.0F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="mf">0.0F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">},</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Gizmos</span><span class="o">::</span><span class="n">Space</span><span class="o">::</span><span class="n">Screen</span><span class="p">);</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">drawLine</span><span class="p">(</span><span class="s">&quot;separator line&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">1.0F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.0F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">},</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Gizmos</span><span class="o">::</span><span class="n">Space</span><span class="o">::</span><span class="n">Screen</span><span class="p">);</span></pre><p>Let&#x27;s now add a wireboxe. We want to know were exactly is the centre of each camera, so let&#x27;s add a reticule. This box will be in View space, as we want it to be drawn once per camera and we want it to use view coordinates, as it should be drawn in the middle of each viewport.</p><pre class="m-code"><span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">color</span><span class="p">({</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">});</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">drawBox</span><span class="p">(</span><span class="s">&quot;test box&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mf">0.4</span><span class="p">,</span><span class="w"> </span><span class="mf">0.4</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="mf">0.55</span><span class="p">,</span><span class="w"> </span><span class="mf">0.55</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">},</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Gizmos</span><span class="o">::</span><span class="n">Space</span><span class="o">::</span><span class="n">View</span><span class="p">);</span></pre><p>Finally, let&#x27;s add a box. This box will be in World space, as it&#x27;s the last space left to cover. It will be drawn by any camera that is looking at it, much like if it was an object in the world.</p><pre class="m-code"><span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">color</span><span class="p">({</span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">});</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">drawWireBox</span><span class="p">(</span><span class="s">&quot;test box&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="mi">-1</span><span class="p">,</span><span class="w"> </span><span class="mi">-1</span><span class="p">,</span><span class="w"> </span><span class="mi">-1</span><span class="p">},</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Gizmos</span><span class="o">::</span><span class="n">Space</span><span class="o">::</span><span class="n">World</span><span class="p">);</span></pre><p>The whole system looks like this:</p><pre class="m-code"><span class="k">static</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="nf">drawSystem</span><span class="p">(</span><span class="n">Write</span><span class="o">&lt;</span><span class="n">Gizmos</span><span class="o">&gt;</span><span class="w"> </span><span class="n">gizmos</span><span class="p">)</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">drawBox</span><span class="p">(</span><span class="s">&quot;test box&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mf">0.4</span><span class="p">,</span><span class="w"> </span><span class="mf">0.4</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="mf">0.55</span><span class="p">,</span><span class="w"> </span><span class="mf">0.55</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">},</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Gizmos</span><span class="o">::</span><span class="n">Space</span><span class="o">::</span><span class="n">View</span><span class="p">);</span></pre><p>Let&#x27;s add a box. This box will be in World space, as it&#x27;s the last space left to cover. It will be drawn by any camera that is looking at it, much like if it was an object in the world.</p><pre class="m-code"><span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">color</span><span class="p">({</span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">});</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">drawWireBox</span><span class="p">(</span><span class="s">&quot;test box&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="mi">-1</span><span class="p">,</span><span class="w"> </span><span class="mi">-1</span><span class="p">,</span><span class="w"> </span><span class="mi">-1</span><span class="p">},</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Gizmos</span><span class="o">::</span><span class="n">Space</span><span class="o">::</span><span class="n">World</span><span class="p">);</span></pre><p>Finally let&#x27;s add a cut cone. A cut cone is cylinder with faces that can have different radiuses. If you set one of the bases to have a radius of 0, you&#x27;ll have a simple cone. If you set them both to have the same radius, you&#x27;ll have a cylinder. Our cut cone will have different radiuses:</p><pre class="m-code"><span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">color</span><span class="p">({</span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.3F</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">});</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">drawCutCone</span><span class="p">(</span><span class="s">&quot;test cut cone&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mf">0.7F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.7F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.7F</span><span class="p">},</span><span class="w"> </span><span class="mf">5.0F</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">-3</span><span class="p">,</span><span class="w"> </span><span class="mi">-3</span><span class="p">,</span><span class="w"> </span><span class="mi">-3</span><span class="p">},</span><span class="w"> </span><span class="mf">3.0F</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Gizmos</span><span class="o">::</span><span class="n">Space</span><span class="o">::</span><span class="n">World</span><span class="p">);</span></pre><p>The whole system looks like this:</p><pre class="m-code"><span class="k">static</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="nf">drawSystem</span><span class="p">(</span><span class="n">Write</span><span class="o">&lt;</span><span class="n">Gizmos</span><span class="o">&gt;</span><span class="w"> </span><span class="n">gizmos</span><span class="p">)</span>
<span class="p">{</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">color</span><span class="p">({</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">});</span>
<span class="w"> </span><span class="n">gizmos</span><span class="o">-&gt;</span><span class="n">drawLine</span><span class="p">(</span><span class="s">&quot;separator line&quot;</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mf">1.0F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="mf">0.0F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">,</span><span class="w"> </span><span class="mf">0.5F</span><span class="p">},</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Gizmos</span><span class="o">::</span><span class="n">Space</span><span class="o">::</span><span class="n">Screen</span><span class="p">);</span>
Expand Down

0 comments on commit 6ae25fa

Please sign in to comment.