Ejemplo n.º 1
0
Error Sector::frameUpdate(F32 prevUpdateTime, F32 crntTime)
{
	MoveComponent& move = getComponent<MoveComponent>();
	if(move.getTimestamp() == getGlobalTimestamp())
	{
		// Move comp updated.
		updateTransform(move.getWorldTransform());
		getSceneGraph().getSectorGroup().sectorUpdated(this);
	}

	return ErrorCode::NONE;
}
Ejemplo n.º 2
0
void GameObject::setPosition(const QPointF &position)
{
	// устанавливаем новую позицию
	Q_ASSERT(isLocalized());
	mPosition = position;
	updateTransform();

	// записываем локализованные координаты для текущего языка
	QString language = Project::getSingleton().getCurrentLanguage();
	mPositionXMap[language] = mPosition.x();
	mPositionYMap[language] = mPosition.y();
}
Ejemplo n.º 3
0
void EclassModelNode::_onTransformationChanged()
{
	if (getType() == TRANSFORM_PRIMITIVE)
	{
		_revertTransform();

		translate(getTranslation());
		rotate(getRotation());

		updateTransform();
	}
}
Ejemplo n.º 4
0
void GameObject::setSize(const QSizeF &size)
{
	// устанавливаем новый размер
	Q_ASSERT(isLocalized());
	mSize = size;
	updateTransform();

	// записываем локализованные размеры для текущего языка
	QString language = Project::getSingleton().getCurrentLanguage();
	mWidthMap[language] = mSize.width();
	mHeightMap[language] = mSize.height();
}
Ejemplo n.º 5
0
void Doom3Group::originChanged() {
	m_origin = m_originKey.m_origin;
	updateTransform();
	// Only non-models should have their origin different than <0,0,0>
	if (!isModel())
	{
		m_nameOrigin = m_origin;
		// Update the renderable name
		_owner._renderableName.setOrigin(getOrigin());
	}
	m_renderOrigin.updatePivot();
}
Ejemplo n.º 6
0
/*!
*
* Does not know if highSlot or lowSlot has changed.
*/
void
RoadMoveHandle::updateObserver()
{
    int dataElementChanges = road_->getDataElementChanges();

    // Deletion //
    //
    if ((dataElementChanges & DataElement::CDE_DataElementDeleted)
        || (dataElementChanges & DataElement::CDE_DataElementRemoved))
    {
        trackEditor_->getProjectGraph()->addToGarbage(this);
        return;
    }

    // RoadChanges //
    //
    int roadChanges = road_->getRoadChanges();

    // Deletion //
    //
    if (roadChanges & RSystemElementRoad::CRD_TrackSectionChange)
    {
        if (firstTrack_ != road_->getTrackComponent(0.0))
        {
            firstTrack_->detachObserver(this);
            firstTrack_ = road_->getTrackComponent(0.0);
            firstTrack_->attachObserver(this);
        }
        updateTransform();
    }

    // TrackComponentChanges //
    //
    int trackChanges = firstTrack_->getTrackComponentChanges();

    if (trackChanges & TrackComponent::CTC_TransformChange)
    {
        updateTransform();
    }
}
Ejemplo n.º 7
0
void GameObject::addPosition(float x, float y, float z){
	position[3].x += x;
	position[3].y += y;
	position[3].z += z;
	
	updateTransform();
	cachedPosition = glm::vec3(position[3]);
	if(collider != NULL){
		Bounding::translate(&(collider->boundingBox), glm::vec3(x,y,z));
	}
	
	changedPosition = true;
}
Ejemplo n.º 8
0
void Doom3Group::setIsModel(bool newValue) {
	if (newValue && !m_isModel) {
		// The model key is not recognised as "name"
		_owner.getModelKey().modelChanged(m_modelKey);
	}
	else if (!newValue && m_isModel) {
		// Clear the model path
		_owner.getModelKey().modelChanged("");
		m_nameOrigin = m_origin;
	}
	m_isModel = newValue;
	updateTransform();
}
Ejemplo n.º 9
0
void GLBackend::do_draw(Batch& batch, uint32 paramOffset) {
    updateInput();
    updateTransform();
    updatePipeline();

    Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint;
    GLenum mode = _primitiveToGLmode[primitiveType];
    uint32 numVertices = batch._params[paramOffset + 1]._uint;
    uint32 startVertex = batch._params[paramOffset + 0]._uint;

    glDrawArrays(mode, startVertex, numVertices);
    (void) CHECK_GL_ERROR();
}
Ejemplo n.º 10
0
void MapEditorWidget::updatePointFromPopup(){
  //  MapEditorPopup * popup = qobject_cast<MapEditorPopup *>(sender());
  if(popup){
    QPointF p = QPointF(popup->xEdit->text().toDouble(), popup->yEdit->text().toDouble());
    movePoint(popup->index, p);
    updateTransform();
    firePointChange();
    popup->close();
    popup = NULL;
  }else{
    qDebug("Tried to update non existing popup");
  }
}
Ejemplo n.º 11
0
void ImageProcessor::processFrame(){
    updateTransform();
    bool topCamera = false;
    if(camera_ == Camera::TOP)
        topCamera = true;

    //classifier_->classifyImage(color_table_);
    //classifier_->constructRuns();
    //classifier_->mergeRuns();

    //std::cout << "-----------------------------------------------------" << std::endl;
    //beacon_detector_->detectBeacon(topCamera);
    //std::cout << "-----------------------------------------------------" << std::endl;
}
Ejemplo n.º 12
0
void ImageProcessor::processFrame(){
  if(vblocks_.robot_state->WO_SELF == WO_TEAM_COACH && camera_ == Camera::BOTTOM) return;
  visionLog((30, "Process Frame camera %i", camera_));

  updateTransform();
  
  // Horizon calculation
  visionLog((30, "Calculating horizon line"));
  HorizonLine horizon = HorizonLine::generate(iparams_, cmatrix_, 30000);
  vblocks_.robot_vision->horizon = horizon;
  visionLog((30, "Classifying Image", camera_));
  if(!classifier_->classifyImage(color_table_)) return;	
  detectBall();
}
Ejemplo n.º 13
0
void GameObject::setPosition(float x, float y, float z){
	position[3].x = x;
	position[3].y = y;
	position[3].z = z;
	
	updateTransform();
	
	cachedPosition = glm::vec3(x, y, z);
	if(collider != NULL){
		Bounding::move(&(collider->boundingBox), cachedPosition);
	}
	
	changedPosition = true;
}
Ejemplo n.º 14
0
	void FlowVRCegGeometryBuffer::draw() const
	{
		if( m_bGeomDirty )
		{
			FlowVRCegTextureTarget *currentTarget = dynamic_cast<FlowVRCegTextureTarget*>( m_parent.getCurrentRenderTarget() );
			if( currentTarget == NULL )
				currentTarget = m_parent.m_defaultRenderTarget;
			updateGeometry();
//			std::cout << "geom dirty, adjusting target-group to [" <<  TargetGroups::FBO2Tg(currentTarget->getFBOID()) << "]" << std::endl;
//			std::for_each( m_mpbatchMap.begin(), m_mpbatchMap.end(), _setTargetGroup( m_parent.getChunkWriter(), TargetGroups::FBO2Tg(currentTarget->getFBOID()) ) );
		}
		if( m_bTransDirty )
			updateTransform();
	}
Ejemplo n.º 15
0
void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) {
    updateInput();
    updateTransform();
    updatePipeline();

    Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint;
    GLenum mode = _primitiveToGLmode[primitiveType];
    uint32 numIndices = batch._params[paramOffset + 1]._uint;
    uint32 startIndex = batch._params[paramOffset + 0]._uint;

    GLenum glType = _elementTypeToGLType[_input._indexBufferType];

    glDrawElements(mode, numIndices, glType, reinterpret_cast<GLvoid*>(startIndex + _input._indexBufferOffset));
    (void) CHECK_GL_ERROR();
}
Ejemplo n.º 16
0
	void CCollider::setIsTrigger(bool value)
	{
		if (mIsTrigger == value)
			return;

		mIsTrigger = value;

		if (mInternal != nullptr)
		{
			mInternal->setIsTrigger(value);

			updateParentRigidbody();
			updateTransform();
		}
	}
Ejemplo n.º 17
0
void MapView::load(QIODevice* file, int version)
{
	qint64 center_x, center_y;
	int unused;
	file->read((char*)&zoom, sizeof(double));
	file->read((char*)&rotation, sizeof(double));
	file->read((char*)&center_x, sizeof(qint64));
	file->read((char*)&center_y, sizeof(qint64));
	file->read((char*)&unused /*view_x*/, sizeof(int));
	file->read((char*)&unused /*view_y*/, sizeof(int));
	file->read((char*)&pan_offset, sizeof(QPoint));
	
	try
	{
		center_pos = MapCoord::fromNative64withOffset(center_x, center_y);
	}
	catch (std::range_error)
	{
		// leave center_pos unchanged
	}
	
	updateTransform(CenterChange | ZoomChange | RotationChange);
	
	if (version >= 26)
	{
		file->read((char*)&map_visibility->visible, sizeof(bool));
		file->read((char*)&map_visibility->opacity, sizeof(float));
	}
	
	int num_template_visibilities;
	file->read((char*)&num_template_visibilities, sizeof(int));
	
	for (int i = 0; i < num_template_visibilities; ++i)
	{
		int pos;
		file->read((char*)&pos, sizeof(int));
		
		TemplateVisibility* vis = getTemplateVisibility(map->getTemplate(pos));
		file->read((char*)&vis->visible, sizeof(bool));
		file->read((char*)&vis->opacity, sizeof(float));
	}
	
	if (version >= 29)
		file->read((char*)&all_templates_hidden, sizeof(bool));
	
	if (version >= 24)
		file->read((char*)&grid_visible, sizeof(bool));
}
Ejemplo n.º 18
0
void 
CPGRTransformDialog::OnKillfocusComponent() 
{
   UpdateData( TRUE );
   
   m_nXSlider     = VALUE_TO_SLIDER( m_dX );
   m_nYSlider     = VALUE_TO_SLIDER( m_dY );
   m_nZSlider     = VALUE_TO_SLIDER( m_dZ );
   m_nRollSlider  = VALUE_TO_SLIDER( m_dRoll );
   m_nPitchSlider = VALUE_TO_SLIDER( m_dPitch );
   m_nYawSlider   = VALUE_TO_SLIDER( m_dYaw );
   
   updateTransform();
   
   UpdateData( FALSE );
}
Ejemplo n.º 19
0
/**
 * Constructs a new Camera with the given viewport dimensions.
 * If you want to make changes to the camera's initial state,
 * you could do it here.
 */
Camera::Camera(int viewportWidth, int viewportHeight) :
	mCurrentMouseAction(kActionNone),
	m_vLookAt(0,0,0),
	m_fDolly(20),
	m_fFOV(40),
	m_iViewportWidth(viewportWidth),
	m_iViewportHeight(viewportHeight),
	m_fNearClip(1),
	m_fFarClip(300),
	m_fHalfHeight(CAMERA_HALF_WIDTH*viewportHeight/viewportWidth),
	m_fHalfWidth(CAMERA_HALF_WIDTH)
{
	float axis[3] = {1, 0, 0};
	axis_to_quat(axis, -30 * M_PI / 180, m_fQuat);
	updateTransform();
}
Ejemplo n.º 20
0
	void CCollider::onTransformChanged(TransformChangedFlags flags)
	{
		if (!SO()->getActive())
			return;

		if ((flags & TCF_Parent) != 0)
			updateParentRigidbody();

		// Don't update the transform if it's due to Physics update since then we can guarantee it will remain at the same
		// relative transform to its parent
		if (gPhysics()._isUpdateInProgress())
			return;

		if ((flags & (TCF_Parent | TCF_Transform)) != 0)
			updateTransform();
	}
Ejemplo n.º 21
0
void PaintPropertyTreeBuilder::buildTreeNodesForSelf(
    const LayoutObject& object,
    PaintPropertyTreeBuilderContext& context) {
  if (!object.isBoxModelObject() && !object.isSVG())
    return;

  deriveBorderBoxFromContainerContext(object, context);

  updatePaintOffsetTranslation(object, context);
  updateTransform(object, context);
  updateEffect(object, context);
  updateCssClip(object, context);
  updateLocalBorderBoxContext(object, context);
  updateScrollbarPaintOffset(object, context);
  updateMainThreadScrollingReasons(object, context);
}
Ejemplo n.º 22
0
// Reset the transform
void ConvexMesh::resetTransform(const rp3d::Transform& transform) {

    // Reset the transform
    mBody->setTransform(transform);

    mBody->setIsSleeping(false);

    // Reset the velocity of the rigid body
    rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody);
    if (rigidBody != NULL) {
        rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0));
        rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0));
    }

    updateTransform(1.0f);
}
Ejemplo n.º 23
0
	void CAudioSource::restoreInternal()
	{
		if (mInternal == nullptr)
			mInternal = AudioSource::create();

		// Note: Merge into one call to avoid many virtual function calls
		mInternal->setClip(mAudioClip);
		mInternal->setVolume(mVolume);
		mInternal->setPitch(mPitch);
		mInternal->setIsLooping(mLoop);
		mInternal->setPriority(mPriority);
		mInternal->setMinDistance(mMinDistance);
		mInternal->setAttenuation(mAttenuation);

		updateTransform();
	}
Ejemplo n.º 24
0
void CMirror::onInit(LPCTSTR strTex, float fYaw, float fPitch, float fRow) {
	m_fAngle[0] = fYaw; m_fAngle[1] = fPitch; m_fAngle[2] = fRow;
	updateTransform();

	D3DXCreateTextureFromFile(CDirect3D::getInstance()->GetD3D9Device(), 
		strTex, &m_pTexture);
	CDirect3D::getInstance()->CreateVertexBuffer(sizeof(SVertexT)*4, 
		D3DUSAGE_WRITEONLY, SVertexT::FVF, D3DPOOL_DEFAULT, &m_pVB, NULL);
	SVertexT* pVertices;
	m_pVB->Lock(0, sizeof(SVertexT)*4, (void**) &pVertices, 0);
	pVertices[0] = SVertexT(-9/8.f, -2.f, 0.f, 0.f, 1.f);
	pVertices[1] = SVertexT(-9/8.f, 2.f, 0.f, 0.f, 0.f);
	pVertices[2] = SVertexT(9/8.f, -2.f, 0.f, 1.f, 1.f);
	pVertices[3] = SVertexT(9/8.f, 2.f, 0.f, 1.f, 0.f);
	m_pVB->Unlock();
}
Ejemplo n.º 25
0
PointLight::PointLight(const Vec2& position, float size)
{
	m_position = Vec3(position.x, position.y, 0);
	m_size = Size(size, size);

	m_occlusionMap = new (std::nothrow) RenderTexture(size, size);
	m_shadowMap = new (std::nothrow) RenderTexture(size, 1);
	m_lightMap = new (std::nothrow) RenderTexture(size, size);

	m_shadowMapRenderer.reset(ShadowMapRenderer::create(m_occlusionMap, Vec3(size / 2, 1, 0)));
	m_shadowRenderer.reset(ShadowRenderer::create(m_lightMap, m_shadowMap, Vec3(size / 2, size / 2, 0), size));

	m_finalSprite.reset(Sprite::createWithRenderTexture(m_lightMap, Vec3(position.x, position.y, 0)));
	m_finalSprite->setScale(-1.0f, -1.0f);

	updateTransform();
}
Ejemplo n.º 26
0
RoadMoveHandle::RoadMoveHandle(TrackEditor *trackEditor, RSystemElementRoad *road, QGraphicsItem *parent)
    : MoveHandle(parent)
    , trackEditor_(trackEditor)
    , road_(road)
{
    // Observer Pattern //
    //
    road_->attachObserver(this);

    firstTrack_ = road_->getTrackComponent(0.0);
    firstTrack_->attachObserver(this);

    // Color/Transform //
    //
    updateColor();
    updateTransform();
}
Ejemplo n.º 27
0
void ImageProcessor::processFrame(){
   updateTransform();
   classifier_->classifyImage(color_table_);
   if(camera_ == Camera::TOP){
   classifier_->constructRuns();
   classifier_->connectComponents(c_BLUE);
   classifier_->connectComponents(c_PINK);
   classifier_->connectComponents(c_YELLOW);
   //classifier_->connectComponents(c_BLUE);  
   //blob_detector_->formBlobs(c_BLUE);
  //for(uint16_t i = ; i<NUM_COLORS; i++)*/
   blob_detector_->preProcess(c_BLUE); 
   blob_detector_->preProcess(c_PINK); 
   blob_detector_->preProcess(c_YELLOW); 
   blob_detector_->findBeacons2();
   }
}
Ejemplo n.º 28
0
void ColorPickerItem::setAnimated(bool animated)
{
    if (m_isAnimated == animated)
        return;

    // start animations
    m_isAnimated = animated;
    if (animated) {
        if (!m_timeLine) {
            m_timeLine = new QTimeLine(300, this);
            m_timeLine->setStartFrame(0);
            m_timeLine->setEndFrame(100);
            m_timeLine->setUpdateInterval(20);
            connect(m_timeLine, SIGNAL(frameChanged(int)), this, SLOT(slotAnimateScale(int)));
        }
        updateTransform();
    }
Ejemplo n.º 29
0
void Object3D::lookAt(Vector3D& target, Vector3D& upAxis)
{
	if (m_transformDirty)
		updateTransform();

	Vector3D zAxis(target.m_x - m_position.m_x, target.m_y - m_position.m_y, target.m_z - m_position.m_z);
	zAxis.normalize();

	Vector3D xAxis(upAxis.m_y * zAxis.m_z - upAxis.m_z * zAxis.m_y, upAxis.m_z * zAxis.m_x - upAxis.m_x * zAxis.m_z, upAxis.m_x * zAxis.m_y - upAxis.m_y * zAxis.m_x);
	xAxis.normalize();

	if (xAxis.getLength() < .05f)
	{
		xAxis.m_x = upAxis.m_y;
		xAxis.m_y = upAxis.m_x;
		xAxis.m_z = 0;
		xAxis.normalize();
	}

	Vector3D yAxis(zAxis.m_y * xAxis.m_z - zAxis.m_z * xAxis.m_y, zAxis.m_z * xAxis.m_x - zAxis.m_x * xAxis.m_z, zAxis.m_x * xAxis.m_y - zAxis.m_y * xAxis.m_x);

	float (&raw)[16] = m_transform.m_rawData;
	raw[0] = m_scaling.m_x * xAxis.m_x;
	raw[1] = m_scaling.m_x * xAxis.m_y;
	raw[2] = m_scaling.m_x * xAxis.m_z;
	raw[4] = m_scaling.m_y * yAxis.m_x;
	raw[5] = m_scaling.m_y * yAxis.m_y;
	raw[6] = m_scaling.m_y * yAxis.m_z;
	raw[8] = m_scaling.m_z * zAxis.m_x;
	raw[9] = m_scaling.m_z * zAxis.m_y;
	raw[10] = m_scaling.m_z * zAxis.m_z;
	raw[12] = m_position.m_x;
	raw[13] = m_position.m_y;
	raw[14] = m_position.m_z;
	raw[3] = raw[7] = raw[11] = 0;
	raw[15] = 1;
	setTransform(m_transform);

	if (zAxis.m_z < 0)
	{
		setRotationY(180 - getRotationY());
		setRotationX(getRotationX() - 180);
		setRotationZ(getRotationZ() - 180);
	}
}
Ejemplo n.º 30
0
void 
CPGRTransformDialog::OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar ) 
{
   UpdateData(TRUE);
   
   m_dX     = SLIDER_TO_VALUE( m_nXSlider );
   m_dY     = SLIDER_TO_VALUE( m_nYSlider );
   m_dZ     = SLIDER_TO_VALUE( m_nZSlider );
   m_dRoll  = SLIDER_TO_VALUE( m_nRollSlider );
   m_dPitch = SLIDER_TO_VALUE( m_nPitchSlider );
   m_dYaw   = SLIDER_TO_VALUE( m_nYawSlider );
   
   updateTransform();
   
   UpdateData(FALSE);
   
   CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}