int main(){ FrameworkInitialise("HelloWorld",1280,720,false); FrameworkBGColour(0.2f,0.4f,0.8f,1.0f); Sprite sprCarpet = SpriteLoad("./Images/Carpet.png",32,32,16,16); Font fntCourierNew = FontLoad("./Fonts/CourierNew.fnt"); //UPDATE while (FrameworkUpdate()){ //CLEAR AND DELTASET FrameworkClearScreen(); DeltaTimeSet(); count++; FPS = FPSGet(); for (int index = 1;index <= count; index++){ SpriteMove(sprCarpet,rand()%1280-640,rand()%720-360,rand()%99+1); SpriteDraw(sprCarpet); } if (FPS > 59.9f && FPS < 60.1f){ std::cout << "FPS :" << FPS << " sprite count :" << count << " triangle count : " << count*2 << std::endl; } if (FPS > 29.9f && FPS < 30.1f){ std::cout << "FPS :" << FPS << " sprite count :" << count << " triangle count : " << count*2 << std::endl; } DrawInt(fntCourierNew,GetInstanceCount(),0,360,0,true); } FrameworkShutdown(); return 1+1-1-1; }
void NodeInstanceManager::Load(const QSettings& settings) { // Load instance settings from registry while (true) { QString instanceKey = QString("instance%1").arg(GetInstanceCount()); QVariant instanceSettings = settings.value( instanceKey ); if ( instanceSettings.isNull() ) break; if ( !instanceSettings.canConvert<NodeInstanceSettings>() ) break; // Create node instance widget CreateInstance( instanceSettings.value<NodeInstanceSettings>() ); } }
void ModelRenderStore::InsertInModelStore(unsigned int location, Model* model) { if (location == GetInstanceCount()) { AddModelToStore(model); } else { glm::mat4 mvMatrix = glm::scale(PhysicsGenerator::GetBodyMatrix(model->body), model->scaleFactor); matrixStore[location * 4] = mvMatrix[0]; matrixStore[location * 4 + 1] = mvMatrix[1]; matrixStore[location * 4 + 2] = mvMatrix[2]; matrixStore[location * 4 + 3] = mvMatrix[3]; shadingColorSelectionStore[location * 2] = model->color; shadingColorSelectionStore[location * 2 + 1] = glm::vec4(model->selected ? 0.40f : 0.0f); } }
void ModelRenderStore::AddModelToStore(Model* model) { if (GetInstanceCount() == MODELS_PER_RENDER) { // TODO handle this scenario so we cannot hit it. Logger::LogError("Cannot render model, too many renders of this model type attempted!"); return; } glm::mat4 mvMatrix = glm::scale(PhysicsGenerator::GetBodyMatrix(model->body), model->scaleFactor); matrixStore.push_back(mvMatrix[0]); matrixStore.push_back(mvMatrix[1]); matrixStore.push_back(mvMatrix[2]); matrixStore.push_back(mvMatrix[3]); shadingColorSelectionStore.push_back(model->color); shadingColorSelectionStore.push_back(glm::vec4(model->selected ? 0.40f : 0.0f)); }
// Make the instance count available publicly. static int InstanceCount() { return GetInstanceCount(); }
FUErrorSimpleHandler errorHandler; FCollada::SetDereferenceFlag(false); FCDocument* firstDoc = FCollada::NewTopDocument(); PassIf(FCollada::LoadDocumentFromFile(firstDoc, FC("XRefDoc1.dae"))); FCDocument* secondDoc = FCollada::NewTopDocument(); PassIf(FCollada::LoadDocumentFromFile(secondDoc, FC("XRefDoc2.dae"))); PassIf(errorHandler.IsSuccessful()); FCDSceneNode* node1 = firstDoc->GetVisualSceneInstance(); FCDSceneNode* node2 = secondDoc->GetVisualSceneInstance(); FailIf(node1 == NULL || node2 == NULL || node1->GetChildrenCount() == 0 || node2->GetChildrenCount() == 0); node1 = node1->GetChild(0); node2 = node2->GetChild(0); FailIf(node1 == NULL || node2 == NULL); PassIf(node1->GetInstanceCount() == 1 && node2->GetInstanceCount() == 1); FCDEntityInstance* instance1 = node1->GetInstance(0); FCDEntityInstance* instance2 = node2->GetInstance(0); PassIf(instance1 != NULL && instance2 != NULL); PassIf(instance1->GetEntityType() == FCDEntity::GEOMETRY && instance2->GetEntityType() == FCDEntity::GEOMETRY); FCDGeometry* mesh1 = (FCDGeometry*) instance1->GetEntity(); FCDGeometry* mesh2 = (FCDGeometry*) instance2->GetEntity(); PassIf(mesh1 != NULL && mesh2 != NULL); PassIf(mesh1->GetDocument() == secondDoc); PassIf(mesh2->GetDocument() == firstDoc); SAFE_RELEASE(firstDoc); SAFE_RELEASE(secondDoc); TESTSUITE_END
PyObject* LMF_GetInstanceCount(PyObject *self, PyObject *args){ unsigned int InstanceCount = GetInstanceCount(); return Py_BuildValue("i", InstanceCount); }