Ejemplo n.º 1
0
      // construction based on clip instance
      ImageBase::ImageBase(ClipInstance& instance,
                   double renderScaleX, 
                   double renderScaleY,
                   const OfxRectI &bounds,
                   const OfxRectI &rod,
                   int rowBytes,
                   std::string field,
                   std::string uniqueIdentifier) 
        : Property::Set(imageBaseStuffs)
        , _referenceCount(1)
      {
        getClipBits(instance);

        // set other data
        setDoubleProperty(kOfxImageEffectPropRenderScale,renderScaleX, 0);    
        setDoubleProperty(kOfxImageEffectPropRenderScale,renderScaleY, 1);        
        setIntProperty(kOfxImagePropBounds,bounds.x1, 0);
        setIntProperty(kOfxImagePropBounds,bounds.y1, 1);
        setIntProperty(kOfxImagePropBounds,bounds.x2, 2);
        setIntProperty(kOfxImagePropBounds,bounds.y2, 3);
        setIntProperty(kOfxImagePropRegionOfDefinition,rod.x1, 0);
        setIntProperty(kOfxImagePropRegionOfDefinition,rod.y1, 1);
        setIntProperty(kOfxImagePropRegionOfDefinition,rod.x2, 2);
        setIntProperty(kOfxImagePropRegionOfDefinition,rod.y2, 3);        
        setIntProperty(kOfxImagePropRowBytes,rowBytes);
        
        setStringProperty(kOfxImagePropField,field);
        setStringProperty(kOfxImageClipPropFieldOrder,field);
        setStringProperty(kOfxImagePropUniqueIdentifier,uniqueIdentifier);
      }
Ejemplo n.º 2
0
void MapThing::setAnglePoint(fpoint2_t point) {
	// Calculate direction vector
	fpoint2_t vec(point.x - x, point.y - y);
	double mag = sqrt((vec.x * vec.x) + (vec.y * vec.y));
	double x = vec.x / mag;
	double y = vec.y / mag;

	// Determine angle
	int angle = 0;
	if (x > 0.89)				// east
		angle = 0;
	else if (x < -0.89)			// west
		angle = 180;
	else if (y > 0.89)			// north
		angle = 90;
	else if (y < -0.89)			// south
		angle = 270;
	else if (x > 0 && y > 0)	// northeast
		angle = 45;
	else if (x < 0 && y > 0)	// northwest
		angle = 135;
	else if (x < 0 && y < 0)	// southwest
		angle = 225;
	else if (x > 0 && y < 0)	// southeast
		angle = 315;

	// Set thing angle
	setIntProperty("angle", angle);
}
Ejemplo n.º 3
0
      // construction based on clip instance
      Texture::Texture(ClipInstance& instance,
                   double renderScaleX, 
                   double renderScaleY,
                   int index,
                   int target,
                   const OfxRectI &bounds,
                   const OfxRectI &rod,
                   int rowBytes,
                   std::string field,
                   std::string uniqueIdentifier) 
        : ImageBase(instance, renderScaleX, renderScaleY, bounds, rod, rowBytes, field, uniqueIdentifier)
      {
        addProperties(textureStuffs);

        // set other data
        setIntProperty(kOfxImageEffectPropOpenGLTextureIndex, index);
        setIntProperty(kOfxImageEffectPropOpenGLTextureTarget, target);
      }
Ejemplo n.º 4
0
void QFRDRPhotonCountsData::resizeBinnedRates(long long N) {
    if (binnedRateT) qfFree(binnedRateT);
    if (binnedRate) qfFree(binnedRate);
    binnedRateN=0;
    binnedRateT=NULL;
    binnedRate=NULL;
    binnedRateN=N;
    if (N>0) {
        binnedRateT=(double*)qfCalloc(binnedRateN, sizeof(double));
        binnedRate=(double*)qfCalloc(binnedRateN*rateChannels, sizeof(double));
        if (!binnedRateT || !binnedRate)
            setError(tr("Error while allocating memory for binned count rate data!"));
        setIntProperty("BINNED_RATE_N", binnedRateN, false, false);
    }
    emitRawDataChanged();
}
Ejemplo n.º 5
0
/* MapLine::copy
 * Copies another map object [c]
 *******************************************************************/
void MapLine::copy(MapObject* c)
{
	if(getObjType() != c->getObjType())
		return;

	MapObject::copy(c);

	MapLine* l = static_cast<MapLine*>(c);

	if(side1 && l->side1)
		side1->copy(l->side1);

	if(side2 && l->side2)
		side2->copy(l->side2);

	setIntProperty("special", l->intProperty("special"));
}
Ejemplo n.º 6
0
// -----------------------------------------------------------------------------
// Apply values to opened objects
// -----------------------------------------------------------------------------
void SectorPropsPanel::applyChanges()
{
	for (auto& object : objects_)
	{
		auto sector = dynamic_cast<MapSector*>(object);

		// Special
		if (cb_override_special_->GetValue())
			sector->setIntProperty("special", panel_special_->selectedSpecial());

		// Floor texture
		if (!fcb_floor_->GetValue().IsEmpty())
			sector->setFloorTexture(fcb_floor_->GetValue().ToStdString());

		// Ceiling texture
		if (!fcb_ceiling_->GetValue().IsEmpty())
			sector->setCeilingTexture(fcb_ceiling_->GetValue().ToStdString());

		// Floor height
		if (!text_height_floor_->GetValue().IsEmpty())
			sector->setFloorHeight(text_height_floor_->number(sector->floor().height));

		// Ceiling height
		if (!text_height_ceiling_->GetValue().IsEmpty())
			sector->setCeilingHeight(text_height_ceiling_->number(sector->ceiling().height));

		// Light level
		if (!text_light_->GetValue().IsEmpty())
			sector->setLightLevel(text_light_->number(sector->lightLevel()));

		// Tag
		if (!text_tag_->GetValue().IsEmpty())
			sector->setTag(text_tag_->number(sector->tag()));
	}

	if (mopp_all_props_)
		mopp_all_props_->applyChanges();
}
Ejemplo n.º 7
0
  /// images are always SD PAL progressive full res images for the purpose of this example only
  MyImage::MyImage(MyClipInstance &clip, OfxTime time, int view)
    : OFX::Host::ImageEffect::Image(clip) /// this ctor will set basic props on the image
    , _data(NULL)
  {
    // make some memory
    _data = new OfxRGBAColourB[kPalSizeXPixels * kPalSizeYPixels] ; /// PAL SD RGBA
    
    int fillValue = (int)(floor(255.0 * (time/OFXHOSTDEMOCLIPLENGTH))) & 0xff;
    OfxRGBAColourB color;
#ifdef OFX_EXTENSIONS_VEGAS
    color.r = view == 0 ? fillValue : 0;
    color.g = view == 1 ? fillValue : 0;
    color.b = view == 1 ? fillValue : 0;
#else
    color.r = color.g = color.b = fillValue;
#endif
    color.a = 255;

    std::fill(_data, _data + kPalSizeXPixels * kPalSizeYPixels, color);
    // draw the time and the view number in reverse color
    const int scale = 5;
    const int charwidth = 4*scale;
#ifdef OFX_EXTENSIONS_VEGAS
    color.r = view == 0 ? 255-fillValue : 0;
    color.g = view == 1 ? 255-fillValue : 0;
    color.b = view == 1 ? 255-fillValue : 0;
#else
    color.r = color.g = color.b = 255-fillValue;
#endif
    int xx = 50;
    int yy = 50;
    int d;
    d = (int(time)/10)%10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);
    xx += charwidth;
    d = int(time)%10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);
    xx += charwidth;
    d = 10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);
    xx += charwidth;
    d = int(time*10)%10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);
    xx = 50;
    yy += 8*scale;
    d = int(view)%10;
    drawDigit(_data, kPalSizeXPixels, kPalSizeYPixels, d, xx, yy, scale, color);

    // render scale x and y of 1.0
    setDoubleProperty(kOfxImageEffectPropRenderScale, 1.0, 0);
    setDoubleProperty(kOfxImageEffectPropRenderScale, 1.0, 1); 

    // data ptr
    setPointerProperty(kOfxImagePropData,_data);

    // bounds and rod
    setIntProperty(kOfxImagePropBounds, kPalRegionPixels.x1, 0);
    setIntProperty(kOfxImagePropBounds, kPalRegionPixels.y1, 1);
    setIntProperty(kOfxImagePropBounds, kPalRegionPixels.x2, 2);
    setIntProperty(kOfxImagePropBounds, kPalRegionPixels.y2, 3);
    
    setIntProperty(kOfxImagePropRegionOfDefinition, kPalRegionPixels.x1, 0);
    setIntProperty(kOfxImagePropRegionOfDefinition, kPalRegionPixels.y1, 1);
    setIntProperty(kOfxImagePropRegionOfDefinition, kPalRegionPixels.x2, 2);
    setIntProperty(kOfxImagePropRegionOfDefinition, kPalRegionPixels.y2, 3);        

    // row bytes
    setIntProperty(kOfxImagePropRowBytes, kPalSizeXPixels * sizeof(OfxRGBAColourB));
  }
Ejemplo n.º 8
0
void QFRDRPhotonCountsData::setPhotonCountsBinnedN(int value) {
     autoCalcRateN=value;
     setIntProperty("AUTO_BINNED_RATE_N", value, false, false);
     calcPhotonCountsBinned();
}
Ejemplo n.º 9
0
/* MapSide::changeLight
 * Change the light level of a side, if supported
 *******************************************************************/
void MapSide::changeLight(int amount)
{
	if (parent_map->currentFormat() == MAP_UDMF && S_CMPNOCASE(parent_map->udmfNamespace(), "zdoom"))
		setIntProperty("light", intProperty("light") + amount);
}
bool FractalConfiguration::open(string filename)
{
	if(invalidID())
		return true;

	m_dirty = false;

	XMLDocument doc;

	// Parse file
	doc.LoadFile(filename.c_str());

	if(doc.Error())
	{
		m_last_error = doc.GetErrorStr1();
		return true;
	}

	// Get data
	XMLElement *root = doc.RootElement();

	string name = string(root->Name());

	if(name != "fractal")
	{
		m_last_error = "Configuration file is invalid!";
		return true;
	}

	if(root->Attribute("id", m_id.c_str()))
	{
		XMLNode *node = root->FirstChild();

		// Loop over all properties
		while(node != NULL)
		{
			XMLElement *element = node->ToElement();

			if(element == NULL)
			{
				m_last_error = "Configuration file is invalid!";
				return true;
			}

			// Get name and type (attributes)
			const char* tmp_name = element->Attribute("name");
			const char* tmp_type = element->Attribute("type");

			if(tmp_name == NULL || tmp_type == NULL)
			{
				m_last_error = "Configuration file is invalid!";
				return true;
			}

			string name(tmp_name);
			string type(tmp_type);

			// Get text
			const char* tmp_text = element->GetText();
			string text = "";

			if(tmp_text != NULL)
				text = tmp_text;

			// Set property
			if(type == "string")
			{
				if(setStringProperty(name, text))
					return true;
			}
			else if(type == "int")
			{
				int value;
				if(stringToInt(text, &value))
				{
					m_last_error = "Error in configuration: " + text + " should be an integer";
					return true;
				}

				if(setIntProperty(name, value))
					return true;
			}
			else if(type == "double")
			{
				double value;
				if(stringToDouble(text, &value))
				{
					m_last_error = "Error in configuration: " + text + " should be a double";
					return true;
				}

				if(setDoubleProperty(name, value))
					return true;
			}
			else if(type == "bool")
			{
				bool value;
				if(text == "1")
					value = true;
				else if(text == "0")
					value = false;
				else
				{
					m_last_error = "Error in configuration: " + text + " should be boolean (0 or 1)";
					return true;
				}

				if(setBoolProperty(name, value))
					return true;
			}
			else
			{
				m_last_error = "Error in configuration: " + type + " is not a valid type";
				return true;
			}

			// Next node
			node = node->NextSibling();
		}
	}
	else
	{
		m_last_error = "File contains not the configuration of a fractal with ID " + m_id;
		return true;
	}

	resetDirty();

	return false;
}