bool GPU::Texture2D::Create( GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* data ) { if( Instantiate() ) { glBindTexture( GL_TEXTURE_2D, m_Id ); glTexImage2D( GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, data ); m_Width = width; m_Height = height; return true; } else return false; }
bool GPU::Texture2D::Create( GLint internalFormat, GLsizei width, GLsizei height ) { if( Instantiate() ) { glBindTexture( GL_TEXTURE_2D, m_Id ); glTexImage2D( GL_TEXTURE_2D, 0, internalFormat, width, height, 0, GL_RGB, GL_FLOAT, NULL ); m_Width = width; m_Height = height; return true; } else return false; }
bool GPU::Shader::PgObject::CompileSrcString( const char *sourceString, const GLenum pgType, std::string *logs ) { // Ask for a free shader object name to OpenGL. m_PgType = pgType; if( Instantiate() ) { // Create the shader object. glShaderSourceARB ( m_Id, 1, (const GLcharARB**) &sourceString, NULL ); glCompileShaderARB( m_Id ); // Check the compilation status. GLint status; glGetObjectParameterivARB( m_Id, GL_OBJECT_COMPILE_STATUS_ARB, &status ); if( status ) return true; else if( logs ) *logs = GPU::Shader::GetLogs( m_Id ); Release(); } return false; }
// -------------------------------------------------- void Fonts::SetTo(BMessage *archive) { BArchivable *a = Instantiate(archive); Fonts *f = a ? dynamic_cast<Fonts*>(a) : NULL; if (f) { const int n = Length(); const int m = f->Length(); for (int i = 0; i < m; i ++) { FontFile *font = f->At(i); for (int j = 0; j < n; j ++) { if (strcmp(font->Path(), At(j)->Path()) == 0) { At(j)->SetEmbed(font->Embed()); At(j)->SetSubst(font->Subst()); break; } } } font_encoding enc; bool active; for (int i = 0; f->GetCJKOrder(i, enc, active); i++) { SetCJKOrder(i, enc, active); } delete f; } }
Item Require(KEY_TYPE key) { auto iterator = std::find(instances.begin(), instances.end(), key); if (iterator != instances.end()) return (Item(&(*iterator))); return (Item(&Instantiate(key))); }
int32 ConditionalAllAppsIterator::GetNextDirents(struct dirent *buffer, size_t length, int32 count) { if (!Iterate()) return 0; Instantiate(); return fWalker->GetNextDirents(buffer, length, count); }
status_t ConditionalAllAppsIterator::GetNextRef(entry_ref* ref) { if (!Iterate()) return B_ENTRY_NOT_FOUND; Instantiate(); return fWalker->GetNextRef(ref); }
status_t ConditionalAllAppsIterator::Rewind() { if (!Iterate()) return B_OK; Instantiate(); return fWalker->Rewind(); }
//------------------------------------------------------------------------------------------- void RemoveCallback(void) { iVersion = 0; // remove the callbackprocedure Instantiate(cInstNotification, cNotifyRemoveCallback, 0, 0); // fit the buttons' appearances EnableWindow(hwInstall, true); EnableWindow(hwRemove, false); }
int32 ConditionalAllAppsIterator::CountEntries() { if (!Iterate()) return 0; Instantiate(); return fWalker->CountEntries(); }
status_t ConditionalAllAppsIterator::GetNextEntry(BEntry* entry, bool traverse) { if (!Iterate()) return B_ENTRY_NOT_FOUND; Instantiate(); return fWalker->GetNextEntry(entry, traverse); }
bool GPU::Texture2D::Create() { if( Instantiate() ) { glBindTexture( GL_TEXTURE_2D, m_Id ); m_Width = m_Height = 0; return true; } else return false; }
bool BuiltinEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxString & path) { auto effect = Instantiate(path); if (effect) { pm.RegisterPlugin(this, effect.get()); return true; } return false; }
//------------------------------------------------------------------------------------------- void InstallCallback(void) { // check if WLM is running if ( Instantiate(cInstCheckForWLM, 1, 0, 0) ) { // Get version information for display resolution iVersion = GetWLMVersion(iVersion); // install the callback procedure Instantiate(cInstNotification, cNotifyInstallCallback, (long)&MyCallbackProc, 0); // fit te buttons' appearances EnableWindow(hwRemove, true); EnableWindow(hwInstall, false); } else // simply call this to toggle the buttons if needed RemoveCallback(); // obtain the existing wavelength on first call dblLambda = GetWavelength(dblLambda); ShowLambda(); }
void displayUtils::OpenSegmentModel(std::string filename) { Instantiate(reader,vtkSTLReader); reader -> SetFileName(filename.c_str()); reader -> Update(); // *****************add texture for model******************** Instantiate(tmapper,vtkTextureMapToSphere); tmapper -> SetInputConnection(reader -> GetOutputPort()); // tmapper -> PreventSeamOn(); Instantiate(xform,vtkTransformTextureCoords); xform -> SetInputConnection(tmapper->GetOutputPort()); xform -> SetScale(4,4,1); Instantiate(jpgreader,vtkJPEGReader); jpgreader -> SetFileName("D:\\3dresearch\\QtItkVtk\\test\\VirtualEndo\\res\\texture2.jpg"); jpgreader -> Update(); Instantiate(texture,vtkTexture); texture -> SetInputConnection(jpgreader->GetOutputPort()); texture -> InterpolateOn(); // ************************************************************ //build connection Instantiate(mapper,vtkPolyDataMapper); mapper -> SetInputConnection(xform -> GetOutputPort()); m_stlactor -> SetMapper(mapper); m_stlactor -> SetTexture(texture); // m_stlactor->GetProperty()->SetColor(1., .0, .0); sliderWidget->EnabledOn(); has_stl = true; // m_renderer->ResetCamera(); }
void rb::GameScene::Start() { SetBackgroundColour(Colour::darkGrey); asteroidSpawnerPrefab = std::make_unique<GameObject>(); asteroidSpawnerPrefab->AddScript<AsteroidSpawner>(); Instantiate(*asteroidSpawnerPrefab); cannonPrefab = std::make_unique<GameObject>(); cannonPrefab->AddScript<Cannon>(); cannonPrefab->SetTransform(Vec2(Screen::WidthToFloat()*0.5f, 50.0f)); Instantiate(*cannonPrefab); mouseClickEvent = Input::RegisterMouseClickCallback([&](int button, int action, const Vec2& mousePos) {OnMouseClick(button, action, mousePos); }); backgroundPrefab = std::make_unique<GameObject>(TextureManager::GetTexture("Background")); backgroundPrefab->tag = "Background"; backgroundPrefab->SetTransform(Screen::Center(), 0.0f, Screen::GetResolution()); Instantiate(*backgroundPrefab); city1Prefab = std::make_unique<GameObject>(TextureManager::GetTexture("City1")); //city1Prefab->GetTransform()->s Instantiate(*city1Prefab, Vec2(300.0f, 75.0f), 0.0f); }
/*! \brief Default constructor */ ActivityData::ActivityData( BMessage* in ) : bNotification( false ), bSound( false ), bEmailToSend( false ), bProgramRun( false ), bVerifiedByUser( true ) { for ( int i = 0; i < ACTIVITY_NUMBER_OF_EMAIL_ADDRESSES; ++i ) { bIsAddressEmpty[ i ] = true; } if ( in ) { Instantiate( in ); } } // <-- end of default constructor
FileTree::FileTree(BMessage* archive) : Nodes(new BList()), intSize(new int64(0)) { BMessage objMessage; int32 nodeIndex = 0; while(archive->FindMessage("Nodes", nodeIndex, &objMessage) == B_OK) { FileTree *tmp = cast_as(Instantiate(&objMessage), FileTree); Nodes->AddItem(tmp); nodeIndex++; } archive->FindBool("File", File); archive->FindBool("Query", Query); archive->FindString("Path", &Path); archive->FindInt64("intSize", intSize); }
bool GPU::RenderBuffer::Create( const GLuint format, const unsigned int w, const unsigned int h ) { if( w && h && Instantiate() ) { m_Width = w; m_Height = h; glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, m_Id ); glRenderbufferStorageEXT( GL_RENDERBUFFER, format, w, h ); return true; } return false; }
int main(int argc, char *argv[]) { int i; int T = 0; char *alsadev = "hw:0"; printf("This is %s\n", argv[0]); for (i=0; i < argc; i++) { if (strncmp(argv[i], "hw:", 3) == 0) { alsadev = argv[i]; } else if (streq(argv[i], "T")) { T = 1; } } AVIDemux_init(); Template_list(1); Instance *ad = Instantiate("AVIDemux"); printf("instance: %s\n", ad->label); SetConfig(ad, "input", "sample.avi"); Instance_loop_thread(ad); /* Wait loop. Hm, might as well run a console of sorts... */ while (1) { char buffer[256]; printf("avidemux>"); fflush(stdout); fgets(buffer, sizeof(buffer), stdin); if (buffer[0]) { buffer[strlen(buffer)-1] = 0; } if (streq(buffer, "quit")) { break; } } return 0; }
void displayUtils::centerLnDis(std::vector<OutputImageType::PointType> &inpoints) { int num = inpoints.size(); Instantiate(points,vtkPoints); Instantiate(vertices,vtkCellArray); Instantiate(lines,vtkCellArray); Instantiate(line,vtkLine); Instantiate(colors,vtkUnsignedCharArray); colors->SetNumberOfComponents(3); //green display each point. unsigned char green[3] = {0,255,0}; std::vector<OutputImageType::PointType>::const_iterator it = inpoints.begin(); for(unsigned int i = 0;i < num && it != inpoints.end();i++,it++){ vtkIdType pid[1]; pid[0] = points->InsertNextPoint((*it)[0],(*it)[1],(*it)[2]); colors->InsertNextTupleValue(green); vertices->InsertNextCell(1,pid); if(i < num-1){ line->GetPointIds()->SetId(0,i); line->GetPointIds()->SetId(1,i+1); lines->InsertNextCell(line); } } Instantiate(polydata,vtkPolyData); polydata->SetPoints(points); polydata->SetVerts(vertices); polydata->SetLines(lines); polydata->GetPointData()->SetScalars(colors); Instantiate(cenmapper,vtkPolyDataMapper); cenmapper->SetInputData(polydata); m_lineactor->SetMapper(cenmapper); has_line = true; m_renderer->AddActor(m_lineactor); m_renWindow->Render(); }
const ExecutionResult ComplexInstantiationStatement::Execute( const shared_ptr<ExecutionContext> context, const shared_ptr<ExecutionContext> closure) const { auto type_result = m_type_specifier->GetType(context->GetTypeTable(), RESOLVE); auto errors = type_result->GetErrors(); if (ErrorList::IsTerminator(errors)) { auto type = type_result->GetData<TypeDefinition>(); auto as_complex = dynamic_pointer_cast<const ComplexType>(type); if (as_complex) { errors = as_complex->Instantiate(context, m_type_specifier, GetName(), GetInitializerExpression()); } else { //type does not exist errors = ErrorList::From( make_shared<Error>(Error::RUNTIME, Error::UNDECLARED_TYPE, m_type_specifier_location.begin, m_type_specifier->ToString()), errors); } } return ExecutionResult(errors); }
IdentInterface *BuiltinEffectsModule::CreateInstance(const wxString & path) { // Acquires a resource for the application. // Safety of this depends on complementary calls to DeleteInstance on the module manager side. return Instantiate(path).release(); }
/** * Used to create a platform-specific shared library handler. */ SharedLib* SharedLib::Instantiate(const std::string& fileName) { return Instantiate(fileName.c_str()); }
IdentInterface *BuiltinEffectsModule::CreateInstance(const wxString & path) { return Instantiate(path); }
int main(int argc, char *argv[]) { char *mjxfile = 0L; char *limit = "0"; int connect = 1; int i; cfg.verbosity = 0; for (i=1; i < argc; i++) { if (strstr(argv[i], "limit=") == argv[i]) { limit = argv[i] + strlen("limit="); printf("limit set to %s\n", limit); } else if (sscanf(argv[i], "connect=%d", &connect) == 1) { printf("connect set to %d\n", connect); } else { mjxfile = argv[i]; } } if (!mjxfile) { fprintf(stderr, "Error: must supply .mjx file.\n"); return 1; } char mjxbase[256] = {}; for (i=0; mjxfile[i]; i++) { if (mjxfile[i] == '.') { break; } mjxbase[i] = mjxfile[i]; } if (mjxfile[i] != '.') { printf("no '.' found in mjxfile!\n"); } MjpegDemux_init(); DJpeg_init(); VFilter_init(); Mpeg2Enc_init(); Mp2Enc_init(); AudioLimiter_init(); Template_list(0); Instance *vf = Instantiate("VFilter"); Instance_loop_thread(vf); Instance *mjd = Instantiate("MjpegDemux"); SetConfig(mjd, "input", mjxfile); Instance *dj = Instantiate("DJpeg"); Instance_loop_thread(dj); Instance *mve = Instantiate("Mpeg2Enc"); SetConfig(mve, "vout", String_sprintf("%s.m2v", mjxbase)->bytes); //SetConfig(mve, "vout", "test.m2v"); Instance_loop_thread(mve); Instance *mae = Instantiate("Mp2Enc"); SetConfig(mae, "aout", String_sprintf("%s.mp2", mjxbase)->bytes); //SetConfig(mae, "aout", "test.mp2"); Instance_loop_thread(mae); if (connect) { Connect(mjd, "Jpeg_buffer", dj); if (!limit) { Connect(mjd, "Wav_buffer", mae); } else { Instance *al = Instantiate("AudioLimiter"); SetConfig(al, "limit", limit); Instance_loop_thread(al); Connect(mjd, "Wav_buffer", al); Connect(al, "Wav_buffer", mae); } } if (1) { Connect(dj, "YUV422P_buffer", vf); /* Don't actually need this if source is 352x480. */ // SetConfig(vf, "left_right_crop", "4"); SetConfig(vf, "linear_blend", "1"); Connect(vf, "YUV422P_buffer", mve); } else { Connect(dj, "YUV422P_buffer", mve); } Instance_loop_thread(mjd); /* Wait loop. Hm, might as well run a console of sorts... */ while (1) { char buffer[256]; printf("dvdgen>"); fflush(stdout); fgets(buffer, sizeof(buffer), stdin); if (buffer[0]) { buffer[strlen(buffer)-1] = 0; } if (streq(buffer, "quit")) { break; } else if (streq(buffer, "v")) { cfg.verbosity += 1; fgets(buffer, sizeof(buffer), stdin); /* Wait for line. */ cfg.verbosity -= 1; } } return 0; }
Sprite* NodeFactory::CreatePODSprite(const FileIdRef& modelName) { auto model = ModelFactory::Instance().Create(modelName); RETURN_NULL_IF_NULL(model); return (Sprite*)model->Instantiate(); }