| 95 | } |
| 96 | |
| 97 | bool TinyVRGui::init() |
| 98 | { |
| 99 | { |
| 100 | int width = 256; |
| 101 | int height = 256; |
| 102 | m_data->m_texelsRGB.resize(width * height * 3); |
| 103 | for (int i = 0; i < width; i++) |
| 104 | for (int j = 0; j < height; j++) |
| 105 | { |
| 106 | m_data->m_texelsRGB[(i + j * width) * 3 + 0] = 155; |
| 107 | m_data->m_texelsRGB[(i + j * width) * 3 + 1] = 155; |
| 108 | m_data->m_texelsRGB[(i + j * width) * 3 + 2] = 255; |
| 109 | } |
| 110 | |
| 111 | m_data->m_testCanvas = new TestCanvasInterface2(m_data->m_texelsRGB, width, height); |
| 112 | m_data->m_timeSeries = new TimeSeriesCanvas(m_data->m_testCanvas, width, height, "time series"); |
| 113 | |
| 114 | bool clearCanvas = false; |
| 115 | |
| 116 | m_data->m_timeSeries->setupTimeSeries(3, 100, 0, clearCanvas); |
| 117 | m_data->m_timeSeries->addDataSource("Some sine wave", 255, 0, 0); |
| 118 | m_data->m_timeSeries->addDataSource("Some cosine wave", 0, 255, 0); |
| 119 | m_data->m_timeSeries->addDataSource("Delta Time (*10)", 0, 0, 255); |
| 120 | m_data->m_timeSeries->addDataSource("Tan", 255, 0, 255); |
| 121 | m_data->m_timeSeries->addDataSource("Some cosine wave2", 255, 255, 0); |
| 122 | m_data->m_timeSeries->addDataSource("Empty source2", 255, 0, 255); |
| 123 | |
| 124 | m_data->m_textureId = m_data->m_renderer->registerTexture(&m_data->m_texelsRGB[0], width, height); |
| 125 | |
| 126 | { |
| 127 | const char* fileName = "cube.obj"; //"textured_sphere_smooth.obj"; |
| 128 | //fileName = "cube.obj"; |
| 129 | |
| 130 | int shapeId = -1; |
| 131 | |
| 132 | b3ImportMeshData meshData; |
| 133 | b3BulletDefaultFileIO fileIO; |
| 134 | if (b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(fileName, meshData,&fileIO)) |
| 135 | { |
| 136 | shapeId = m_data->m_renderer->registerShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0], |
| 137 | meshData.m_gfxShape->m_numvertices, |
| 138 | &meshData.m_gfxShape->m_indices->at(0), |
| 139 | meshData.m_gfxShape->m_numIndices, |
| 140 | B3_GL_TRIANGLES, |
| 141 | m_data->m_textureId); |
| 142 | |
| 143 | float position[4] = {0, 0, 2, 1}; |
| 144 | float orn[4] = {0, 0, 0, 1}; |
| 145 | float color[4] = {1, 1, 1, 1}; |
| 146 | float scaling[4] = {.1, .1, .1, 1}; |
| 147 | |
| 148 | m_data->m_gfxObjectId = m_data->m_renderer->registerGraphicsInstance(shapeId, position, orn, color, scaling); |
| 149 | m_data->m_renderer->writeTransforms(); |
| 150 | |
| 151 | meshData.m_gfxShape->m_scaling[0] = scaling[0]; |
| 152 | meshData.m_gfxShape->m_scaling[1] = scaling[1]; |
| 153 | meshData.m_gfxShape->m_scaling[2] = scaling[2]; |
| 154 |
no test coverage detected