Class: Ray::Vertex
- Inherits:
-
Object
- Object
- Ray::Vertex
- Includes:
- PP
- Defined in:
- lib/ray/vertex.rb,
ext/vertex.c
Instance Method Summary collapse
-
#col ⇒ Ray::Color
(also: #color)
Color of the vertex.
- #col=(val) ⇒ Object (also: #color=)
- #initialize(pos = [0, 0], color = Color.white, tex = [0, 0]) ⇒ Object constructor
-
#pos ⇒ Ray::Vector2
(also: #position)
Position of the vertex.
- #pos=(val) ⇒ Object (also: #position=)
- #pretty_print(q) ⇒ Object
-
#tex ⇒ Ray::Vector2
Texture position of the vertex.
- #tex=(val) ⇒ Object
- #tex_x ⇒ Object
- #tex_x=(val) ⇒ Object
- #tex_y ⇒ Object
- #tex_y=(val) ⇒ Object
- #x ⇒ Object
- #x=(val) ⇒ Object
- #y ⇒ Object
- #y=(val) ⇒ Object
Methods included from PP
Constructor Details
#initialize(pos = [0, 0], color = Color.white, tex = [0, 0]) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'ext/vertex.c', line 29
static
VALUE ray_vertex_init(int argc, VALUE *argv, VALUE self) {
say_vertex *vertex = ray_rb2vertex(self);
VALUE pos, col, tex;
rb_scan_args(argc, argv, "03", &pos, &col, &tex);
vertex->pos = NIL_P(pos) ? say_make_vector2(0, 0) : ray_convert_to_vector2(pos);
vertex->col = NIL_P(col) ? say_make_color(255, 255, 255, 255) : ray_rb2col(col);
vertex->tex = NIL_P(tex) ? say_make_vector2(0, 0) : ray_convert_to_vector2(tex);
return self;
}
|
Instance Method Details
#col ⇒ Ray::Color Also known as: color
Returns Color of the vertex.
70 71 72 73 |
# File 'ext/vertex.c', line 70
static
VALUE ray_vertex_col(VALUE self) {
return ray_col2rb(ray_rb2vertex(self)->col);
}
|
#col=(val) ⇒ Object Also known as: color=
75 76 77 78 79 80 |
# File 'ext/vertex.c', line 75
static
VALUE ray_vertex_set_col(VALUE self, VALUE val) {
rb_check_frozen(self);
ray_rb2vertex(self)->col = ray_rb2col(val);
return val;
}
|
#pos ⇒ Ray::Vector2 Also known as: position
Returns Position of the vertex.
44 45 46 47 |
# File 'ext/vertex.c', line 44
static
VALUE ray_vertex_pos(VALUE self) {
return ray_vector2_to_rb(ray_rb2vertex(self)->pos);
}
|
#pos=(val) ⇒ Object Also known as: position=
49 50 51 52 53 54 |
# File 'ext/vertex.c', line 49
static
VALUE ray_vertex_set_pos(VALUE self, VALUE val) {
rb_check_frozen(self);
ray_rb2vertex(self)->pos = ray_convert_to_vector2(val);
return val;
}
|
#pretty_print(q) ⇒ Object
20 21 22 |
# File 'lib/ray/vertex.rb', line 20 def pretty_print(q) pretty_print_attributes q, ["pos", "col", "tex"] end |
#tex ⇒ Ray::Vector2
Returns Texture position of the vertex.
57 58 59 60 |
# File 'ext/vertex.c', line 57
static
VALUE ray_vertex_tex(VALUE self) {
return ray_vector2_to_rb(ray_rb2vertex(self)->tex);
}
|
#tex=(val) ⇒ Object
62 63 64 65 66 67 |
# File 'ext/vertex.c', line 62
static
VALUE ray_vertex_set_tex(VALUE self, VALUE val) {
rb_check_frozen(self);
ray_rb2vertex(self)->tex = ray_convert_to_vector2(val);
return val;
}
|
#tex_x ⇒ Object
14 |
# File 'lib/ray/vertex.rb', line 14 def tex_x; tex.x; end |
#tex_x=(val) ⇒ Object
17 |
# File 'lib/ray/vertex.rb', line 17 def tex_x=(val); self.tex = [val, tex_y]; end |
#tex_y ⇒ Object
15 |
# File 'lib/ray/vertex.rb', line 15 def tex_y; tex.y; end |
#tex_y=(val) ⇒ Object
18 |
# File 'lib/ray/vertex.rb', line 18 def tex_y=(val); self.tex = [tex_x, val]; end |
#x ⇒ Object
8 |
# File 'lib/ray/vertex.rb', line 8 def x; pos.x; end |
#x=(val) ⇒ Object
11 |
# File 'lib/ray/vertex.rb', line 11 def x=(val); self.pos = [val, y]; end |
#y ⇒ Object
9 |
# File 'lib/ray/vertex.rb', line 9 def y; pos.y; end |
#y=(val) ⇒ Object
12 |
# File 'lib/ray/vertex.rb', line 12 def y=(val); self.pos = [x, val]; end |