Esempio n. 1
0
Doc::Doc(QObject* parent, int universes)
    : QObject(parent)
    , m_wsPath("")
    , m_fixtureDefCache(new QLCFixtureDefCache)
    , m_modifiersCache(new QLCModifiersCache)
    , m_rgbScriptsCache(new RGBScriptsCache(this))
    , m_ioPluginCache(new IOPluginCache(this))
    , m_audioPluginCache(new AudioPluginCache(this))
    , m_ioMap(new InputOutputMap(this, universes))
    , m_masterTimer(new MasterTimer(this))
    , m_monitorProps(NULL)
    , m_mode(Design)
    , m_kiosk(false)
    , m_loadStatus(Cleared)
    , m_clipboard(new QLCClipboard(this))
    , m_fixturesListCacheUpToDate(false)
    , m_latestFixtureId(0)
    , m_latestFixtureGroupId(0)
    , m_latestChannelsGroupId(0)
    , m_latestFunctionId(0)
    , m_startupFunctionId(Function::invalidId())
{
    Bus::init(this);
    resetModified();
    qsrand(QTime::currentTime().msec());
}
Esempio n. 2
0
bool MyWidget::saveAs() {
    fileName = QFileDialog::getSaveFileName(this, tr("Save qCharts File"), QDir::currentPath(), tr("qCharts Files (*.xml)"));
    if(fileName.isEmpty())
        return false;
    FileWriter writer(fileName, model, this);
    resetModified();
    return true;
}
Esempio n. 3
0
bool MyWidget::save() {
    if(fileName.isEmpty())
        return saveAs();
    else {
        FileWriter writer(fileName, model, this);
        resetModified();
        return true;
    }
}
Esempio n. 4
0
void MyWidget::open() {
    if(maybeSave()) {
        fileName = QFileDialog::getOpenFileName(this, tr("Open qCharts File"), QDir::currentPath(), tr("qCharts Files (*.xml)"));
        if(!fileName.isEmpty()) {
            FileReader reader(fileName, model, this);
            reader.read();
        }
        changingModel();
        resetModified();
    }
}
Esempio n. 5
0
void MyWidget::newChart() {
    if(maybeSave()) {
        titleEdit->clear();
        xEdit->clear();
        yEdit->clear();
        createModel();
        createView();
        canvas->setVariable(0, "", typeData, 0);
        canvas->draw();
        resetModified();
        showRadioButton();
    }
}
Esempio n. 6
0
void pageOut(mmu *m, int index, int instnnd, int phy){

  char instname[6];
  strcpy(instname, "OUT");
  PRINT_INST(instnnd, instname, index, phy);

  resetModified(&(m->pageT[index]));
  pagedout(&(m->pageT[index]));
  
  m->outs_N += 1;

  return;
}
void QmlProfilerNotesModel::loadData()
{
    blockSignals(true);
    clear();
    const QVector<QmlProfilerDataModel::QmlEventNoteData> &notes =
            m_modelManager->qmlModel()->getEventNotes();
    for (int i = 0; i != notes.size(); ++i) {
        const QmlProfilerDataModel::QmlEventNoteData &note = notes[i];
        add(note.typeIndex, note.startTime, note.duration, note.text);
    }
    resetModified();
    blockSignals(false);
    emit changed(-1, -1, -1);
}
Esempio n. 8
0
Doc::Doc(QObject* parent, int outputUniverses, int inputUniverses)
    : QObject(parent)
    , m_fixtureDefCache(new QLCFixtureDefCache)
    , m_outputMap(new OutputMap(this, outputUniverses))
    , m_masterTimer(new MasterTimer(this))
    , m_inputMap(new InputMap(this, inputUniverses))
    , m_mode(Design)
    , m_kiosk(false)
    , m_latestFixtureId(0)
    , m_latestFixtureGroupId(0)
    , m_latestFunctionId(0)
{
    Bus::init(this);
    resetModified();
}
Esempio n. 9
0
void OSPRayMaterial::commit()
{
    // Do nothing until this material is instanced for a specific renderer
    if (!_ospMaterial || !isModified())
        return;

    if (getCurrentType() == "simulation")
        osphelper::set(_ospMaterial, "apply_simulation", 1);
    else
        ospRemoveParam(_ospMaterial, "apply_simulation");

    osphelper::set(_ospMaterial, "kd", Vector3f(_diffuseColor));
    osphelper::set(_ospMaterial, "ks", Vector3f(_specularColor));
    osphelper::set(_ospMaterial, "ns", static_cast<float>(_specularExponent));
    osphelper::set(_ospMaterial, "d", static_cast<float>(_opacity));
    osphelper::set(_ospMaterial, "refraction",
                   static_cast<float>(_refractionIndex));
    osphelper::set(_ospMaterial, "reflection",
                   static_cast<float>(_reflectionIndex));
    osphelper::set(_ospMaterial, "a", static_cast<float>(_emission));
    osphelper::set(_ospMaterial, "glossiness", static_cast<float>(_glossiness));
    osphelper::set(_ospMaterial, "skybox", _isBackGroundMaterial);

    // Properties
    toOSPRayProperties(*this, _ospMaterial);

    // Textures
    for (const auto& textureType : textureTypeMaterialAttribute)
        ospSetObject(_ospMaterial, textureType.attribute.c_str(), nullptr);

    for (const auto& textureDescriptor : _textureDescriptors)
    {
        const auto texType = textureDescriptor.first;
        auto texture = getTexture(texType);
        if (texture)
        {
            auto ospTexture = _createOSPTexture2D(texture);
            const auto str =
                textureTypeMaterialAttribute[texType].attribute.c_str();
            ospSetObject(_ospMaterial, str, ospTexture);
            ospRelease(ospTexture);
        }
    }

    ospCommit(_ospMaterial);
    resetModified();
}
Esempio n. 10
0
void Controller::DrawStrokes()
{
	if (_ViewMap == 0)
		return;

	if (G.debug & G_DEBUG_FREESTYLE) {
		cout << "\n===  Stroke drawing  ===" << endl;
	}
	_Chrono.start();
	_Canvas->Draw();
	real d = _Chrono.stop();
	if (G.debug & G_DEBUG_FREESTYLE) {
		cout << "Strokes generation  : " << d << endl;
		cout << "Stroke count  : " << _Canvas->getStrokeCount() << endl;
	}
	resetModified();
	DeleteViewMap();
}
Esempio n. 11
0
void QmlProfilerNotesModel::saveData()
{
    QVector<QmlProfilerDataModel::QmlEventNoteData> notes;
    for (int i = 0; i < count(); ++i) {
        const Timeline::TimelineModel *model = timelineModelByModelId(timelineModel(i));
        if (!model)
            continue;

        int index = timelineIndex(i);
        QmlProfilerDataModel::QmlEventNoteData save = {
            model->typeId(index),
            model->startTime(index),
            model->duration(index),
            text(i)
        };
        notes.append(save);
    }
    m_modelManager->qmlModel()->setNoteData(notes);
    resetModified();
}
Esempio n. 12
0
int unmap(mmu *m, int index, int instnnd){
  int re =  m->pageT[index].frameid;
  char instname[6];
  strcpy(instname, "UNMAP");
  PRINT_INST(instnnd, instname, index, re);

  resetPresent(&(m->pageT[index]));
  resetReference(&(m->pageT[index]));

  if (m->pageT[index].modified == 1){
    pageOut(m, index, instnnd, re); 
  }
  resetModified(&(m->pageT[index]));

  m->frames[re] = -1;
  m->frameN -= 1;
  resetFrameid(&(m->pageT[index]));

  m->unmaps_N += 1;

  return re;
}
Esempio n. 13
0
void Controller::ComputeViewMap()
{
	if (!_ListOfModels.size())
		return;

	DeleteViewMap(true);

	// retrieve the 3D viewpoint and transformations information
	//----------------------------------------------------------
	// Save the viewpoint context at the view level in order 
	// to be able to restore it later:

	// Restore the context of view:
	// we need to perform all these operations while the 
	// 3D context is on.
	Vec3f vp(UNPACK3(g_freestyle.viewpoint));

#if 0
	if (G.debug & G_DEBUG_FREESTYLE) {
		cout << "mv" << endl;
	}
#endif
	real mv[4][4];
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			mv[i][j] = g_freestyle.mv[i][j];
#if 0
			if (G.debug & G_DEBUG_FREESTYLE) {
				cout << mv[i][j] << " ";
			}
#endif
		}
#if 0
		if (G.debug & G_DEBUG_FREESTYLE) {
			cout << endl;
		}
#endif
	}

#if 0
	if (G.debug & G_DEBUG_FREESTYLE) {
		cout << "\nproj" << endl;
	}
#endif
	real proj[4][4];
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			proj[i][j] = g_freestyle.proj[i][j];
#if 0
			if (G.debug & G_DEBUG_FREESTYLE) {
				cout << proj[i][j] << " ";
			}
#endif
		}
#if 0
		if (G.debug & G_DEBUG_FREESTYLE) {
			cout << endl;
		}
#endif
	}

	int viewport[4];
	for (int i = 0; i < 4; i++)
		viewport[i] = g_freestyle.viewport[i];

#if 0
	if (G.debug & G_DEBUG_FREESTYLE) {
		cout << "\nfocal:" << _pView->GetFocalLength() << endl << endl;
	}
#endif

	// Flag the WXEdge structure for silhouette edge detection:
	//----------------------------------------------------------

	if (G.debug & G_DEBUG_FREESTYLE) {
		cout << "\n===  Detecting silhouette edges  ===" << endl;
	}
	_Chrono.start();

	edgeDetector.setViewpoint(vp);
	edgeDetector.enableOrthographicProjection(proj[3][3] != 0.0);
	edgeDetector.enableRidgesAndValleysFlag(_ComputeRidges);
	edgeDetector.enableSuggestiveContours(_ComputeSuggestive);
	edgeDetector.enableMaterialBoundaries(_ComputeMaterialBoundaries);
	edgeDetector.enableFaceSmoothness(_EnableFaceSmoothness);
	edgeDetector.setCreaseAngle(_creaseAngle);
	edgeDetector.setSphereRadius(_sphereRadius);
	edgeDetector.setSuggestiveContourKrDerivativeEpsilon(_suggestiveContourKrDerivativeEpsilon);
	edgeDetector.setRenderMonitor(_pRenderMonitor);
	edgeDetector.processShapes(*_winged_edge);

	real duration = _Chrono.stop();
	if (G.debug & G_DEBUG_FREESTYLE) {
		printf("Feature lines    : %lf\n", duration);
	}

	if (_pRenderMonitor->testBreak())
		return;

	// Builds the view map structure from the flagged WSEdge structure:
	//----------------------------------------------------------
	ViewMapBuilder vmBuilder;
	vmBuilder.setEnableQI(_EnableQI);
	vmBuilder.setViewpoint(vp);
	vmBuilder.setTransform(mv, proj, viewport, _pView->GetFocalLength(), _pView->GetAspect(), _pView->GetFovyRadian());
	vmBuilder.setFrustum(_pView->znear(), _pView->zfar());
	vmBuilder.setGrid(&_Grid);
	vmBuilder.setRenderMonitor(_pRenderMonitor);

#if 0
	// Builds a tesselated form of the silhouette for display purpose:
	//---------------------------------------------------------------
	ViewMapTesselator3D sTesselator3d;
	ViewMapTesselator2D sTesselator2d;
	sTesselator2d.setNature(_edgeTesselationNature);
	sTesselator3d.setNature(_edgeTesselationNature);
#endif

	if (G.debug & G_DEBUG_FREESTYLE) {
		cout << "\n===  Building the view map  ===" << endl;
	}
	_Chrono.start();
	// Build View Map
	_ViewMap = vmBuilder.BuildViewMap(*_winged_edge, _VisibilityAlgo, _EPSILON, _Scene3dBBox, _SceneNumFaces);
	_ViewMap->setScene3dBBox(_Scene3dBBox);

	if (G.debug & G_DEBUG_FREESTYLE) {
		printf("ViewMap edge count : %i\n", _ViewMap->viewedges_size());
	}

#if 0
	// Tesselate the 3D edges:
	_SilhouetteNode = sTesselator3d.Tesselate(_ViewMap);
	_SilhouetteNode->addRef();

	// Tesselate 2D edges
	_ProjectedSilhouette = sTesselator2d.Tesselate(_ViewMap);
	_ProjectedSilhouette->addRef();
#endif

	duration = _Chrono.stop();
	if (G.debug & G_DEBUG_FREESTYLE) {
		printf("ViewMap building : %lf\n", duration);
	}

#if 0
	_pView->AddSilhouette(_SilhouetteNode);
	_pView->AddSilhouette(_WRoot);
	_pView->Add2DSilhouette(_ProjectedSilhouette);
	_pView->Add2DVisibleSilhouette(_VisibleProjectedSilhouette);
	_pView->AddDebug(_DebugNode);
#endif

	// Draw the steerable density map:
	//--------------------------------
	if (_ComputeSteerableViewMap) {
		ComputeSteerableViewMap();
	}
	// Reset Style modules modification flags
	resetModified(true);

	DeleteWingedEdge();
}