private void addGeometry(final TextData data) { final GeometryMesh geom = ((MemoryObject.ObjectFactory<GeometryMesh>) GLGeometryMesh.Factory).newPooledInstance(); final int numVertices = 16; final VertexBufferPCT vertexBuffer = VertexBufferPCT.Factory.newPooledInstance(16); final IndexBuffer indexBuffer = IndexBuffer.INDICES; vertexBuffer.setNumVertices(16); for (int i = 0, size = vertexBuffer.getNumVertices(); i < size; ++i) { vertexBuffer.setVertexColor(i, 1.0f, 1.0f, 1.0f, 1.0f); } geom.create(GeometryMesh.MeshType.Line, vertexBuffer, indexBuffer); this.m_entity3D.addGeometry(geom); geom.removeReference(); vertexBuffer.removeReference(); }
public void updateVertex( final Dimension size, final Insets margin, final Insets border, final Insets padding) { this.m_entity.setVisible(true); this.m_entity3D.setVisible(true); this.m_particleEntity.setVisible(true); final int left = margin.left + border.left + padding.left; final int bottom = margin.bottom + border.bottom + padding.bottom; this.m_entity.getTransformer().setTranslation(0, this.m_x, this.m_y); if (this.m_modulationColor != null) { this.m_entity3D.setColor( this.m_modulationColor.getRed(), this.m_modulationColor.getGreen(), this.m_modulationColor.getBlue(), this.m_modulationColor.getAlpha()); for (int i = 0, isize = this.m_textDataList.size(); i < isize; ++i) { this.m_textDataList .get(i) .getParticle() .setGlobalColor( this.m_modulationColor.getRed() * this.m_modulationColor.getAlpha(), this.m_modulationColor.getGreen() * this.m_modulationColor.getAlpha(), this.m_modulationColor.getBlue() * this.m_modulationColor.getAlpha(), this.m_modulationColor.getAlpha()); } } else { this.m_entity3D.setColor(1.0f, 1.0f, 1.0f, 1.0f); for (int i = 0, isize = this.m_textDataList.size(); i < isize; ++i) { this.m_textDataList.get(i).getParticle().setGlobalColor(1.0f, 1.0f, 1.0f, 1.0f); } } for (int i = 0, listSize = this.m_imageDataList.size(); i < listSize; ++i) { final ImageData imageData = this.m_imageDataList.get(i); final int x = imageData.getX() * this.m_chunkWidth + left; final int y = imageData.getY() * this.m_chunkHeight + bottom + size.height; final GeometrySprite geometry = (GeometrySprite) this.m_entity3D.getGeometry(i); geometry.setTopLeft(y, x); } for (int i = 0, listSize = this.m_textDataList.size(); i < listSize; ++i) { final TextData textData = this.m_textDataList.get(i); final GeometryMesh geom = (GeometryMesh) this.m_entity3D.getGeometry(i + this.m_imageDataList.size()); this.setTextGeometryPosition(geom.getVertexBuffer(), textData); } }