Graphics::drawPoly: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
(yay)
 
Line 1: Line 1:
x/y/z - Location of a vertex (in world coords), presumably.<br>----------------<br>x1, y1, z1    : Coordinates for the first point<br>x2, y2, z2    : Coordinates for the second point<br>x3, y3, z3    : Coordinates for the third point<br>r, g, b, alpha : Color with RGBA-Values<br><br>Keep in mind that only one side of the drawn triangle is visible: It's the side, in which the vector-product of the vectors heads to: (b-a)x(c-a) Or (b-a)x(c-b).<br>But be aware: The function seems to work somehow differently. I have trouble having them drawn in rotated orientation. Try it yourself and if you somehow succeed, please edit this and post your solution.<br>I recommend using a predefined function to call this.<br>[VB.NET]<br>Public Sub DrawPoly(a As Vector3, b As Vector3, c As Vector3, col As Color)<br>    [Function].Call(Hash.DRAW_POLY, a.X, a.Y, a.Z, b.X, b.Y, b.Z, c.X, c.Y, c.Z, col.R, col.G, col.B, col.A)<br>End Sub<br><br>[C#]<br>public void DrawPoly(Vector3 a, Vector3 b, Vector3 c, Color col)<br>{<br>    Function.Call(Hash.DRAW_POLY, a.X, a.Y, a.Z, b.X, b.Y, b.Z, c.X, c.Y, c.Z, col.R, col.G, col.B, col.A);<br>}<br>BTW: Intersecting triangles are not supported: They overlap in the order they were called.
x/y/z - Location of a vertex (in world coords), presumably.<br>----------------<br>x1, y1, z1    : Coordinates for the first point<br>x2, y2, z2    : Coordinates for the second point<br>x3, y3, z3    : Coordinates for the third point<br>r, g, b, alpha : Color with RGBA-Values<br><br>Keep in mind that only one side of the drawn triangle is visible: It's the side, in which the vector-product of the vectors heads to: (b-a)x(c-a) Or (b-a)x(c-b).<br>But be aware: The function seems to work somehow differently. I have trouble having them drawn in rotated orientation. Try it yourself and if you somehow succeed, please edit this and post your solution.<br>I recommend using a predefined function to call this.<br>[VB.NET]<br>Public Sub DrawPoly(a As Vector3, b As Vector3, c As Vector3, col As Color)<br>    [Function].Call(Hash.DRAW_POLY, a.X, a.Y, a.Z, b.X, b.Y, b.Z, c.X, c.Y, c.Z, col.R, col.G, col.B, col.A)<br>End Sub<br><br>[C#]<br>public void DrawPoly(Vector3 a, Vector3 b, Vector3 c, Color col)<br>{<br>    Function.Call(Hash.DRAW_POLY, a.X, a.Y, a.Z, b.X, b.Y, b.Z, c.X, c.Y, c.Z, col.R, col.G, col.B, col.A);<br>}<br>BTW: Intersecting triangles are not supported: They overlap in the order they were called.
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">graphics.drawPoly(x1, y1, z1, x2, y2, z2, x3, y3, z3, r, g, b, alpha);</syntaxhighlight>
<syntaxhighlight lang="javascript">mp.game.graphics.drawPoly(x1, y1, z1, x2, y2, z2, x3, y3, z3, r, g, b, alpha);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''x1:''' float
*'''x1:''' float
Line 20: Line 20:
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
todo
// todo
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Graphics_function_c}}
{{Graphics_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 21:27, 6 May 2017

x/y/z - Location of a vertex (in world coords), presumably.
----------------
x1, y1, z1  : Coordinates for the first point
x2, y2, z2  : Coordinates for the second point
x3, y3, z3  : Coordinates for the third point
r, g, b, alpha : Color with RGBA-Values

Keep in mind that only one side of the drawn triangle is visible: It's the side, in which the vector-product of the vectors heads to: (b-a)x(c-a) Or (b-a)x(c-b).
But be aware: The function seems to work somehow differently. I have trouble having them drawn in rotated orientation. Try it yourself and if you somehow succeed, please edit this and post your solution.
I recommend using a predefined function to call this.
[VB.NET]
Public Sub DrawPoly(a As Vector3, b As Vector3, c As Vector3, col As Color)
[Function].Call(Hash.DRAW_POLY, a.X, a.Y, a.Z, b.X, b.Y, b.Z, c.X, c.Y, c.Z, col.R, col.G, col.B, col.A)
End Sub

[C#]
public void DrawPoly(Vector3 a, Vector3 b, Vector3 c, Color col)
{
Function.Call(Hash.DRAW_POLY, a.X, a.Y, a.Z, b.X, b.Y, b.Z, c.X, c.Y, c.Z, col.R, col.G, col.B, col.A);
}
BTW: Intersecting triangles are not supported: They overlap in the order they were called.

Syntax

mp.game.graphics.drawPoly(x1, y1, z1, x2, y2, z2, x3, y3, z3, r, g, b, alpha);

Required Arguments

  • x1: float
  • y1: float
  • z1: float
  • x2: float
  • y2: float
  • z2: float
  • x3: float
  • y3: float
  • z3: float
  • r: int
  • g: int
  • b: int
  • alpha: int

Return value

  • Undefined

Example

// todo

See also