Exemplo n.º 1
0
static PyObject*
nb_subtract (PyObject* o1, PyObject* o2) {
    float o1w = 0, o1h = 0, o1d = 0;
    float o2w = 0, o2h = 0, o2d = 0;
    PyObject *args, *result;
    PySoy_atoms_Size_Object *so1, *so2;

    //* parse object attributes
    if (!PySoy_atoms_Size_Check(o1) || !PySoy_atoms_Size_Check(o2)) {
        PyErr_SetString(PyExc_TypeError, "unsupported operand type(s)");
        return NULL;
    }

    so1 = (PySoy_atoms_Size_Object*)o1;
    o1w = soy_atoms_size_get_width(so1->g);
    o1h = soy_atoms_size_get_height(so1->g);
    o1d = soy_atoms_size_get_depth(so1->g);

    so2 = (PySoy_atoms_Size_Object*)o2;
    o2w = soy_atoms_size_get_width(so2->g);
    o2h = soy_atoms_size_get_height(so2->g);
    o2d = soy_atoms_size_get_depth(so2->g);

    // build args with calculated values
    args = Py_BuildValue("((fff))", o1w - o2w, o1h - o2h, o1d - o2d);

    // create result object
    result = tp_new(&PySoy_atoms_Size_Type, args, NULL);

    // decref args tuple and tmp
    Py_DECREF(args);

    // return calculated result
    return result;
}
Exemplo n.º 2
0
static PyObject*
nb_multiply (PyObject* o1, PyObject* o2) {
    float o1w = 0, o1h = 0, o1d = 0;
    float o2w = 0, o2h = 0, o2d = 0;
    PyObject *args, *result;
    PySoy_atoms_Size_Object *so1, *so2;

    // parse object 1
    if (PyLong_Check(o1)) {
        o1w = o1h = o1d = PyLong_AsDouble(o1);
    }
    else if (PyFloat_Check(o1)) {
        o1w = o1h = o1d = PyFloat_AsDouble(o1);
    }
    else if (PySoy_atoms_Size_Check(o1)) {
        so1 = (PySoy_atoms_Size_Object*)o1;
        o1w = soy_atoms_size_get_width(so1->g);
        o1h = soy_atoms_size_get_height(so1->g);
        o1d = soy_atoms_size_get_depth(so1->g);
    }
    else {
        PyErr_SetString(PyExc_TypeError, "unsupported operand type(s)");
        return NULL;
    }

    // parse object 2
    if (PyLong_Check(o2)) {
        o2w = o2h = o2d = PyLong_AsDouble(o2);
    }
    else if (PyFloat_Check(o2)) {
        o2w = o2h = o2d = PyFloat_AsDouble(o2);
    }
    else if (PySoy_atoms_Size_Check(o2)) {
        so2 = (PySoy_atoms_Size_Object*)o2;
        o2w = soy_atoms_size_get_width(so2->g);
        o2h = soy_atoms_size_get_height(so2->g);
        o2d = soy_atoms_size_get_depth(so2->g);
    } else {
        PyErr_SetString(PyExc_TypeError, "unsupported operand type(s)");
        return NULL;
    }

    // build args with calculated values
    args = Py_BuildValue("((fff))", o1w * o2w, o1h * o2h, o1d * o2d);

    // create result object
    result = tp_new(&PySoy_atoms_Size_Type, args, NULL);

    // decref args tuple and tmp
    Py_DECREF(args);

    // return calculated result
    return result;
}
Exemplo n.º 3
0
//Set a specific give soyatomsColor at a given index in the texture
static int
sq_ass_item(SELF self, Py_ssize_t index, PyObject* value) {
    soyatomsSize* size;

    // Ensure value is a Vector
    if (!PySoy_atoms_Vector_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "value must be soy.atoms.Vector");
        return -1;
    }

    // Ensure index is in range
    size = soy_textures_texture_get_size(((PySoy_textures_Texture_Object*) self)->g);
    if (index < 0 || index >=
        soy_atoms_size_get_width(size)*soy_atoms_size_get_height(size)) {
        g_object_unref(size);
        PyErr_SetString(PyExc_IndexError, "Bumpmap index out of range");
        return -1;
    }
    g_object_unref(size);

    // Set texel using backend set function
    soy_textures_bumpmap_set(self->g, index,
                             (GObject*)((PySoy_atoms_Vector_Object*) value)->g);
    return 0;
}
Exemplo n.º 4
0
static Py_ssize_t
sq_length(SELF self) {
    soyatomsSize* size;
    float width, height;

    size = soy_textures_texture_get_size(((PySoy_textures_Texture_Object*) self)->g);
    width = soy_atoms_size_get_width(size);
    height = soy_atoms_size_get_height(size);
    g_object_unref(size);

    return (Py_ssize_t) (width * height);
}
Exemplo n.º 5
0
static void _soy_bodies_billboard_size_set (soybodiesBillboard* self, soyatomsSize* size) {
	soyatomsSize* _tmp0_;
	gfloat _tmp1_;
	gfloat _tmp2_;
	soyatomsSize* _tmp3_;
	gfloat _tmp4_;
	gfloat _tmp5_;
	soyatomsSize* _tmp6_;
	gfloat _tmp7_;
	gfloat _tmp8_;
	gdouble _tmp9_ = 0.0;
	soyatomsSize* _tmp10_;
	gfloat _tmp11_;
	gfloat _tmp12_;
	gdouble _tmp13_ = 0.0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (size != NULL);
	g_mutex_lock (&((soybodiesBody*) self)->mutex);
	_tmp0_ = size;
	_tmp1_ = soy_atoms_size_get_width (_tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->_width = (GLfloat) _tmp2_;
	_tmp3_ = size;
	_tmp4_ = soy_atoms_size_get_height (_tmp3_);
	_tmp5_ = _tmp4_;
	self->priv->_height = (GLfloat) _tmp5_;
	_tmp6_ = size;
	_tmp7_ = soy_atoms_size_get_width (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = ceil ((gdouble) (_tmp8_ / 2));
	self->priv->_xsubdivisions = (gint) _tmp9_;
	_tmp10_ = size;
	_tmp11_ = soy_atoms_size_get_height (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = ceil ((gdouble) (_tmp12_ / 2));
	self->priv->_ysubdivisions = (gint) _tmp13_;
	self->priv->_updated = TRUE;
	g_mutex_unlock (&((soybodiesBody*) self)->mutex);
}
Exemplo n.º 6
0
static int
nb_bool (SELF self) {
    soyatomsSize* size = soy_widgets_widget_get_size((soywidgetsWidget*)
                                                     self->g);
    int ret;

    // Window is open when width > 0
    ret = soy_atoms_size_get_width(size);

    // Decref size before returning
    g_object_unref(size);
    return ret;
}
Exemplo n.º 7
0
Arquivo: Box.c Projeto: RONNCC/pysoy
static void _soy_bodies_box_size_set (soybodiesBox* self, soyatomsSize* size) {
	soyatomsSize* _tmp0_;
	gfloat _tmp1_;
	gfloat _tmp2_;
	soyatomsSize* _tmp3_;
	gfloat _tmp4_;
	gfloat _tmp5_;
	soyatomsSize* _tmp6_;
	gfloat _tmp7_;
	gfloat _tmp8_;
	soyscenesScene* _tmp9_;
	struct dxGeom* _tmp11_;
	GLfloat _tmp12_;
	GLfloat _tmp13_;
	GLfloat _tmp14_;
	soyscenesScene* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (size != NULL);
	g_mutex_lock (&((soybodiesBody*) self)->mutex);
	_tmp0_ = size;
	_tmp1_ = soy_atoms_size_get_width (_tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->_width = (GLfloat) _tmp2_;
	_tmp3_ = size;
	_tmp4_ = soy_atoms_size_get_height (_tmp3_);
	_tmp5_ = _tmp4_;
	self->priv->_height = (GLfloat) _tmp5_;
	_tmp6_ = size;
	_tmp7_ = soy_atoms_size_get_depth (_tmp6_);
	_tmp8_ = _tmp7_;
	self->priv->_depth = (GLfloat) _tmp8_;
	self->priv->_updated = TRUE;
	g_mutex_unlock (&((soybodiesBody*) self)->mutex);
	_tmp9_ = ((soybodiesBody*) self)->scene;
	if (_tmp9_ != NULL) {
		soyscenesScene* _tmp10_;
		_tmp10_ = ((soybodiesBody*) self)->scene;
		g_rw_lock_writer_lock (&_tmp10_->stepLock);
	}
	_tmp11_ = ((soybodiesBody*) self)->geom;
	_tmp12_ = self->priv->_width;
	_tmp13_ = self->priv->_height;
	_tmp14_ = self->priv->_depth;
	dGeomBoxSetLengths ((struct dxGeom*) _tmp11_, (dReal) _tmp12_, (dReal) _tmp13_, (dReal) _tmp14_);
	_tmp15_ = ((soybodiesBody*) self)->scene;
	if (_tmp15_ != NULL) {
		soyscenesScene* _tmp16_;
		_tmp16_ = ((soybodiesBody*) self)->scene;
		g_rw_lock_writer_unlock (&_tmp16_->stepLock);
	}
}
Exemplo n.º 8
0
static PyObject*
tp_repr (SELF self) {
    char* str;
    PyObject* ret;

    // We can't use PyUnicode_FromFormat because it doesn't support floats
    str = g_strdup_printf("<Size (%f, %f, %f)>",
                          soy_atoms_size_get_width(self->g),
                          soy_atoms_size_get_height(self->g),
                          soy_atoms_size_get_depth(self->g));
    ret = PyUnicode_FromString(str);

    // Free str and return
    g_free(str);
    return ret;
}
Exemplo n.º 9
0
soywidgetsHScroll* soy_widgets_hscroll_construct (GType object_type, soywidgetsContainer* parent) {
	soywidgetsHScroll * self = NULL;
	soywidgetsContainer* _tmp0_;
	soyatomsSize* _tmp1_;
	soyatomsSize* _tmp2_;
	soyatomsSize* _tmp3_;
	gfloat _tmp4_;
	gfloat _tmp5_;
	soyatomsSize* _tmp6_;
	soyatomsSize* _tmp7_;
	soyatomsSize* _tmp8_;
	gfloat _tmp9_;
	gfloat _tmp10_;
	soyatomsSize* _tmp11_;
	soyatomsPosition* _tmp12_;
	soyatomsPosition* _tmp13_;
	_tmp0_ = parent;
	self = (soywidgetsHScroll*) soy_widgets_scroller_construct (object_type, _tmp0_);
	_tmp1_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = soy_atoms_size_get_width (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp9_ = soy_atoms_size_get_height (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = soy_atoms_size_new (_tmp5_, _tmp10_, 0.0f);
	_g_object_unref0 (self->priv->_viewPort);
	self->priv->_viewPort = _tmp11_;
	_g_object_unref0 (_tmp8_);
	_g_object_unref0 (_tmp3_);
	self->priv->_hasBar = FALSE;
	_tmp12_ = soy_atoms_position_new (0.0f, 0.0f, 0.0f);
	_g_object_unref0 (self->priv->_testpos);
	self->priv->_testpos = _tmp12_;
	_tmp13_ = soy_atoms_position_new (0.0f, 0.0f, 0.0f);
	_g_object_unref0 (((soywidgetsScroller*) self)->scrollPosition);
	((soywidgetsScroller*) self)->scrollPosition = _tmp13_;
	return self;
}
Exemplo n.º 10
0
static void soy_widgets_vscroll_real_resize_children (soywidgetsContainer* base, gint x, gint y, gint width, gint height) {
	soywidgetsVScroll * self;
	gfloat _tmp39_;
	soyatomsSize* _tmp40_;
	soyatomsSize* _tmp41_;
	soyatomsSize* _tmp42_;
	gfloat _tmp43_;
	gfloat _tmp44_;
	gboolean _tmp45_;
	gfloat viewPortHeight;
	gboolean _tmp81_;
	gfloat viewPortWidth;
	gboolean _tmp88_;
	soyatomsSize* _tmp100_;
	gfloat _tmp101_;
	soyatomsSize* _tmp102_;
	gfloat _tmp103_;
	soyatomsSize* _tmp104_;
	soyatomsSize* _tmp105_;
	soyatomsSize* _tmp106_;
	gfloat _tmp107_;
	gfloat _tmp108_;
	gfloat _tmp109_;
	gboolean _tmp110_;
	soyatomsPosition* _tmp122_;
	soyatomsSize* _tmp123_;
	gfloat _tmp124_;
	gfloat _tmp125_;
	soyatomsPosition* _tmp126_;
	soyatomsSize* _tmp127_;
	gfloat _tmp128_;
	gfloat _tmp129_;
	gfloat _tmp130_;
	gint _tmp131_;
	gfloat _tmp132_;
	soyatomsSize* _tmp133_;
	self = (soywidgetsVScroll*) base;
	self->priv->_totalHeight = 0.0f;
	{
		GeeLinkedList* _tmp0_;
		GeeLinkedList* _tmp1_;
		GeeLinkedList* _widget_list;
		GeeLinkedList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _widget_size;
		gint _widget_index;
		_tmp0_ = ((soywidgetsContainer*) self)->children;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_widget_list = _tmp1_;
		_tmp2_ = _widget_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_widget_size = _tmp4_;
		_widget_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			GeeLinkedList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_ = NULL;
			soywidgetsWidget* widget;
			gfloat _tmp11_;
			soywidgetsWidget* _tmp12_;
			soyatomsSize* _tmp13_;
			soyatomsSize* _tmp14_;
			soyatomsSize* _tmp15_;
			gfloat _tmp16_;
			gfloat _tmp17_;
			soywidgetsWidget* _tmp18_;
			soyatomsSize* _tmp19_;
			soyatomsSize* _tmp20_;
			soyatomsSize* _tmp21_;
			gfloat _tmp22_;
			gfloat _tmp23_;
			soyatomsSize* _tmp24_;
			soyatomsSize* _tmp25_;
			soyatomsSize* _tmp26_;
			gfloat _tmp27_;
			gfloat _tmp28_;
			gboolean _tmp29_;
			_tmp5_ = _widget_index;
			_widget_index = _tmp5_ + 1;
			_tmp6_ = _widget_index;
			_tmp7_ = _widget_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _widget_list;
			_tmp9_ = _widget_index;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
			widget = (soywidgetsWidget*) _tmp10_;
			_tmp11_ = self->priv->_totalHeight;
			_tmp12_ = widget;
			_tmp13_ = soy_widgets_widget_get_size (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = _tmp14_;
			_tmp16_ = soy_atoms_size_get_height (_tmp15_);
			_tmp17_ = _tmp16_;
			self->priv->_totalHeight = _tmp11_ + _tmp17_;
			_g_object_unref0 (_tmp15_);
			_tmp18_ = widget;
			_tmp19_ = soy_widgets_widget_get_size (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = _tmp20_;
			_tmp22_ = soy_atoms_size_get_width (_tmp21_);
			_tmp23_ = _tmp22_;
			_tmp24_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
			_tmp25_ = _tmp24_;
			_tmp26_ = _tmp25_;
			_tmp27_ = soy_atoms_size_get_width (_tmp26_);
			_tmp28_ = _tmp27_;
			_tmp29_ = _tmp23_ > _tmp28_;
			_g_object_unref0 (_tmp26_);
			_g_object_unref0 (_tmp21_);
			if (_tmp29_) {
				soywidgetsWidget* _tmp30_;
				soyatomsSize* _tmp31_;
				soyatomsSize* _tmp32_;
				soyatomsSize* _tmp33_;
				soyatomsSize* _tmp34_;
				soyatomsSize* _tmp35_;
				soyatomsSize* _tmp36_;
				gfloat _tmp37_;
				gfloat _tmp38_;
				_tmp30_ = widget;
				_tmp31_ = soy_widgets_widget_get_size (_tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = _tmp32_;
				_tmp34_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
				_tmp35_ = _tmp34_;
				_tmp36_ = _tmp35_;
				_tmp37_ = soy_atoms_size_get_width (_tmp36_);
				_tmp38_ = _tmp37_;
				soy_atoms_size_set_width (_tmp33_, _tmp38_);
				_g_object_unref0 (_tmp36_);
				_g_object_unref0 (_tmp33_);
			}
			_g_object_unref0 (widget);
		}
		_g_object_unref0 (_widget_list);
	}
	_tmp39_ = self->priv->_totalHeight;
	_tmp40_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
	_tmp41_ = _tmp40_;
	_tmp42_ = _tmp41_;
	_tmp43_ = soy_atoms_size_get_height (_tmp42_);
	_tmp44_ = _tmp43_;
	_tmp45_ = _tmp39_ > _tmp44_;
	_g_object_unref0 (_tmp42_);
	if (_tmp45_) {
		self->priv->_hasBar = TRUE;
		{
			GeeLinkedList* _tmp46_;
			GeeLinkedList* _tmp47_;
			GeeLinkedList* _widget_list;
			GeeLinkedList* _tmp48_;
			gint _tmp49_;
			gint _tmp50_;
			gint _widget_size;
			gint _widget_index;
			_tmp46_ = ((soywidgetsContainer*) self)->children;
			_tmp47_ = _g_object_ref0 (_tmp46_);
			_widget_list = _tmp47_;
			_tmp48_ = _widget_list;
			_tmp49_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp48_);
			_tmp50_ = _tmp49_;
			_widget_size = _tmp50_;
			_widget_index = -1;
			while (TRUE) {
				gint _tmp51_;
				gint _tmp52_;
				gint _tmp53_;
				GeeLinkedList* _tmp54_;
				gint _tmp55_;
				gpointer _tmp56_ = NULL;
				soywidgetsWidget* widget;
				soywidgetsWidget* _tmp57_;
				soyatomsSize* _tmp58_;
				soyatomsSize* _tmp59_;
				soyatomsSize* _tmp60_;
				gfloat _tmp61_;
				gfloat _tmp62_;
				soyatomsSize* _tmp63_;
				soyatomsSize* _tmp64_;
				soyatomsSize* _tmp65_;
				gfloat _tmp66_;
				gfloat _tmp67_;
				gint _tmp68_;
				gboolean _tmp69_;
				_tmp51_ = _widget_index;
				_widget_index = _tmp51_ + 1;
				_tmp52_ = _widget_index;
				_tmp53_ = _widget_size;
				if (!(_tmp52_ < _tmp53_)) {
					break;
				}
				_tmp54_ = _widget_list;
				_tmp55_ = _widget_index;
				_tmp56_ = gee_abstract_list_get ((GeeAbstractList*) _tmp54_, _tmp55_);
				widget = (soywidgetsWidget*) _tmp56_;
				_tmp57_ = widget;
				_tmp58_ = soy_widgets_widget_get_size (_tmp57_);
				_tmp59_ = _tmp58_;
				_tmp60_ = _tmp59_;
				_tmp61_ = soy_atoms_size_get_width (_tmp60_);
				_tmp62_ = _tmp61_;
				_tmp63_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
				_tmp64_ = _tmp63_;
				_tmp65_ = _tmp64_;
				_tmp66_ = soy_atoms_size_get_width (_tmp65_);
				_tmp67_ = _tmp66_;
				_tmp68_ = ((soywidgetsScroller*) self)->scrollbarThickness;
				_tmp69_ = _tmp62_ >= (_tmp67_ - _tmp68_);
				_g_object_unref0 (_tmp65_);
				_g_object_unref0 (_tmp60_);
				if (_tmp69_) {
					soywidgetsWidget* _tmp70_;
					soyatomsSize* _tmp71_;
					soyatomsSize* _tmp72_;
					soyatomsSize* _tmp73_;
					soywidgetsWidget* _tmp74_;
					soyatomsSize* _tmp75_;
					soyatomsSize* _tmp76_;
					soyatomsSize* _tmp77_;
					gfloat _tmp78_;
					gfloat _tmp79_;
					gint _tmp80_;
					_tmp70_ = widget;
					_tmp71_ = soy_widgets_widget_get_size (_tmp70_);
					_tmp72_ = _tmp71_;
					_tmp73_ = _tmp72_;
					_tmp74_ = widget;
					_tmp75_ = soy_widgets_widget_get_size (_tmp74_);
					_tmp76_ = _tmp75_;
					_tmp77_ = _tmp76_;
					_tmp78_ = soy_atoms_size_get_width (_tmp77_);
					_tmp79_ = _tmp78_;
					_tmp80_ = ((soywidgetsScroller*) self)->scrollbarThickness;
					soy_atoms_size_set_width (_tmp77_, _tmp79_ - _tmp80_);
					_g_object_unref0 (_tmp77_);
					_g_object_unref0 (_tmp73_);
				}
				_g_object_unref0 (widget);
			}
			_g_object_unref0 (_widget_list);
		}
	}
	viewPortHeight = 0.0f;
	_tmp81_ = self->priv->_hasBar;
	if (_tmp81_) {
		soyatomsSize* _tmp82_;
		soyatomsSize* _tmp83_;
		soyatomsSize* _tmp84_;
		gfloat _tmp85_;
		gfloat _tmp86_;
		_tmp82_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
		_tmp83_ = _tmp82_;
		_tmp84_ = _tmp83_;
		_tmp85_ = soy_atoms_size_get_height (_tmp84_);
		_tmp86_ = _tmp85_;
		viewPortHeight = _tmp86_;
		_g_object_unref0 (_tmp84_);
	} else {
		gfloat _tmp87_;
		_tmp87_ = self->priv->_totalHeight;
		viewPortHeight = _tmp87_;
	}
	viewPortWidth = 0.0f;
	_tmp88_ = self->priv->_hasBar;
	if (_tmp88_) {
		soyatomsSize* _tmp89_;
		soyatomsSize* _tmp90_;
		soyatomsSize* _tmp91_;
		gfloat _tmp92_;
		gfloat _tmp93_;
		gint _tmp94_;
		_tmp89_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
		_tmp90_ = _tmp89_;
		_tmp91_ = _tmp90_;
		_tmp92_ = soy_atoms_size_get_width (_tmp91_);
		_tmp93_ = _tmp92_;
		_tmp94_ = ((soywidgetsScroller*) self)->scrollbarThickness;
		viewPortWidth = _tmp93_ - _tmp94_;
		_g_object_unref0 (_tmp91_);
	} else {
		soyatomsSize* _tmp95_;
		soyatomsSize* _tmp96_;
		soyatomsSize* _tmp97_;
		gfloat _tmp98_;
		gfloat _tmp99_;
		_tmp95_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
		_tmp96_ = _tmp95_;
		_tmp97_ = _tmp96_;
		_tmp98_ = soy_atoms_size_get_width (_tmp97_);
		_tmp99_ = _tmp98_;
		viewPortWidth = _tmp99_;
		_g_object_unref0 (_tmp97_);
	}
	_tmp100_ = self->priv->_viewPort;
	_tmp101_ = viewPortWidth;
	soy_atoms_size_set_width (_tmp100_, _tmp101_);
	_tmp102_ = self->priv->_viewPort;
	_tmp103_ = viewPortHeight;
	soy_atoms_size_set_height (_tmp102_, _tmp103_);
	_tmp104_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
	_tmp105_ = _tmp104_;
	_tmp106_ = _tmp105_;
	_tmp107_ = soy_atoms_size_get_height (_tmp106_);
	_tmp108_ = _tmp107_;
	_tmp109_ = self->priv->_totalHeight;
	_tmp110_ = _tmp108_ >= _tmp109_;
	_g_object_unref0 (_tmp106_);
	if (_tmp110_) {
		self->priv->_scrollHeight = (gfloat) 0;
	} else {
		soyatomsSize* _tmp111_;
		soyatomsSize* _tmp112_;
		soyatomsSize* _tmp113_;
		gfloat _tmp114_;
		gfloat _tmp115_;
		gfloat _tmp116_;
		soyatomsSize* _tmp117_;
		soyatomsSize* _tmp118_;
		soyatomsSize* _tmp119_;
		gfloat _tmp120_;
		gfloat _tmp121_;
		_tmp111_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
		_tmp112_ = _tmp111_;
		_tmp113_ = _tmp112_;
		_tmp114_ = soy_atoms_size_get_height (_tmp113_);
		_tmp115_ = _tmp114_;
		_tmp116_ = self->priv->_totalHeight;
		_tmp117_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
		_tmp118_ = _tmp117_;
		_tmp119_ = _tmp118_;
		_tmp120_ = soy_atoms_size_get_height (_tmp119_);
		_tmp121_ = _tmp120_;
		self->priv->_scrollHeight = (_tmp115_ / _tmp116_) * _tmp121_;
		_g_object_unref0 (_tmp119_);
		_g_object_unref0 (_tmp113_);
	}
	_tmp122_ = ((soywidgetsScroller*) self)->scrollPosition;
	_tmp123_ = self->priv->_viewPort;
	_tmp124_ = soy_atoms_size_get_width (_tmp123_);
	_tmp125_ = _tmp124_;
	soy_atoms_position_set_x (_tmp122_, _tmp125_);
	_tmp126_ = ((soywidgetsScroller*) self)->scrollPosition;
	_tmp127_ = self->priv->_viewPort;
	_tmp128_ = soy_atoms_size_get_height (_tmp127_);
	_tmp129_ = _tmp128_;
	_tmp130_ = self->priv->_scrollHeight;
	soy_atoms_position_set_y (_tmp126_, _tmp129_ - _tmp130_);
	_tmp131_ = ((soywidgetsScroller*) self)->scrollbarThickness;
	_tmp132_ = self->priv->_scrollHeight;
	_tmp133_ = soy_atoms_size_new ((gfloat) _tmp131_, _tmp132_, 0.0f);
	_g_object_unref0 (((soywidgetsScroller*) self)->scrollbarSize);
	((soywidgetsScroller*) self)->scrollbarSize = _tmp133_;
}
Exemplo n.º 11
0
static void soy_widgets_vscroll_real_render (soywidgetsWidget* base, gint x, gint y, gint width, gint height) {
	soywidgetsVScroll * self;
	gint _tmp0_;
	gint _x;
	gint _tmp1_;
	gint _y;
	gboolean _tmp23_;
	GLfloat* _tmp24_ = NULL;
	GLushort* _tmp25_ = NULL;
	gboolean _tmp26_ = FALSE;
	GLuint _tmp27_;
	gboolean _tmp29_;
	gdouble _posy;
	soyatomsSize* _tmp38_;
	gfloat _tmp39_;
	gfloat _tmp40_;
	gdouble _tmp41_;
	gint _tmp42_;
	soyatomsSize* _tmp43_;
	soyatomsSize* _tmp44_;
	soyatomsSize* _tmp45_;
	gfloat _tmp46_;
	gfloat _tmp47_;
	gdouble viewPort2Height;
	soyatomsSize* _tmp48_;
	soyatomsSize* _tmp49_;
	soyatomsSize* _tmp50_;
	gfloat _tmp51_;
	gfloat _tmp52_;
	gfloat _tmp53_;
	gboolean _tmp54_;
	soyatomsSize* _tmp66_;
	gfloat _tmp67_;
	gfloat _tmp68_;
	soyatomsPosition* _tmp69_;
	gfloat _tmp70_;
	gfloat _tmp71_;
	gint _tmp72_;
	gdouble _tmp73_;
	self = (soywidgetsVScroll*) base;
	_tmp0_ = x;
	_x = _tmp0_;
	_tmp1_ = y;
	_y = _tmp1_;
	{
		GeeLinkedList* _tmp2_;
		GeeLinkedList* _tmp3_;
		GeeLinkedList* _widget_list;
		GeeLinkedList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _widget_size;
		gint _widget_index;
		_tmp2_ = ((soywidgetsContainer*) self)->children;
		_tmp3_ = _g_object_ref0 (_tmp2_);
		_widget_list = _tmp3_;
		_tmp4_ = _widget_list;
		_tmp5_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_widget_size = _tmp6_;
		_widget_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			gint _tmp9_;
			GeeLinkedList* _tmp10_;
			gint _tmp11_;
			gpointer _tmp12_ = NULL;
			soywidgetsWidget* widget;
			soywidgetsWidget* _tmp13_;
			gint _tmp14_;
			gint _tmp15_;
			soywidgetsWidget* _tmp16_;
			gint _tmp17_;
			soywidgetsWidget* _tmp18_;
			gint _tmp19_;
			gint _tmp20_;
			soywidgetsWidget* _tmp21_;
			gint _tmp22_;
			_tmp7_ = _widget_index;
			_widget_index = _tmp7_ + 1;
			_tmp8_ = _widget_index;
			_tmp9_ = _widget_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _widget_list;
			_tmp11_ = _widget_index;
			_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _tmp11_);
			widget = (soywidgetsWidget*) _tmp12_;
			_tmp13_ = widget;
			_tmp14_ = _x;
			_tmp15_ = _y;
			_tmp16_ = widget;
			_tmp17_ = _tmp16_->width;
			_tmp18_ = widget;
			_tmp19_ = _tmp18_->height;
			soy_widgets_widget_render (_tmp13_, _tmp14_, _tmp15_, _tmp17_, _tmp19_);
			_tmp20_ = _y;
			_tmp21_ = widget;
			_tmp22_ = _tmp21_->height;
			_y = _tmp20_ + _tmp22_;
			_g_object_unref0 (widget);
		}
		_g_object_unref0 (_widget_list);
	}
	_tmp23_ = self->priv->_hasBar;
	if (!_tmp23_) {
		return;
	}
	_tmp24_ = g_new0 (GLfloat, 20);
	_tmp24_[0] = (GLfloat) 0.0f;
	_tmp24_[1] = (GLfloat) 0.0f;
	_tmp24_[2] = (GLfloat) 0.0f;
	_tmp24_[3] = (GLfloat) 0.0f;
	_tmp24_[4] = (GLfloat) 0.0f;
	_tmp24_[5] = (GLfloat) 1.0f;
	_tmp24_[6] = (GLfloat) 0.0f;
	_tmp24_[7] = (GLfloat) 0.0f;
	_tmp24_[8] = (GLfloat) 1.0f;
	_tmp24_[9] = (GLfloat) 0.0f;
	_tmp24_[10] = (GLfloat) 1.0f;
	_tmp24_[11] = (GLfloat) 1.0f;
	_tmp24_[12] = (GLfloat) 0.0f;
	_tmp24_[13] = (GLfloat) 1.0f;
	_tmp24_[14] = (GLfloat) 1.0f;
	_tmp24_[15] = (GLfloat) 0.0f;
	_tmp24_[16] = (GLfloat) 1.0f;
	_tmp24_[17] = (GLfloat) 0.0f;
	_tmp24_[18] = (GLfloat) 0.0f;
	_tmp24_[19] = (GLfloat) 1.0f;
	soy_widgets_vscroll__verts = (g_free (soy_widgets_vscroll__verts), NULL);
	soy_widgets_vscroll__verts = _tmp24_;
	soy_widgets_vscroll__verts_length1 = 20;
	_soy_widgets_vscroll__verts_size_ = soy_widgets_vscroll__verts_length1;
	_tmp25_ = g_new0 (GLushort, 6);
	_tmp25_[0] = (GLushort) 0;
	_tmp25_[1] = (GLushort) 1;
	_tmp25_[2] = (GLushort) 2;
	_tmp25_[3] = (GLushort) 2;
	_tmp25_[4] = (GLushort) 3;
	_tmp25_[5] = (GLushort) 0;
	soy_widgets_vscroll__faces = (g_free (soy_widgets_vscroll__faces), NULL);
	soy_widgets_vscroll__faces = _tmp25_;
	soy_widgets_vscroll__faces_length1 = 6;
	_soy_widgets_vscroll__faces_size_ = soy_widgets_vscroll__faces_length1;
	_tmp27_ = self->priv->_vbuffer;
	if (_tmp27_ == ((GLuint) 0)) {
		_tmp26_ = TRUE;
	} else {
		GLuint _tmp28_;
		_tmp28_ = self->priv->_ibuffer;
		_tmp26_ = _tmp28_ == ((GLuint) 0);
	}
	_tmp29_ = _tmp26_;
	if (_tmp29_) {
		GLuint _tmp30_ = 0U;
		GLuint _tmp31_;
		GLfloat* _tmp32_;
		gint _tmp32__length1;
		GLuint _tmp33_ = 0U;
		GLuint _tmp34_;
		GLushort* _tmp35_;
		gint _tmp35__length1;
		glGenBuffers ((GLsizei) 1, &_tmp30_);
		self->priv->_vbuffer = _tmp30_;
		_tmp31_ = self->priv->_vbuffer;
		glBindBuffer (GL_ARRAY_BUFFER, _tmp31_);
		_tmp32_ = soy_widgets_vscroll__verts;
		_tmp32__length1 = soy_widgets_vscroll__verts_length1;
		glBufferData (GL_ARRAY_BUFFER, ((GLsizei) sizeof (GLfloat)) * 20, _tmp32_, GL_STATIC_DRAW);
		glGenBuffers ((GLsizei) 1, &_tmp33_);
		self->priv->_ibuffer = _tmp33_;
		_tmp34_ = self->priv->_ibuffer;
		glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, _tmp34_);
		_tmp35_ = soy_widgets_vscroll__faces;
		_tmp35__length1 = soy_widgets_vscroll__faces_length1;
		glBufferData (GL_ELEMENT_ARRAY_BUFFER, ((GLsizei) sizeof (GLushort)) * 6, _tmp35_, GL_STATIC_DRAW);
	} else {
		GLuint _tmp36_;
		GLuint _tmp37_;
		_tmp36_ = self->priv->_vbuffer;
		glBindBuffer (GL_ARRAY_BUFFER, _tmp36_);
		_tmp37_ = self->priv->_ibuffer;
		glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, _tmp37_);
	}
	_posy = 0.0;
	_tmp38_ = self->priv->_viewPort;
	_tmp39_ = soy_atoms_size_get_width (_tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = _posy;
	_tmp42_ = ((soywidgetsScroller*) self)->scrollbarThickness;
	_tmp43_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
	_tmp44_ = _tmp43_;
	_tmp45_ = _tmp44_;
	_tmp46_ = soy_atoms_size_get_height (_tmp45_);
	_tmp47_ = _tmp46_;
	glViewport ((GLint) _tmp40_, (GLint) _tmp41_, (GLsizei) ((GLint) _tmp42_), (GLsizei) ((GLint) _tmp47_));
	_g_object_unref0 (_tmp45_);
	glMatrixMode (GL_PROJECTION);
	glLoadIdentity ();
	glOrthof ((GLfloat) 0.0f, (GLfloat) 1.0f, (GLfloat) 1.0f, (GLfloat) 0.0f, (GLfloat) (-1.0f), (GLfloat) 1.0f);
	glMatrixMode (GL_MODELVIEW);
	glLoadIdentity ();
	glDisableClientState (GL_NORMAL_ARRAY);
	glVertexPointer ((GLint) 3, GL_FLOAT, (GLsizei) 20, (void*) 0);
	glDrawElements (GL_TRIANGLES, (GLsizei) 6, GL_UNSIGNED_SHORT, (void*) 0);
	glColor4f ((GLfloat) 0, (GLfloat) 1, (GLfloat) 0, (GLfloat) 1);
	viewPort2Height = 0.0;
	_tmp48_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
	_tmp49_ = _tmp48_;
	_tmp50_ = _tmp49_;
	_tmp51_ = soy_atoms_size_get_height (_tmp50_);
	_tmp52_ = _tmp51_;
	_tmp53_ = self->priv->_totalHeight;
	_tmp54_ = _tmp52_ < _tmp53_;
	_g_object_unref0 (_tmp50_);
	if (_tmp54_) {
		soyatomsSize* _tmp55_;
		soyatomsSize* _tmp56_;
		soyatomsSize* _tmp57_;
		gfloat _tmp58_;
		gfloat _tmp59_;
		gfloat _tmp60_;
		soyatomsSize* _tmp61_;
		soyatomsSize* _tmp62_;
		soyatomsSize* _tmp63_;
		gfloat _tmp64_;
		gfloat _tmp65_;
		_tmp55_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
		_tmp56_ = _tmp55_;
		_tmp57_ = _tmp56_;
		_tmp58_ = soy_atoms_size_get_height (_tmp57_);
		_tmp59_ = _tmp58_;
		_tmp60_ = self->priv->_totalHeight;
		_tmp61_ = soy_widgets_widget_get_size ((soywidgetsWidget*) self);
		_tmp62_ = _tmp61_;
		_tmp63_ = _tmp62_;
		_tmp64_ = soy_atoms_size_get_height (_tmp63_);
		_tmp65_ = _tmp64_;
		viewPort2Height = (gdouble) ((_tmp59_ / _tmp60_) * _tmp65_);
		_g_object_unref0 (_tmp63_);
		_g_object_unref0 (_tmp57_);
	}
	_tmp66_ = self->priv->_viewPort;
	_tmp67_ = soy_atoms_size_get_width (_tmp66_);
	_tmp68_ = _tmp67_;
	_tmp69_ = ((soywidgetsScroller*) self)->scrollPosition;
	_tmp70_ = soy_atoms_position_get_y (_tmp69_);
	_tmp71_ = _tmp70_;
	_tmp72_ = ((soywidgetsScroller*) self)->scrollbarThickness;
	_tmp73_ = viewPort2Height;
	glViewport ((GLint) _tmp68_, (GLint) _tmp71_, (GLsizei) ((GLint) _tmp72_), (GLsizei) ((GLint) _tmp73_));
	glDrawElements (GL_TRIANGLES, (GLsizei) 6, GL_UNSIGNED_SHORT, (void*) 0);
	glColor4f ((GLfloat) 1, (GLfloat) 1, (GLfloat) 1, (GLfloat) 1);
}
Exemplo n.º 12
0
static void soy_widgets_hscroll_real_scroll_handler (soywidgetsScroller* base, soyeventsScroll* e) {
	soywidgetsHScroll * self;
	soyeventsScroll _tmp0_;
	soyScrollDirection _tmp1_;
	self = (soywidgetsHScroll*) base;
	g_return_if_fail (e != NULL);
	_tmp0_ = *e;
	_tmp1_ = _tmp0_.direction;
	switch (_tmp1_) {
		case SOY_SCROLL_DIRECTION_Left:
		{
			{
				soyatomsPosition* _tmp2_;
				soyatomsPosition* _tmp3_;
				gfloat _tmp4_;
				gfloat _tmp5_;
				soyatomsPosition* _tmp6_;
				soyatomsPosition* _tmp7_;
				gfloat _tmp8_;
				gfloat _tmp9_;
				gfloat _tmp10_ = 0.0F;
				_tmp2_ = ((soywidgetsScroller*) self)->scrollPosition;
				_tmp3_ = ((soywidgetsScroller*) self)->scrollPosition;
				_tmp4_ = soy_atoms_position_get_x (_tmp3_);
				_tmp5_ = _tmp4_;
				soy_atoms_position_set_x (_tmp3_, _tmp5_ - 10);
				_tmp6_ = ((soywidgetsScroller*) self)->scrollPosition;
				_tmp7_ = ((soywidgetsScroller*) self)->scrollPosition;
				_tmp8_ = soy_atoms_position_get_x (_tmp7_);
				_tmp9_ = _tmp8_;
				_tmp10_ = MAX (_tmp9_, 0.0f);
				soy_atoms_position_set_x (_tmp6_, _tmp10_);
			}
			break;
		}
		case SOY_SCROLL_DIRECTION_Right:
		{
			{
				soyatomsPosition* _tmp11_;
				soyatomsPosition* _tmp12_;
				gfloat _tmp13_;
				gfloat _tmp14_;
				soyatomsPosition* _tmp15_;
				soyatomsPosition* _tmp16_;
				gfloat _tmp17_;
				gfloat _tmp18_;
				soyatomsSize* _tmp19_;
				gfloat _tmp20_;
				gfloat _tmp21_;
				gfloat _tmp22_;
				gfloat _tmp23_ = 0.0F;
				_tmp11_ = ((soywidgetsScroller*) self)->scrollPosition;
				_tmp12_ = ((soywidgetsScroller*) self)->scrollPosition;
				_tmp13_ = soy_atoms_position_get_x (_tmp12_);
				_tmp14_ = _tmp13_;
				soy_atoms_position_set_x (_tmp12_, _tmp14_ + 10);
				_tmp15_ = ((soywidgetsScroller*) self)->scrollPosition;
				_tmp16_ = ((soywidgetsScroller*) self)->scrollPosition;
				_tmp17_ = soy_atoms_position_get_x (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = self->priv->_viewPort;
				_tmp20_ = soy_atoms_size_get_width (_tmp19_);
				_tmp21_ = _tmp20_;
				_tmp22_ = self->priv->_scrollWidth;
				_tmp23_ = MIN (_tmp18_, _tmp21_ - _tmp22_);
				soy_atoms_position_set_x (_tmp15_, _tmp23_);
			}
			break;
		}
		default:
		break;
	}
}
Exemplo n.º 13
0
static void soy_widgets_hscroll_real_motion_handler (soywidgetsScroller* base, soyeventsMotion* e) {
	soywidgetsHScroll * self;
	soyatomsPosition* _tmp0_;
	soyeventsMotion _tmp1_;
	gfloat _tmp2_;
	soyatomsPosition* _tmp3_;
	soyeventsMotion _tmp4_;
	gfloat _tmp5_;
	soywidgetsContainer* _tmp6_;
	gint _tmp7_;
	gboolean _tmp8_;
	self = (soywidgetsHScroll*) base;
	g_return_if_fail (e != NULL);
	_tmp0_ = self->priv->_testpos;
	_tmp1_ = *e;
	_tmp2_ = _tmp1_.x;
	soy_atoms_position_set_x (_tmp0_, (gfloat) _tmp2_);
	_tmp3_ = self->priv->_testpos;
	_tmp4_ = *e;
	_tmp5_ = _tmp4_.y;
	_tmp6_ = ((soywidgetsScroller*) self)->parent;
	_tmp7_ = ((soywidgetsWidget*) _tmp6_)->height;
	soy_atoms_position_set_y (_tmp3_, (gfloat) ((-_tmp5_) + _tmp7_));
	_tmp8_ = ((soywidgetsScroller*) self)->drag;
	if (_tmp8_) {
		soyeventsMotion _tmp9_;
		gfloat _tmp10_;
		soyeventsMotion _tmp11_;
		gfloat _tmp12_;
		soyeventsMotion _tmp13_;
		gfloat _tmp14_;
		gfloat _tmp15_;
		gfloat offset;
		soyatomsPosition* _tmp16_;
		gfloat _tmp17_;
		gfloat _tmp18_;
		soyatomsPosition* _tmp19_;
		soyatomsPosition* _tmp20_;
		gfloat _tmp21_;
		gfloat _tmp22_;
		gfloat _tmp23_ = 0.0F;
		soyatomsPosition* _tmp24_;
		soyatomsPosition* _tmp25_;
		gfloat _tmp26_;
		gfloat _tmp27_;
		soyatomsSize* _tmp28_;
		gfloat _tmp29_;
		gfloat _tmp30_;
		gfloat _tmp31_;
		gfloat _tmp32_ = 0.0F;
		_tmp9_ = *e;
		_tmp10_ = _tmp9_.x;
		_tmp11_ = *e;
		_tmp12_ = _tmp11_.y;
		g_print ("e.x: %f   e.y: %f\n", (gdouble) _tmp10_, (gdouble) _tmp12_);
		_tmp13_ = *e;
		_tmp14_ = _tmp13_.x;
		_tmp15_ = ((soywidgetsScroller*) self)->xstartdrag;
		offset = ((gfloat) _tmp14_) - _tmp15_;
		_tmp16_ = ((soywidgetsScroller*) self)->scrollPosition;
		_tmp17_ = ((soywidgetsScroller*) self)->xpos_startdrag;
		_tmp18_ = offset;
		soy_atoms_position_set_x (_tmp16_, _tmp17_ + _tmp18_);
		_tmp19_ = ((soywidgetsScroller*) self)->scrollPosition;
		_tmp20_ = ((soywidgetsScroller*) self)->scrollPosition;
		_tmp21_ = soy_atoms_position_get_x (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = MAX (_tmp22_, 0.0f);
		soy_atoms_position_set_x (_tmp19_, _tmp23_);
		_tmp24_ = ((soywidgetsScroller*) self)->scrollPosition;
		_tmp25_ = ((soywidgetsScroller*) self)->scrollPosition;
		_tmp26_ = soy_atoms_position_get_x (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = self->priv->_viewPort;
		_tmp29_ = soy_atoms_size_get_width (_tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = self->priv->_scrollWidth;
		_tmp32_ = MIN (_tmp27_, _tmp30_ - _tmp31_);
		soy_atoms_position_set_x (_tmp24_, _tmp32_);
	}
}
Exemplo n.º 14
0
soybodiesBillboard* soy_bodies_billboard_construct (GType object_type, soyatomsPosition* position, soyatomsSize* size, soymaterialsMaterial* material) {
	soybodiesBillboard * self = NULL;
	soyatomsPosition* _tmp0_;
	soyatomsSize* _tmp1_;
	soyatomsSize* _tmp2_;
	soymaterialsMaterial* _tmp18_;
	_tmp0_ = position;
	_tmp1_ = size;
	self = (soybodiesBillboard*) soy_bodies_body_construct (object_type, _tmp0_, (GObject*) _tmp1_, 0.0f);
	self->priv->_updated = TRUE;
	_tmp2_ = size;
	if (_tmp2_ == NULL) {
		self->priv->_width = (GLfloat) 1.0f;
		self->priv->_height = (GLfloat) 1.0f;
		self->priv->_xsubdivisions = 1;
		self->priv->_ysubdivisions = 1;
	} else {
		soyatomsSize* _tmp3_;
		gfloat _tmp4_;
		gfloat _tmp5_;
		soyatomsSize* _tmp6_;
		gfloat _tmp7_;
		gfloat _tmp8_;
		soyatomsSize* _tmp9_;
		gfloat _tmp10_;
		gfloat _tmp11_;
		gdouble _tmp12_ = 0.0;
		soyatomsSize* _tmp13_;
		gfloat _tmp14_;
		gfloat _tmp15_;
		gdouble _tmp16_ = 0.0;
		soyatomsSize* _tmp17_;
		_tmp3_ = size;
		_tmp4_ = soy_atoms_size_get_width (_tmp3_);
		_tmp5_ = _tmp4_;
		self->priv->_width = (GLfloat) _tmp5_;
		_tmp6_ = size;
		_tmp7_ = soy_atoms_size_get_height (_tmp6_);
		_tmp8_ = _tmp7_;
		self->priv->_height = (GLfloat) _tmp8_;
		_tmp9_ = size;
		_tmp10_ = soy_atoms_size_get_width (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = ceil ((gdouble) (_tmp11_ / 2));
		self->priv->_xsubdivisions = (gint) _tmp12_;
		_tmp13_ = size;
		_tmp14_ = soy_atoms_size_get_height (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = ceil ((gdouble) (_tmp15_ / 2));
		self->priv->_ysubdivisions = (gint) _tmp16_;
		_tmp17_ = size;
		self->priv->_size_obj = _tmp17_;
	}
	_tmp18_ = material;
	if (_tmp18_ == NULL) {
		soymaterialsMaterial* _tmp19_;
		soymaterialsMaterial* _tmp21_;
		soymaterialsMaterial* _tmp22_;
		_tmp19_ = soy_default_material;
		if (_tmp19_ == NULL) {
			soymaterialsMaterial* _tmp20_;
			_tmp20_ = soy_materials_material_new ();
			_g_object_unref0 (soy_default_material);
			soy_default_material = _tmp20_;
		}
		_tmp21_ = soy_default_material;
		_tmp22_ = _g_object_ref0 (_tmp21_);
		_g_object_unref0 (self->priv->_material);
		self->priv->_material = _tmp22_;
	} else {
		soymaterialsMaterial* _tmp23_;
		soymaterialsMaterial* _tmp24_;
		_tmp23_ = material;
		_tmp24_ = _g_object_ref0 (_tmp23_);
		_g_object_unref0 (self->priv->_material);
		self->priv->_material = _tmp24_;
	}
	return self;
}
Exemplo n.º 15
0
soyatomsVector* soy_textures_bumpmap_get (soytexturesBumpmap* self, gint index) {
	soyatomsVector* result = NULL;
	soyatomsVector* ret;
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gboolean _tmp13_;
	GeeHashMap* _tmp14_;
	gint _tmp15_;
	gboolean _tmp16_ = FALSE;
	soyatomsVector* _tmp34_;
	soyatomsVector* _tmp35_;
	GeeHashMap* _tmp36_;
	gint _tmp37_;
	soyatomsVector* _tmp38_;
	soyatomsVector* _tmp39_;
	g_return_val_if_fail (self != NULL, NULL);
	ret = NULL;
	_tmp1_ = index;
	if (_tmp1_ < 0) {
		_tmp0_ = TRUE;
	} else {
		gint _tmp2_;
		soyatomsSize* _tmp3_;
		soyatomsSize* _tmp4_;
		soyatomsSize* _tmp5_;
		gfloat _tmp6_;
		gfloat _tmp7_;
		soyatomsSize* _tmp8_;
		soyatomsSize* _tmp9_;
		soyatomsSize* _tmp10_;
		gfloat _tmp11_;
		gfloat _tmp12_;
		_tmp2_ = index;
		_tmp3_ = soy_textures_texture_get_size ((soytexturesTexture*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp6_ = soy_atoms_size_get_width (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = soy_textures_texture_get_size ((soytexturesTexture*) self);
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_;
		_tmp11_ = soy_atoms_size_get_height (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp0_ = ((gfloat) _tmp2_) >= (_tmp7_ * _tmp12_);
		_g_object_unref0 (_tmp10_);
		_g_object_unref0 (_tmp5_);
	}
	_tmp13_ = _tmp0_;
	if (_tmp13_) {
		result = NULL;
		_g_object_unref0 (ret);
		return result;
	}
	_tmp14_ = self->priv->_texel_objs;
	_tmp15_ = index;
	_tmp16_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp14_, (gpointer) ((gintptr) _tmp15_));
	if (_tmp16_) {
		GeeHashMap* _tmp17_;
		gint _tmp18_;
		gpointer _tmp19_ = NULL;
		soyatomsVector* _tmp20_;
		_tmp17_ = self->priv->_texel_objs;
		_tmp18_ = index;
		_tmp19_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp17_, (gpointer) ((gintptr) _tmp18_));
		_tmp20_ = _g_object_ref0 ((soyatomsVector*) _tmp19_);
		_g_object_unref0 (ret);
		ret = _tmp20_;
	} else {
		guchar* _tmp21_;
		gint _tmp22_;
		guchar _tmp23_;
		gfloat x;
		guchar* _tmp24_;
		gint _tmp25_;
		guchar _tmp26_;
		gfloat y;
		guchar* _tmp27_;
		gint _tmp28_;
		guchar _tmp29_;
		gfloat z;
		gfloat _tmp30_;
		gfloat _tmp31_;
		gfloat _tmp32_;
		soyatomsVector* _tmp33_;
		_tmp21_ = ((soytexturesTexture*) self)->texels;
		_tmp22_ = index;
		_tmp23_ = _tmp21_[_tmp22_ * 3];
		x = (_tmp23_ - 127) / 128.0f;
		_tmp24_ = ((soytexturesTexture*) self)->texels;
		_tmp25_ = index;
		_tmp26_ = _tmp24_[(_tmp25_ * 3) + 1];
		y = (_tmp26_ - 127) / 128.0f;
		_tmp27_ = ((soytexturesTexture*) self)->texels;
		_tmp28_ = index;
		_tmp29_ = _tmp27_[(_tmp28_ * 3) + 2];
		z = (_tmp29_ - 127) / 128.0f;
		_tmp30_ = x;
		_tmp31_ = y;
		_tmp32_ = z;
		_tmp33_ = soy_atoms_vector_new (_tmp30_, _tmp31_, _tmp32_);
		_g_object_unref0 (ret);
		ret = _tmp33_;
	}
	_tmp34_ = ret;
	g_signal_connect_object (_tmp34_, "on-set", (GCallback) __soy_textures_bumpmap_texel_set_soy_atoms_vector_on_set, self, 0);
	_tmp35_ = ret;
	g_object_weak_ref ((GObject*) _tmp35_, __soy_textures_bumpmap_texel_weak_gweak_notify, self);
	_tmp36_ = self->priv->_texel_objs;
	_tmp37_ = index;
	_tmp38_ = ret;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp36_, (gpointer) ((gintptr) _tmp37_), _tmp38_);
	_tmp39_ = ret;
	ret = NULL;
	result = _tmp39_;
	_g_object_unref0 (ret);
	return result;
}
Exemplo n.º 16
0
soytexturesBumpmap* soy_textures_bumpmap_construct_emboss (GType object_type, soytexturesTexture* texture) {
	soytexturesBumpmap * self = NULL;
	soytexturesTexture* _tmp0_;
	guchar* _tmp1_;
	guchar* tex;
	soytexturesTexture* _tmp2_;
	soyatomsSize* _tmp3_;
	soyatomsSize* _tmp4_;
	soyatomsSize* _tmp5_;
	gfloat _tmp6_;
	gfloat _tmp7_;
	gfloat _tmp8_;
	gfloat width;
	soytexturesTexture* _tmp9_;
	soyatomsSize* _tmp10_;
	soyatomsSize* _tmp11_;
	soyatomsSize* _tmp12_;
	gfloat _tmp13_;
	gfloat _tmp14_;
	gfloat _tmp15_;
	gfloat height;
	gfloat _tmp16_;
	gfloat _tmp17_;
	g_return_val_if_fail (texture != NULL, NULL);
	self = (soytexturesBumpmap*) soy_textures_texture_construct (object_type);
	_tmp0_ = texture;
	_tmp1_ = _tmp0_->texels;
	tex = _tmp1_;
	_tmp2_ = texture;
	_tmp3_ = soy_textures_texture_get_size (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp6_ = soy_atoms_size_get_width (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp5_);
	width = _tmp8_;
	_tmp9_ = texture;
	_tmp10_ = soy_textures_texture_get_size (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = _tmp11_;
	_tmp13_ = soy_atoms_size_get_height (_tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = _tmp14_;
	_g_object_unref0 (_tmp12_);
	height = _tmp15_;
	_tmp16_ = width;
	_tmp17_ = height;
	soy_textures_texture_resize ((soytexturesTexture*) self, 3, (gint) _tmp16_, (gint) _tmp17_);
	{
		gint i;
		i = 0;
		{
			gboolean _tmp18_;
			_tmp18_ = TRUE;
			while (TRUE) {
				gboolean _tmp19_;
				gfloat _tmp21_;
				_tmp19_ = _tmp18_;
				if (!_tmp19_) {
					gint _tmp20_;
					_tmp20_ = i;
					i = _tmp20_ + 1;
				}
				_tmp18_ = FALSE;
				_tmp21_ = height;
				if (!(i <= (_tmp21_ - 1))) {
					break;
				}
				{
					gint j;
					j = 0;
					{
						gboolean _tmp22_;
						_tmp22_ = TRUE;
						while (TRUE) {
							gboolean _tmp23_;
							gfloat _tmp25_;
							guchar* _tmp26_;
							gint _tmp27_;
							gdouble _tmp28_ = 0.0;
							gfloat _tmp29_;
							gint _tmp30_;
							gdouble _tmp31_ = 0.0;
							guchar _tmp32_;
							guchar ul;
							guchar* _tmp33_;
							gint _tmp34_;
							gdouble _tmp35_ = 0.0;
							gfloat _tmp36_;
							gint _tmp37_;
							guchar _tmp38_;
							guchar u;
							guchar* _tmp39_;
							gint _tmp40_;
							gdouble _tmp41_ = 0.0;
							gfloat _tmp42_;
							gfloat _tmp43_;
							gint _tmp44_;
							gdouble _tmp45_ = 0.0;
							guchar _tmp46_;
							guchar ur;
							guchar* _tmp47_;
							gint _tmp48_;
							gfloat _tmp49_;
							gint _tmp50_;
							gdouble _tmp51_ = 0.0;
							guchar _tmp52_;
							guchar l;
							guchar* _tmp53_;
							gint _tmp54_;
							gfloat _tmp55_;
							gfloat _tmp56_;
							gint _tmp57_;
							gdouble _tmp58_ = 0.0;
							guchar _tmp59_;
							guchar r;
							guchar* _tmp60_;
							gfloat _tmp61_;
							gint _tmp62_;
							gdouble _tmp63_ = 0.0;
							gfloat _tmp64_;
							gint _tmp65_;
							gdouble _tmp66_ = 0.0;
							guchar _tmp67_;
							guchar dl;
							guchar* _tmp68_;
							gfloat _tmp69_;
							gint _tmp70_;
							gdouble _tmp71_ = 0.0;
							gfloat _tmp72_;
							gint _tmp73_;
							guchar _tmp74_;
							guchar d;
							guchar* _tmp75_;
							gfloat _tmp76_;
							gint _tmp77_;
							gdouble _tmp78_ = 0.0;
							gfloat _tmp79_;
							gfloat _tmp80_;
							gint _tmp81_;
							gdouble _tmp82_ = 0.0;
							guchar _tmp83_;
							guchar dr;
							guchar _tmp84_;
							guchar _tmp85_;
							guchar _tmp86_;
							guchar _tmp87_;
							guchar _tmp88_;
							guchar _tmp89_;
							gint x;
							guchar _tmp90_;
							guchar _tmp91_;
							guchar _tmp92_;
							guchar _tmp93_;
							guchar _tmp94_;
							guchar _tmp95_;
							gint y;
							gfloat z;
							gint _tmp96_;
							gint _tmp97_;
							gint _tmp98_;
							gint _tmp99_;
							gfloat _tmp100_;
							gfloat _tmp101_;
							gfloat _tmp102_ = 0.0F;
							gfloat mag;
							guchar* _tmp103_;
							gint _tmp104_;
							gfloat _tmp105_;
							gint _tmp106_;
							gint _tmp107_;
							gfloat _tmp108_;
							guchar _tmp109_;
							guchar* _tmp110_;
							gint _tmp111_;
							gfloat _tmp112_;
							gint _tmp113_;
							gint _tmp114_;
							gfloat _tmp115_;
							guchar _tmp116_;
							guchar* _tmp117_;
							gint _tmp118_;
							gfloat _tmp119_;
							gint _tmp120_;
							gfloat _tmp121_;
							gfloat _tmp122_;
							guchar _tmp123_;
							_tmp23_ = _tmp22_;
							if (!_tmp23_) {
								gint _tmp24_;
								_tmp24_ = j;
								j = _tmp24_ + 1;
							}
							_tmp22_ = FALSE;
							_tmp25_ = width;
							if (!(j <= (_tmp25_ - 1))) {
								break;
							}
							_tmp26_ = tex;
							_tmp27_ = i;
							_tmp28_ = fmax ((gdouble) 0, (gdouble) (_tmp27_ - 1));
							_tmp29_ = width;
							_tmp30_ = j;
							_tmp31_ = fmax ((gdouble) 0, (gdouble) (_tmp30_ - 1));
							_tmp32_ = _tmp26_[(gint) ((_tmp28_ * _tmp29_) + _tmp31_)];
							ul = _tmp32_;
							_tmp33_ = tex;
							_tmp34_ = i;
							_tmp35_ = fmax ((gdouble) 0, (gdouble) (_tmp34_ - 1));
							_tmp36_ = width;
							_tmp37_ = j;
							_tmp38_ = _tmp33_[(gint) ((_tmp35_ * _tmp36_) + _tmp37_)];
							u = _tmp38_;
							_tmp39_ = tex;
							_tmp40_ = i;
							_tmp41_ = fmax ((gdouble) 0, (gdouble) (_tmp40_ - 1));
							_tmp42_ = width;
							_tmp43_ = width;
							_tmp44_ = j;
							_tmp45_ = fmin ((gdouble) (_tmp43_ - 1), (gdouble) (_tmp44_ + 1));
							_tmp46_ = _tmp39_[(gint) ((_tmp41_ * _tmp42_) + _tmp45_)];
							ur = _tmp46_;
							_tmp47_ = tex;
							_tmp48_ = i;
							_tmp49_ = width;
							_tmp50_ = j;
							_tmp51_ = fmax ((gdouble) 0, (gdouble) (_tmp50_ - 1));
							_tmp52_ = _tmp47_[(gint) ((_tmp48_ * _tmp49_) + _tmp51_)];
							l = _tmp52_;
							_tmp53_ = tex;
							_tmp54_ = i;
							_tmp55_ = width;
							_tmp56_ = width;
							_tmp57_ = j;
							_tmp58_ = fmin ((gdouble) (_tmp56_ - 1), (gdouble) (_tmp57_ + 1));
							_tmp59_ = _tmp53_[(gint) ((_tmp54_ * _tmp55_) + _tmp58_)];
							r = _tmp59_;
							_tmp60_ = tex;
							_tmp61_ = height;
							_tmp62_ = i;
							_tmp63_ = fmin ((gdouble) (_tmp61_ - 1), (gdouble) (_tmp62_ + 1));
							_tmp64_ = width;
							_tmp65_ = j;
							_tmp66_ = fmax ((gdouble) 0, (gdouble) (_tmp65_ - 1));
							_tmp67_ = _tmp60_[(gint) ((_tmp63_ * _tmp64_) + _tmp66_)];
							dl = _tmp67_;
							_tmp68_ = tex;
							_tmp69_ = height;
							_tmp70_ = i;
							_tmp71_ = fmin ((gdouble) (_tmp69_ - 1), (gdouble) (_tmp70_ + 1));
							_tmp72_ = width;
							_tmp73_ = j;
							_tmp74_ = _tmp68_[(gint) ((_tmp71_ * _tmp72_) + _tmp73_)];
							d = _tmp74_;
							_tmp75_ = tex;
							_tmp76_ = height;
							_tmp77_ = i;
							_tmp78_ = fmin ((gdouble) (_tmp76_ - 1), (gdouble) (_tmp77_ + 1));
							_tmp79_ = width;
							_tmp80_ = width;
							_tmp81_ = j;
							_tmp82_ = fmin ((gdouble) (_tmp80_ - 1), (gdouble) (_tmp81_ + 1));
							_tmp83_ = _tmp75_[(gint) ((_tmp78_ * _tmp79_) + _tmp82_)];
							dr = _tmp83_;
							_tmp84_ = ul;
							_tmp85_ = ur;
							_tmp86_ = l;
							_tmp87_ = r;
							_tmp88_ = dl;
							_tmp89_ = dr;
							x = ((((_tmp84_ - _tmp85_) + (2 * _tmp86_)) - (2 * _tmp87_)) + _tmp88_) - _tmp89_;
							_tmp90_ = ul;
							_tmp91_ = u;
							_tmp92_ = ur;
							_tmp93_ = dl;
							_tmp94_ = d;
							_tmp95_ = dr;
							y = ((((_tmp90_ + (2 * _tmp91_)) + _tmp92_) - _tmp93_) - (2 * _tmp94_)) - _tmp95_;
							z = 0.5f;
							_tmp96_ = x;
							_tmp97_ = x;
							_tmp98_ = y;
							_tmp99_ = y;
							_tmp100_ = z;
							_tmp101_ = z;
							_tmp102_ = sqrtf (((_tmp96_ * _tmp97_) + (_tmp98_ * _tmp99_)) + (_tmp100_ * _tmp101_));
							mag = _tmp102_;
							_tmp103_ = ((soytexturesTexture*) self)->texels;
							_tmp104_ = i;
							_tmp105_ = width;
							_tmp106_ = j;
							_tmp107_ = x;
							_tmp108_ = mag;
							_tmp103_[((gint) ((_tmp104_ * _tmp105_) + _tmp106_)) * 3] = (guchar) (((_tmp107_ / _tmp108_) + 1) * 127.5f);
							_tmp109_ = _tmp103_[((gint) ((_tmp104_ * _tmp105_) + _tmp106_)) * 3];
							_tmp110_ = ((soytexturesTexture*) self)->texels;
							_tmp111_ = i;
							_tmp112_ = width;
							_tmp113_ = j;
							_tmp114_ = y;
							_tmp115_ = mag;
							_tmp110_[(((gint) ((_tmp111_ * _tmp112_) + _tmp113_)) * 3) + 1] = (guchar) (((_tmp114_ / _tmp115_) + 1) * 127.5f);
							_tmp116_ = _tmp110_[(((gint) ((_tmp111_ * _tmp112_) + _tmp113_)) * 3) + 1];
							_tmp117_ = ((soytexturesTexture*) self)->texels;
							_tmp118_ = i;
							_tmp119_ = width;
							_tmp120_ = j;
							_tmp121_ = z;
							_tmp122_ = mag;
							_tmp117_[(((gint) ((_tmp118_ * _tmp119_) + _tmp120_)) * 3) + 2] = (guchar) (((_tmp121_ / _tmp122_) + 1) * 127.5f);
							_tmp123_ = _tmp117_[(((gint) ((_tmp118_ * _tmp119_) + _tmp120_)) * 3) + 2];
						}
					}
				}
			}
		}
	}
	return self;
}