@@ -130,7 +130,7 @@ pub fn draw_plane(center: Vec3, size: Vec2, texture: impl Into<Option<Texture2D>
130
130
}
131
131
132
132
/// Draw an affine (2D) parallelogram at given position, as two triangles.
133
- ///
133
+ ///
134
134
/// The drawn parallelogram will have the vertices: `offset`, `offset + e1`, `offset + e2` and `offset + e1 + e2`
135
135
///
136
136
/// # Arguments
@@ -148,28 +148,17 @@ pub fn draw_plane(center: Vec3, size: Vec2, texture: impl Into<Option<Texture2D>
148
148
/// # use macroquad::prelude::*;
149
149
/// draw_affine_parallelogram(Vec3::ZERO, 3. * Vec3::X, 5. * Vec3::Z, None, RED);
150
150
/// ```
151
- pub fn draw_affine_parallelogram ( offset : Vec3 , e1 : Vec3 , e2 : Vec3 , texture : impl Into < Option < Texture2D > > , color : Color ) {
152
-
153
- let v1 = (
154
- offset. into ( ) ,
155
- vec2 ( 0. , 0. ) ,
156
- color,
157
- ) ;
158
- let v2 = (
159
- ( offset+e1) . into ( ) ,
160
- vec2 ( 0. , 1. ) ,
161
- color,
162
- ) ;
163
- let v3 = (
164
- ( offset+e1+e2) . into ( ) ,
165
- vec2 ( 1. , 1. ) ,
166
- color,
167
- ) ;
168
- let v4 = (
169
- ( offset+e2) . into ( ) ,
170
- vec2 ( 1. , 0. ) ,
171
- color,
172
- ) ;
151
+ pub fn draw_affine_parallelogram (
152
+ offset : Vec3 ,
153
+ e1 : Vec3 ,
154
+ e2 : Vec3 ,
155
+ texture : impl Into < Option < Texture2D > > ,
156
+ color : Color ,
157
+ ) {
158
+ let v1 = ( offset. into ( ) , vec2 ( 0. , 0. ) , color) ;
159
+ let v2 = ( ( offset + e1) . into ( ) , vec2 ( 0. , 1. ) , color) ;
160
+ let v3 = ( ( offset + e1 + e2) . into ( ) , vec2 ( 1. , 1. ) , color) ;
161
+ let v4 = ( ( offset + e2) . into ( ) , vec2 ( 1. , 0. ) , color) ;
173
162
174
163
{
175
164
let context = get_context ( ) ;
@@ -179,7 +168,7 @@ pub fn draw_affine_parallelogram(offset: Vec3, e1: Vec3, e2: Vec3, texture: impl
179
168
}
180
169
181
170
/// Draw an affine (3D) parallelepiped at given position, using six parallelograms.
182
- ///
171
+ ///
183
172
/// The drawn parallelepiped will be built from the followwing parallelograms:
184
173
///
185
174
/// * `offset, offset + e1, offset + e2`
@@ -204,8 +193,14 @@ pub fn draw_affine_parallelogram(offset: Vec3, e1: Vec3, e2: Vec3, texture: impl
204
193
/// # use macroquad::prelude::*;
205
194
/// draw_affine_parallelepiped(Vec3::ZERO, 3. * Vec3::X, 2. * Vec3::Y, 5. * Vec3::Z, None, RED);
206
195
/// ```
207
- pub fn draw_affine_parallelepiped ( offset : Vec3 , e1 : Vec3 , e2 : Vec3 , e3 : Vec3 , texture : impl Into < Option < Texture2D > > , color : Color ) {
208
-
196
+ pub fn draw_affine_parallelepiped (
197
+ offset : Vec3 ,
198
+ e1 : Vec3 ,
199
+ e2 : Vec3 ,
200
+ e3 : Vec3 ,
201
+ texture : impl Into < Option < Texture2D > > ,
202
+ color : Color ,
203
+ ) {
209
204
let texture_base = texture. into ( ) ;
210
205
draw_affine_parallelogram ( offset, e1, e2, texture_base, color) ;
211
206
draw_affine_parallelogram ( offset, e1, e3, texture_base, color) ;
0 commit comments