void ZenFWRenderer::InitForEditor(WindowHandle_t windowHandle) { #ifdef WIN32 extern WindowHandle_t GEditorWindowHandle; GEditorWindowHandle = windowHandle; #endif #ifdef MAC_OS GDD = (IDisplayDevice*)_New(ZDisplayDeviceOGL); #else #ifdef LINUX GDD = (IDisplayDevice*)_New(ZDisplayDeviceOGL); #else GDD = (IDisplayDevice*)_New(ZDisplayDeviceDX9); //GDD = (IDisplayDevice*)_New(ZDisplayDeviceOGL); #endif #endif INITPARAMS RendererInitParams; GConfig->BuildInitParams(&RendererInitParams); RendererInitParams.fullscreen = false; GDD->Create(&RendererInitParams); mRenderProfile = RendererInitParams.RenderProfile; PrivateInit(RendererInitParams); }
void ZenFWRenderer::PrivateInit(const INITPARAMS& RendererInitParams) { // Sound _New(ZSoundManager); mSoundRenderer = GSoundManager; // mAtmosphere.Attach((ZAtmosphere*)_New(ZAtmosphere)); mCam = (ZCamera*)_New(ZCamera); mCam->SetActive(); tmatrix tmpmat; tmpmat.LookAt(tvector3(150, 340, 300), tvector3(0, 0, 0)/*::zero*/, tvector3::YAxis); mCam->GetTransform()->SetLocalMatrix(tmpmat); mCam->Update(); mCam->SetVFov(75.f*3.14159f / 180.f); mCam->SetPlanes(0.1f, 3000.0f); mCam->SetRatio( float(RendererInitParams.width)/float(RendererInitParams.height)); InitCEGui(); // GUI mProtoGui = (IProtoGUI*)_New(ZProtoGUI); }
void ZenFWGame::BuildClientServer(unsigned short aPort) { ZRushGame* rushNetClient = (ZRushGame*)_New(ZRushNetGameClient); mClientGame.Attach(rushNetClient); rushNetClient->DisableSceneMaster(); ZRushGame* rushNetServer = (ZRushGame*)_New(ZRushNetGameServer); mServerGame.Attach(rushNetServer); rushNetServer->ActAsServer(aPort); rushNetClient->Connect("127.0.0.1", aPort); }
SdfAttributeSpecHandle SdfAttributeSpec::New( const SdfPrimSpecHandle& owner, const std::string& name, const SdfValueTypeName& typeName, SdfVariability variability, bool custom) { TRACE_FUNCTION(); if (not owner) { TF_CODING_ERROR("Cannot create an SdfAttributeSpec with a null owner"); return TfNullPtr; } if (not Sdf_ChildrenUtils<Sdf_AttributeChildPolicy>::IsValidName(name)) { TF_CODING_ERROR( "Cannot create attribute on %s with invalid name: %s", owner->GetPath().GetText(), name.c_str()); return TfNullPtr; } SdfPath attributePath = owner->GetPath().AppendProperty(TfToken(name)); if (not attributePath.IsPropertyPath()) { TF_CODING_ERROR( "Cannot create attribute at invalid path <%s.%s>", owner->GetPath().GetText(), name.c_str()); return TfNullPtr; } return _New(owner, attributePath, typeName, variability, custom); }
void ZenFWGame::BuildServer(unsigned short aPort) { mClientGame = NULL; ZRushGame* rushNetServer = (ZRushGame*)_New(ZRushNetGameServer); mServerGame.Attach(rushNetServer); rushNetServer->ActAsServer(aPort); }
/* ZFx* ZFx::getDefaultFX() { if (GDD->GetClassID() == ClassIDZDisplayDeviceNULL) { static ZFx *genNULLFx = NULL; if (!genNULLFx) { genNULLFx = (ZFx*)_New(ZFx); genNULLFx->AddRef(); genNULLFx->SetName(".\\ZenithDatas\\DefaultShader.fx"); } return genNULLFx; } else if (GDD->GetClassID() == ClassIDZDisplayDeviceOGL) { if (!((ZDisplayDeviceOGL*)GDD)->gDefaultShader.ptr()) { ZFx* nnfx = DirectLoad(".\\ZenithDatas\\DefaultShader.fx"); ((ZDisplayDeviceOGL*)GDD)->gDefaultShader.Attach(nnfx); } return ((ZDisplayDeviceOGL*)GDD)->gDefaultShader.ptr(); } #ifdef WIN32 else if (!((ZDisplayDeviceDX9*)GDD)->gDefaultShader.ptr()) { ZFx* nnfx = DirectLoad(".\\ZenithDatas\\DefaultShader.fx"); ((ZDisplayDeviceDX9*)GDD)->gDefaultShader.Attach(nnfx); } return ((ZDisplayDeviceDX9*)GDD)->gDefaultShader.ptr(); #else return NULL; #endif } */ ZFx *DirectLoad(const char *filename) { tstring tmpf = filename ; tmpf.SimplifyPath(); ZFx* nnfx = (ZFx*)FindInstance(ZFx, tmpf.c_str()); if (nnfx) { nnfx->AddRef();// never free shader return nnfx; } nnfx = (ZFx*)_New(ZFx); FFxImport fxImport; if (GDD->GetClassID() != ClassIDZDisplayDeviceNULL) { fxImport.importCgfx(nnfx, gDefaultCGcontext, tmpf.c_str(), COMPILE_ARGS); //gDefaultShader.Attach(nnfx); nnfx->init(gDefaultCGcontext, true); } else { nnfx->AddRef(); } nnfx->SetName(tmpf); nnfx->AddRef(); // never free shader return nnfx; }
ZenFWGame::ZenFWGame() : ZenFWNode("ZenFWGame") { GGame = this; if (GetInputDevice()) GetInputDevice()->SetExclusive(true); rushContent = (ZRushGameContent*)_New(ZRushGameContent); }
void ZenFWRenderer::Init() { #ifdef MAC_OS GDD = (IDisplayDevice*)_New(ZDisplayDeviceOGL); #else #ifdef LINUX GDD = (IDisplayDevice*)_New(ZDisplayDeviceOGL); #else GDD = (IDisplayDevice*)_New(ZDisplayDeviceDX9); //GDD = (IDisplayDevice*)_New(ZDisplayDeviceOGL); #endif #endif INITPARAMS RendererInitParams; GConfig->BuildInitParams(&RendererInitParams); GDD->Create(&RendererInitParams); mRenderProfile = RendererInitParams.RenderProfile; PrivateInit(RendererInitParams); }
//----------------------------------------------------------------------------// void String::_Realloc(uint _newSize, bool _quantize) { if (_newSize < m_buffer->size && m_buffer->refs == 1) return; if (_quantize) _newSize = (_newSize + 1) << 1; Buffer* _newBuffer = _New(_newSize); memcpy(_newBuffer->str, m_buffer->str, m_buffer->length + 1); _newBuffer->length = m_buffer->length; m_buffer->Release(); m_buffer = _newBuffer; }
VaApiPostProcessor::VaApiPostProcessor() : d(new Data) { VAConfigID config; d->dpy = VaApi::glx(); if (!isSuccess(vaCreateConfig(d->dpy, VAProfileNone, VAEntrypointVideoProc, nullptr, 0, &config))) return; d->config = config; VAContextID context; if (!isSuccess(vaCreateContext(d->dpy, d->config, 0, 0, 0, NULL, 0, &context))) return; d->context = context; const auto filters = VaApi::filters(); for (int i=0; i<filters.size(); ++i) { switch (filters[i].type()) { case VAProcFilterDeinterlacing: _New(d->deinterlacer, i, d->context); break; default: continue; } } if (!filters.isEmpty()) _New(d->pipeline, d->context); }
SdfAttributeSpecHandle SdfAttributeSpec::New( const SdfRelationshipSpecHandle& owner, const SdfPath& targetPath, const std::string& name, const SdfValueTypeName& typeName, SdfVariability variability, bool custom) { TRACE_FUNCTION(); if (not owner) { TF_CODING_ERROR("NULL owner relationship"); return TfNullPtr; } return _New(owner, targetPath, name, typeName, variability, custom); }
void ZenFWGame::BuildClient() { mClientGame.Attach((ZRushGame*)_New(ZRushNetGameClient)); mServerGame = NULL; }
void ZenFWGame::BuildDDE() { mClientGame.Attach((ZGame*)_New(ZDDEGame)); mServerGame = NULL; }
void ZenFWGame::BuildSolo() { mClientGame.Attach((ZRushGame*)_New(ZRushGame)); mServerGame = NULL; }
App::App(int &argc, char **argv) : QApplication(argc, argv), d(new Data(this)) { if (QFile::exists(applicationDirPath() % "/bomi.ini"_a)) { QSettings set(applicationDirPath() % "/bomi.ini"_a, QSettings::IniFormat); d->useLocalConfig = set.value(u"app/use-local-config"_q, false).toBool(); Global::useLocalConfig = set.value(u"global/use-local-config"_q, false).toBool(); if (d->useLocalConfig != Global::useLocalConfig) { const auto from = _WritablePath(Location::Config, false); Global::useLocalConfig = d->useLocalConfig; const auto to = _WritablePath(Location::Config, false); d->copyConfig(from, to); set.setValue(u"global/use-local-config"_q, Global::useLocalConfig); } } #ifdef Q_OS_LINUX setlocale(LC_NUMERIC,"C"); #endif OS::initialize(); _New(d->parser); d->parser->addOption(LineCmd::Open, u"open"_q, u"Open given %1 for file path or URL."_q, u"mrl"_q); d->parser->addOption(LineCmd::SetSubtitle, u"set-subtitle"_q, u"Set subtitle file to display."_q, u"file"_q); // d->parser->addOption(LineCmd::AddSubtitle, u"add-subtitle"_q, // u"Add subtitle file to display."_q, u"file"_q); d->parser->addOption(LineCmd::Wake, u"wake"_q, u"Bring the application window in front."_q); d->parser->addOption(LineCmd::Action, u"action"_q, u"Exectute %1 action or open %1 menu."_q, u"id"_q); d->parser->addOption(LineCmd::LogLevel, u"log-level"_q, u"Maximum verbosity for log. %1 should be one of nexts:\n "_q % Log::levelNames().join(u", "_q), u"lv"_q); d->parser->addOption(LineCmd::Debug, u"debug"_q, u"Turn on options for debugging."_q); d->parser->addOption(LineCmd::DumpApiTree, u"dump-api-tree"_q, u"Dump API structure tree to stdout."_q); d->parser->addOption(LineCmd::DumpActionList, u"dump-action-list"_q, u"Dump executable action list to stdout."_q); #ifdef Q_OS_WIN d->parser->addOption(LineCmd::WinAssoc, u"win-assoc"_q, u"Associate given comma-separated extension list."_q, u"ext"_q); d->parser->addOption(LineCmd::WinUnassoc, u"win-unassoc"_q, u"Unassociate all extensions."_q); d->parser->addOption(LineCmd::WinAssocDefault, u"win-assoc-default"_q, u"Associate default extensions."_q); #endif d->parser->parse(arguments()); d->gldebug = d->parser->isSet(LineCmd::Debug); const auto lvStdOut = d->parser->stdoutLogLevel(); d->import(); d->storage.setObject(this, u"application"_q); d->storage.add("locale", &d->locale); d->storage.json("log-option", &d->logOption); d->storage.add("style-name", &d->styleName); d->storage.add("unique", &d->unique); d->storage.add("open-folders", open_folders, set_open_folders); d->storage.add("font"); d->storage.add("fixedFont"); d->storage.restore(); setLocale(d->locale); auto logOption = d->logOption; if (logOption.level(LogOutput::StdOut) < lvStdOut) logOption.setLevel(LogOutput::StdOut, lvStdOut); Log::setOption(logOption); setQuitOnLastWindowClosed(false); #ifndef Q_OS_MAC setWindowIcon(defaultIcon()); #endif d->styleNames = [this] () { auto names = QStyleFactory::keys(); const auto defaultName = style()->objectName(); for (auto it = ++names.begin(); it != names.end(); ++it) { if (defaultName.compare(*it, Qt::CaseInsensitive) == 0) { const auto name = *it; names.erase(it); names.prepend(name); break; } } return names; }(); auto makeStyle = [&]() { auto name = d->styleName; if (style()->objectName().compare(name, Qt::CaseInsensitive) == 0) return; if (!d->styleNames.contains(name, Qt::CaseInsensitive)) return; setStyle(QStyleFactory::create(name)); }; makeStyle(); connect(&d->connection, &LocalConnection::messageReceived, this, &App::handleMessage); }