Class: Collada::Conversion::Mesh

Inherits:
Object
  • Object
show all
Defined in:
lib/collada/conversion/mesh.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMesh

Returns a new instance of Mesh.



114
115
116
117
118
119
120
121
122
# File 'lib/collada/conversion/mesh.rb', line 114

def initialize
	@indices = []
	
	# vertex -> index
	@vertices = {}
	
	# index -> vertex
	@indexed = []
end

Instance Attribute Details

#indexedObject (readonly)

Returns the value of attribute indexed.



126
127
128
# File 'lib/collada/conversion/mesh.rb', line 126

def indexed
  @indexed
end

#indicesObject (readonly)

Returns the value of attribute indices.



124
125
126
# File 'lib/collada/conversion/mesh.rb', line 124

def indices
  @indices
end

#verticesObject (readonly)

Returns the value of attribute vertices.



125
126
127
# File 'lib/collada/conversion/mesh.rb', line 125

def vertices
  @vertices
end

Instance Method Details

#<<(vertex) ⇒ Object



132
133
134
135
136
137
138
139
140
141
# File 'lib/collada/conversion/mesh.rb', line 132

def << vertex
	if index = vertices[vertex]
		@indices << index
	else
		@vertices[vertex] = self.size
		@indices << self.size
		
		@indexed << vertex
	end
end

#sizeObject



128
129
130
# File 'lib/collada/conversion/mesh.rb', line 128

def size
	@indexed.size
end