コード例 #1
0
void CHUD::AutoSnap()
{
	const float fRadius = 25.0f;
	static Vec2 s_vCursor = Vec2(0,0);
	if(fabsf(m_fAutosnapCursorControllerX)>0.1 || fabsf(m_fAutosnapCursorControllerY)>0.1)
	{
		s_vCursor.x = m_fAutosnapCursorControllerX * 30.0f;
		s_vCursor.y = m_fAutosnapCursorControllerY * 30.0f;
	}
	else
	{
		s_vCursor.x = m_fAutosnapCursorRelativeX;
		s_vCursor.y = m_fAutosnapCursorRelativeY;
	}
	if(m_bOnCircle && s_vCursor.GetLength() < fRadius*0.5f)
	{
		m_fAutosnapCursorRelativeX = 0;
		m_fAutosnapCursorRelativeY = 0;
		m_bOnCircle = false;
	}
	if(s_vCursor.GetLength() > fRadius)
	{
		s_vCursor.NormalizeSafe();
		m_fAutosnapCursorRelativeX = s_vCursor.x*fRadius;
		m_fAutosnapCursorRelativeY = s_vCursor.y*fRadius;
		m_bOnCircle = true;
	}


	const char* autosnapItem = "Center";

	if(m_bOnCircle)
	{
		Vec2 vCursor = s_vCursor;
		vCursor.NormalizeSafe();

		float fAngle;
		if(vCursor.y < 0)
		{
			fAngle = RAD2DEG(acos_tpl(vCursor.x));
		}
		else
		{
			fAngle = RAD2DEG(gf_PI2-acos_tpl(vCursor.x));
		}

		char szAngle[32];
		sprintf(szAngle,"%f",-fAngle+90.0f);

/*
		ColorB col(255,255,255,255);
		int iW=m_pRenderer->GetWidth();
		int iH=m_pRenderer->GetHeight();
		m_pRenderer->Set2DMode(true,iW,iH);
		m_pRenderer->GetIRenderAuxGeom()->DrawLine(Vec3(iW/2,iH/2,0),col,Vec3(iW/2+vCursor.x*100,iH/2+vCursor.y*100,0),col,5);
		m_pRenderer->Set2DMode(false,0,0);
*/

		m_animQuickMenu.CheckedSetVariable("Root.QuickMenu.Circle.Indicator._rotation",szAngle);

		if(fAngle >= 342 || fAngle < 52)
		{
			autosnapItem = "Strength";
		}
		else if(fAngle >= 52 && fAngle < 128)
		{
			autosnapItem = "Speed";
		}
		else if(fAngle >= 128 && fAngle < 205)
		{
			autosnapItem = "Defense";
		}
		else if(fAngle >= 205 && fAngle < 260)
		{
			autosnapItem = "Weapon";
		}
		else if(fAngle >= 260 && fAngle < 342)
		{
			autosnapItem = "Cloak";
		}
	}

	m_animQuickMenu.CheckedInvoke("Root.QuickMenu.setAutosnapItem", autosnapItem);
}
コード例 #2
0
ファイル: level.cpp プロジェクト: Eldhelion/keeperrl
bool Level::inBounds(Vec2 pos) const {
  return pos.inRectangle(getBounds());
}
コード例 #3
0
ファイル: morph.cpp プロジェクト: V-Italy/viewmorphing
	void warp(const QImage& Isrc,
		const CachedLine2* lines_src,
		const CachedLine2* lines_dst,
		int lines_num,
		QImage& Idst,
		float a,float b,float p)
	{
		assert(Isrc.size()==Idst.size());

		int h=Isrc.height(),w=Isrc.width();
		uint rgba;
		float u,v;
		float dist,wgt,wgt_sum=0.f;
		Vec2 D,D_sum;

		Point2 Xdst,Xsrc;
		Vec2 PX;

		for(int y=0;y<h;++y)
		{
			for(int x=0;x<w;++x)
			{
				// every pixel in dest image
				Xdst.x=x;Xdst.y=y;

				D_sum.x=D_sum.y=0.f;wgt_sum=0.f;

				for(int ln=0;ln<lines_num;++ln)
				{
					PX=Xdst-lines_dst[ln].P;
					u=PX*lines_dst[ln].vec; // vec/norm2
					v=PX*lines_dst[ln].unit_perpendicular;

					Xsrc=lines_src[ln].P+
						u*lines_src[ln].vec+ // vec
						v*lines_src[ln].unit_perpendicular;

					D=Xsrc-Xdst;

					if(u<0.f)
						dist=PX.length();
					else if(u>1.f)
						dist=(Xdst-lines_dst[ln].Q).length();
					else
						dist=fabsf(v);

					wgt=lines_dst[ln].weight(dist,a,b,p);
					D_sum+=D*wgt;
					wgt_sum+=wgt;
				}


				
				Xsrc=Xdst+(D_sum/wgt_sum);

				rgba=bilinear_fetch(Isrc,Xsrc.x,Xsrc.y);
				Idst.setPixel(x,y,rgba);
				
				
// 				QRgb rr=Idst.pixel(x,y);
// 				//if(x>=0&&x<w&&y>=0&&y)
// 				assert((rr&(0x00ffffff))==(rgba&(0x00ffffff)));
			}
		}
	}
コード例 #4
0
ファイル: level.cpp プロジェクト: Nekoninja/keeperrl
bool Level::isWithinVision(Vec2 from, Vec2 to) const {
  return from.distD(to) <= darkViewRadius || getSquare(to)->getLight() > 0.3;
}
コード例 #5
0
ファイル: SpectacularKill.cpp プロジェクト: aronarts/FireNET
	bool operator() (const SSpectacularKillAnimation& killAnim) const
	{
		const SSpectacularKillCVars& skCVars = g_pGameCVars->g_spectacularKill;
		const CActor* pOwner = m_spectacularKill.m_pOwner;

		// 0. the anim shouldn't be redundant
		if (((gEnv->pTimer->GetFrameStartTime().GetSeconds() - s_lastKillInfo.timeStamp) <= skCVars.minTimeBetweenSameKills) &&
			(killAnim.killerAnimation.compare(s_lastKillInfo.killerAnim)))
		{
			SK_DEBUG_LOG("GetValidAnim - %s is not valid: This animation was last played %.1f ago, a minimum time of %.1f is required", 
				killAnim.killerAnimation.c_str(), (gEnv->pTimer->GetFrameStartTime().GetSeconds() - s_lastKillInfo.timeStamp), skCVars.minTimeBetweenSameKills);

			return true;
		}


		// 1. the killer needs to be within a certain distance from the target
		IEntity* pTargetEntity = m_pTarget->GetEntity();
		IEntity* pKillerEntity = pOwner->GetEntity();

		const QuatT& killerTransform = pOwner->GetAnimatedCharacter()->GetAnimLocation();
		const QuatT& targetTransform = m_pTarget->GetAnimatedCharacter()->GetAnimLocation();
		const Vec3& vKillerPos = killerTransform.t;
		const Vec3& vTargetPos = targetTransform.t;

		Vec2 vKillerToTarget = Vec2(vTargetPos) - Vec2(vKillerPos);
		float distance = vKillerToTarget.GetLength();

		const float optimalDistance = killAnim.optimalDist;
		if ((optimalDistance > 0.0f) && (fabs_tpl(distance - optimalDistance) > skCVars.maxDistanceError))
		{
#ifndef _RELEASE
			if (g_pGameCVars->g_spectacularKill.debug > 1)
			{
				// visually shows why it failed
				IPersistantDebug* pPersistantDebug = m_spectacularKill.BeginPersistantDebug();
				const float fConeHeight = killAnim.optimalDist + skCVars.maxDistanceError;
				pPersistantDebug->AddPlanarDisc(vTargetPos, killAnim.optimalDist - skCVars.maxDistanceError, killAnim.optimalDist + skCVars.maxDistanceError, Col_Coral, 6.0f);
				pPersistantDebug->AddLine(vKillerPos, vKillerPos + Vec3(0.f, 0.f, 5.0f), Col_Red, 6.f);
			}

			SK_DEBUG_LOG("GetValidAnim - %s is not valid: Distance between actors should be %.2f, is %.2f (max error is %f)", 
				killAnim.killerAnimation.c_str(), optimalDistance, distance, skCVars.maxDistanceError);
#endif

			return true;
		}


		// 2. The killer needs to be facing the target within cosLookToConeHalfAngleRadians angle
		Vec2 vKillerDir(killerTransform.GetColumn1()); // In decoupled catchup mode we need the animated character's orientation
		vKillerDir.Normalize();
		if (vKillerToTarget.GetNormalizedSafe().Dot(vKillerDir) <= skCVars.minKillerToTargetDotProduct)
		{
			SK_DEBUG_LOG("GetValidAnim - %s is not valid: Killer is not looking within %.2f degrees towards the target", 
				killAnim.killerAnimation.c_str(), RAD2DEG(acos_tpl(skCVars.minKillerToTargetDotProduct) * 2.0f));

			return true;
		}


		// 3. If specified, the killer needs to be within a certain angle range from a given reference orientation from the target
		// e.g. Specifying referenceAngle 180 means using the back of the target as the center of the angle range 
		// (imagine it as a cone) where the killer has to be for the kill to be valid
		if (killAnim.targetToKillerAngle >= 0.f)
		{
			const float referenceAngle = killAnim.targetToKillerAngle;

			// Find the reference vector which will be the center of the allowed angle range
			Vec2 vTargetDir(targetTransform.GetColumn1());
			vTargetDir.Normalize();

			// 2D rotation
			Vec2 vReferenceDir((vTargetDir.x * cosf(referenceAngle)) - (vTargetDir.y * sinf(referenceAngle)), 
				(vTargetDir.y * cosf(referenceAngle)) + (vTargetDir.x * sinf(referenceAngle)));

			if (vKillerToTarget.GetNormalizedSafe().Dot(-vReferenceDir) <= killAnim.targetToKillerMinDot)
			{
#ifndef _RELEASE
				if (g_pGameCVars->g_spectacularKill.debug > 1)
				{
					// visually shows why it failed
					IPersistantDebug* pPersistantDebug = m_spectacularKill.BeginPersistantDebug();
					const float fConeHeight = killAnim.optimalDist + skCVars.maxDistanceError;
					pPersistantDebug->AddCone(vTargetPos + (vReferenceDir * fConeHeight), -vReferenceDir, killAnim.targetToKillerMinDot * fConeHeight * 2.0f, fConeHeight, Col_Coral, 6.f);
					pPersistantDebug->AddLine(vKillerPos, vKillerPos + Vec3(0.f, 0.f, 5.0f), Col_Red, 6.f);
				}

				float targetToKillerDot = vTargetDir.GetNormalizedSafe().Dot(-vKillerToTarget);
				SK_DEBUG_LOG("GetValidAnim - %s is not valid: Killer is not within a %.2f degrees cone centered on the target's %.2f degrees. Killer is at %.2f angles respect the target", 
					killAnim.killerAnimation.c_str(), RAD2DEG(acos_tpl(killAnim.targetToKillerMinDot) * 2.0f), RAD2DEG(killAnim.targetToKillerAngle), RAD2DEG(acos_tpl(targetToKillerDot)));
#endif

				return true;
			}
		}

		SK_DEBUG_LOG("GetValidAnim - %s is valid", killAnim.killerAnimation.c_str());
		return false;
	}
コード例 #6
0
ファイル: polygon2D.cpp プロジェクト: degarashi/boomstick
		float Poly::CalcArea(const Vec2& p0, const Vec2& p1) {
			return p0.cw(p1) * 0.5f;
		}
コード例 #7
0
ファイル: CutScene.cpp プロジェクト: GitofThunder/gitskills
bool CCutScene::slice(PhysicsWorld &world, const PhysicsRayCastInfo& info, void *data)
{
    log("slice called %f, %f, %lld", info.contact.x, info.contact.y, m_lLastSlice);
    if (!m_bHasFood) return true;
    
    if (info.shape->getBody()->getTag() != _sliceTag)
    {
        return true;
    }
    
    long long llLastSlice = 0;
    PhysicsBody* pBody = info.shape->getBody();
    if (pBody == NULL) return true;
    CFoodCut* pFood = (CFoodCut*)info.shape->getBody()->getNode();
    if (pFood == NULL) return true;
    llLastSlice = pFood->getBirthTime();
    
    if (getCurTime() - llLastSlice <= 200) return true;
    m_v2Delta.normalize();
    Vec2 v2Start = info.contact - m_v2Delta * 100;
    Vec2 v2End = info.contact + m_v2Delta * 500;
    
    if (!info.shape->containsPoint(v2Start) && !info.shape->containsPoint(v2End))
    {
        Vec2 normal = v2End - v2Start;
        normal = normal.getPerp().getNormalized();
        float dist = v2Start.dot(normal);
        
        clipPoly(dynamic_cast<PhysicsShapePolygon*>(info.shape), normal, dist);
        clipPoly(dynamic_cast<PhysicsShapePolygon*>(info.shape), -normal, -dist);
        
        Vec2 v2Direct = (v2End - v2Start).getNormalized();
        Vec2 v2Tmp = Vec2::ZERO;
        for (int i = 0; i < PARTICLE_COUNT; i++)
        {
            v2Tmp = info.contact + v2Direct * 80 * (i - 1);
            if (!info.shape->containsPoint(v2Tmp))
            {
                continue;
            }
            else
            {
                m_pEmitter[i]->setPosition(v2Tmp);
                m_pEmitter[i]->resetSystem();
            }
        }
        
        std::vector<CFoodCut*>::iterator it;
        for (it = m_vCutFoods.begin(); it != m_vCutFoods.end(); it++)
        {
            CFoodCut* pTmp = *it;
            if (pTmp == info.shape->getBody()->getNode())
            {
                m_vCutFoods.erase(it);
                break;
            }
        }
        m_nSliceCount--;
        info.shape->getBody()->removeFromWorld();
        info.shape->getBody()->getNode()->removeFromParent();
        
        checkFoodSliced();
    }
    
    return true;
}
コード例 #8
0
std::list<Vec2> createSkyline(const Vec2& freeRectangle) {
	std::list<Vec2> Skyline;
	Skyline.push_back(Vec2(freeRectangle.width(), 0));
	return Skyline;
}
コード例 #9
0
ファイル: nn_widget.hpp プロジェクト: limebreaker/KONAHEN
 void setPos(const float x, const float y) { pos_.set(x, y); }
コード例 #10
0
ファイル: Leukocyte.cpp プロジェクト: MKomiya/Leukocyte
void Leukocyte::updateLeukocyte(float dt, const Leukocyte *other)
{
    static int lockFrame = 0;
    float currentScale = this->getCurrentScale();
    
    if (currentState == LeukocyteState::LOCK) {
        lockFrame++;
        
        if (lockFrame >= PLAYER_MOVING_LOCK_FRAME) {
            lockFrame = 0;

            currentState = LeukocyteState::STOP;
        }
    }
    else {
        Vec2 playerPos = this->getPosition();
        float distance = playerLastTouchPos.distance(playerPos);
        
        // 距離がしきい値以下なら加速度を再計算して速度固定
        if (distance <= ATTRACTED_DISTANCE * (1.0f / currentScale) && currentState == LeukocyteState::MOVE && !isCPU) {
            playerAccelerate =  this->getCurrentPlayerAccelerateToTouchPosition();
            playerVelocity = sqrt(3.0f * MAX_VELOCITY * (1.0f / currentScale)) * playerAccelerate.getNormalized();
        }
        else {
            if (currentState == LeukocyteState::DASH) {
                if (playerVelocity.getLengthSq() > MAX_VELOCITY * (1.0f / currentScale)) {
                    playerAccelerate = this->getCurrentPlayerAccelerateToTouchPosition();
                    Vec2 addedVelocity = playerVelocity - playerAccelerate * 10 * dt * (1.0f / currentScale);
                    if (addedVelocity.getLengthSq() > playerVelocity.getLengthSq()) {
                        addedVelocity = playerVelocity + playerAccelerate * 10 * dt * (1.0f / currentScale);
                    }
                    playerVelocity = addedVelocity;
                }
                else {
                    currentState = LeukocyteState::MOVE;
                }
            }
            else {
                // 加速度から速度計算
                playerAccelerate = this->getCurrentPlayerAccelerateToTouchPosition();
                Vec2 addedVelocity = playerVelocity + playerAccelerate * dt * (1.0f / currentScale);
                
                // max値を超えない場合のみプレイヤーの速度を更新する
                playerVelocity = addedVelocity;
                
                if (playerVelocity.getLengthSq() > MAX_VELOCITY * (1.0f / currentScale)) {
                    Vec2 normalizedPlayerVelocity = playerVelocity.getNormalized();
                    playerVelocity = sqrt(MAX_VELOCITY * (1.0f / currentScale)) * normalizedPlayerVelocity;
                }
            }
        }
        
        if (currentState != LeukocyteState::ATTACKED &&
            currentState != LeukocyteState::DASH)
        {
            currentState = playerVelocity.length() > 0.0f ? LeukocyteState::MOVE : LeukocyteState::STOP;
        }
        
        // 壁際反射判定
        Vec2 updatedPos   = playerPos + playerVelocity;
        auto playerSprite = this->getChildByName<Sprite*>("player");
        Size playerSize   = Size(currentScale * playerSprite->getContentSize().width, currentScale * playerSprite->getContentSize().height);
        
        Size visibleSize = Director::getInstance()->getVisibleSize();
        if (updatedPos.x - playerSize.width / 2 < 0 || updatedPos.x + playerSize.width / 2 > visibleSize.width) {
            SimpleAudioEngine::getInstance()->playEffect(SE_HIT_WALL);
            
            playerVelocity.x *= -1.0f;
            if (currentState == LeukocyteState::DASH) {
                playerVelocity = sqrt(MAX_VELOCITY * (1.0f / currentScale)) * playerVelocity.getNormalized();
                currentState = LeukocyteState::MOVE;
            }
        }
        if (updatedPos.y - playerSize.height / 2 < 0 || updatedPos.y + playerSize.height / 2 > visibleSize.height) {
            SimpleAudioEngine::getInstance()->playEffect(SE_HIT_WALL);
            
            playerVelocity.y *= -1.0f;
            if (currentState == LeukocyteState::DASH) {
                playerVelocity = sqrt(MAX_VELOCITY * (1.0f / currentScale)) * playerVelocity.getNormalized();
                currentState = LeukocyteState::MOVE;
            }
        }
        
        // 他プレイヤー衝突判定
        if (other) {
            if (other->isCollideByOtherLeukocyte(updatedPos, this->getCollideRadius())) {
                // 半径和からプレイヤー間距離を引いた値が補正値
                float sumRadius = this->getCollideRadius() + other->getCollideRadius();
                float distance  = updatedPos.distance(other->getPosition());
                Vec2 adjustVec  = (sumRadius - distance) * (other->getPosition() - updatedPos).getNormalized();
                
                if (playerVelocity.getLength() > other->getPlayerVelocity().getLength()) {
                    this->setPosition(updatedPos - adjustVec);
                }
            }
            else {
                this->setPosition(playerPos + playerVelocity);
            }
        }
        else {
            // プレイヤー座標を更新する
            this->setPosition(playerPos + playerVelocity);
        }
        
        // 目標地点との距離がしきい値以下なら到着
        if (currentState != LeukocyteState::ATTACKED && !isCPU) {
            updatedPos = this->getPosition();
            float updated_distance = updatedPos.distance(playerLastTouchPos);
            
            if (updated_distance <= REACHED_DISTANCE) {
                this->setPosition(playerLastTouchPos);
                playerVelocity   = Vec2::ZERO;
                playerAccelerate = Vec2::ZERO;
                
                if (currentState == LeukocyteState::MOVE) {
                    currentState = LeukocyteState::LOCK;
                    dashGauge = 0;

                    float duration = Director::getInstance()->getAnimationInterval() * PLAYER_MOVING_LOCK_FRAME;
                    Blink* blink = Blink::create(duration, 3);
                    this->runAction(blink);
                }
            }
        }
        
        playerPrevFrameTouchPos = playerLastTouchPos;
        
        dashProgress->setPercentage(float(dashGauge) / PLAYER_DASH_CHARGE_MAX * 100.0f);
    }
    
    // 成長に合わせて壁に埋まる場合があるので補正
    Vec2 currentPosition = this->getPosition();
    Vec2 newPosition = Utility::getAdjustedPositionFromWall(currentPosition, this->getLeukocyteSize());
    if (currentPosition != newPosition) {
        this->setPosition(newPosition);
    }
    
    // decrease chain frame
    if (this->chainLeftFrame > 0 && !this->isLockChainLeftFrame) {
        this->chainLeftFrame--;
        if (this->chainLeftFrame <= 0) {
            this->chainCount = 0;
            this->sendData(JSONPacker::ActionType::TOUCH);
        }
    }
    
    // CPU logic
    if (this->isCPU) {
        this->updateForCPU();
    }
}
コード例 #11
0
ファイル: main.cpp プロジェクト: ioquatix/dream-examples
void LightingScene::will_become_current(ISceneManager * manager)
{
    Scene::will_become_current(manager);

    glEnable(GL_DEPTH_TEST);
    //glEnable(GL_CULL_FACE);
    //glCullFace(GL_BACK);

    check_graphics_error();

    _camera = new BirdsEyeCamera;
    _camera->set_distance(10);
    _camera->set_multiplier(Vec3(0.1, 0.1, 0.01));

    _projection = new PerspectiveProjection(R90 * 0.7, 1, 1024 * 12);
    _viewport = new Viewport(_camera, _projection);
    _viewport->set_bounds(AlignedBox<2>(ZERO, manager->display_context()->size()));

    _point.zero();
    _light_positions[0].zero();
    _light_positions[1].zero();
    _light_positions[2].zero();

    _rotation = 0.0;
    _light_colors[0] = Vec4(2.0, 0.8, 0.4, 0.0);
    _light_colors[1] = Vec4(0.4, 0.8, 2.0, 0.0);
    _light_colors[2] = Vec4(0.4, 2.0, 0.8, 0.0);
    //_light_colors[0] = Vec4(1.2, 0.2, 0.2, 0.0);
    //_light_colors[1] = Vec4(0.2, 0.2, 1.2, 0.0);
    //_light_colors[2] = Vec4(0.2, 1.2, 0.2, 0.0);

    _renderer_state = new RendererState;
    _renderer_state->shader_manager = new ShaderManager;
    _renderer_state->texture_manager = new TextureManager;
    _renderer_state->resource_loader = this->resource_loader();

    {
        _crate_texture = _renderer_state->load_texture(TextureParameters::LINEAR, "Textures/Checkers");
        _particle_texture = _renderer_state->load_texture(TextureParameters::LINEAR, "Textures/Trail");
    }

    check_graphics_error();

    {
        _pixel_buffer_renderer = new PixelBufferRenderer(_renderer_state->texture_manager);
    }

    {
        _solid_program = _renderer_state->load_program("Shaders/solid");
    }

    {
        _wireframe_program = _renderer_state->load_program("Shaders/wireframe");
        _wireframe_program->set_attribute_location("position", WireframeRenderer::POSITION);
        _wireframe_program->link();

        _wireframe_renderer = new WireframeRenderer;
    }

    {
        _particle_program = _renderer_state->load_program("Shaders/particle");

        _particle_program->set_attribute_location("position", TrailParticles::POSITION);
        _particle_program->set_attribute_location("offset", TrailParticles::OFFSET);
        _particle_program->set_attribute_location("mapping", TrailParticles::MAPPING);
        _particle_program->set_attribute_location("color", TrailParticles::COLOR);
        _particle_program->link();

        auto binding = _particle_program->binding();
        binding.set_texture_unit("diffuse_texture", 0);

        _trail_particles = new TrailParticles;
    }

    {
        // Setup the buffer for drawing the light trails.
        _flowing_array = new VertexArray;
        _flowing_buffer = new VertexBuffer<BasicVertex<Vec3>>;

        auto binding = _flowing_array->binding();
        auto attributes = binding.attach(*_flowing_buffer);
        attributes[0] = &BasicVertex<Vec3>::element;

        check_graphics_error();
    }

    {
        _flat_program = _renderer_state->load_program("Shaders/flat");

        _flat_program->set_attribute_location("position", 0);
        _flat_program->set_attribute_location("mapping", 1);
        _flat_program->link();

        auto binding = _flat_program->binding();
        binding.set_texture_unit("diffuse_texture", 0);

        check_graphics_error();
    }

    {
        _textured_program = _renderer_state->load_program("Shaders/surface");

        _textured_program->set_attribute_location("position", POSITION);
        _textured_program->set_attribute_location("normal", NORMAL);
        _textured_program->set_attribute_location("color", COLOR);
        _textured_program->set_attribute_location("mapping", MAPPING);
        _textured_program->link();

        _position_uniform = _textured_program->uniform_location("point");
        _diffuse_uniform = _textured_program->uniform_location("diffuse");
        _light_positions_uniform = _textured_program->uniform_location("light_positions");

        check_graphics_error();
    }

    {
        using namespace Geometry;

        Shared<MeshT> mesh = new MeshT;
        mesh->layout = TRIANGLE_STRIP;
        Generate::sphere(*mesh, 4, 8*2, (16*2)+1);
        //Generate::solid_color(*mesh, Vec4(0.5, 0.5, 0.5, 1.0));

        /*
        {
        	LogBuffer buffer;
        	buffer << "Mesh vertices: " << std::endl;
        	for (auto i : mesh->indices) {
        		MeshT::VertexT vertex = mesh->vertices[i];

        		buffer << "Vertex " << i << ": " << vertex.position << "; " << vertex.mapping << std::endl;
        	}
        	logger()->log(LOG_DEBUG, buffer);
        }
        */

        _object_mesh_buffer = new MeshBuffer<MeshT>();
        _object_mesh_buffer->set_mesh(mesh);

        {
            auto binding = _object_mesh_buffer->vertex_array().binding();

            // Attach indices
            binding.attach(_object_mesh_buffer->index_buffer());

            // Attach attributes
            auto attributes = binding.attach(_object_mesh_buffer->vertex_buffer());
            attributes[POSITION] = &MeshT::VertexT::position;
            attributes[NORMAL] = &MeshT::VertexT::normal;
            //attributes[COLOR] = &MeshT::VertexT::color;
            attributes[MAPPING] = &MeshT::VertexT::mapping;
        }
    }

    {
        using namespace Geometry;

        Shared<MeshT> mesh = new MeshT;
        mesh->layout = LINES;
        Generate::grid(*mesh, 32, 2.0);

        _grid_mesh_buffer = new MeshBuffer<MeshT>();
        _grid_mesh_buffer->set_mesh(mesh);

        {
            auto binding = _grid_mesh_buffer->vertex_array().binding();

            // Attach indices
            binding.attach(_grid_mesh_buffer->index_buffer());

            // Attach attributes
            auto attributes = binding.attach(_grid_mesh_buffer->vertex_buffer());
            attributes[POSITION] = &MeshT::VertexT::position;
            attributes[NORMAL] = &MeshT::VertexT::normal;
            attributes[MAPPING] = &MeshT::VertexT::mapping;
        }
    }

    {
        _flowing_lights[0].rotations[0].set_to_angle_axis_rotation(R90 / 25.0, Vec3(0.0, 0.3, 1.0).normalize());
        _flowing_lights[0].rotations[1].set_to_angle_axis_rotation(R10 / 10.0, Vec3(0.0, 1.0, 1.0).normalize());
        _flowing_lights[0].rotations[2].set_to_angle_axis_rotation(R180 / 5, Vec3(1.0, 0.0, 0.5).normalize());
        _flowing_lights[0].position = Vec3(10, 0, 0);

        _flowing_lights[1].rotations[0].set_to_angle_axis_rotation(R90 / 25.0, Vec3(0.0, 1.0, 0.0));
        _flowing_lights[1].rotations[1].set_to_angle_axis_rotation(R30 / 10.0, Vec3(1.0, 1.0, 0.0).normalize());
        _flowing_lights[1].rotations[2].set_to_angle_axis_rotation(R180 / 2, Vec3(1.0, 0.0, 0.7).normalize());
        _flowing_lights[1].position = Vec3(0, 10, 0);

        _flowing_lights[2].rotations[0].set_to_angle_axis_rotation(R90 / 25.0, Vec3(0.5, 1.0, 0.0).normalize());
        _flowing_lights[2].rotations[1].set_to_angle_axis_rotation(R30 / 10.0, Vec3(-0.7, 0.0, 0.2).normalize());
        _flowing_lights[2].rotations[2].set_to_angle_axis_rotation(R180 / 2, Vec3(0.4, -0.2, 0.3).normalize());
        _flowing_lights[2].position = Vec3(0, 0, 10);
    }

    glClearColor(0.0, 0.0, 0.0, 1.0);

    logger()->log(LOG_INFO, "Will become current.");
}
コード例 #12
0
void HouseKitchen::Render(Vec3& position, Vec2& dimension, Vec2& texture_coordinate, Vec2& texture_dimension, bool no_floor)
{
    //			(x, y, z), (w, h),    (u, v),			, (w, h)		   ,  , reflect , front, left, back, right, frontw, leftw, backw, rightw, up, down.
    Room::Render(position, dimension, texture_coordinate, texture_dimension, 3, no_floor, true, true, false, false, false, false, false, false, false, false);

    // Draw the rest of the room here.
    // Inside of the room.
    glPushMatrix();

    // Creating the stencil before we create the scene.
    glEnable(GL_STENCIL_TEST);
    glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
    glStencilFunc(GL_ALWAYS, 1, 1);

    //// We aren't rendering to the frame, so always pass the stencil test.
    glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);

    // Disable depth testing.
    glDisable(GL_DEPTH_TEST);

    // To the floor.
    glPushMatrix();

    BindTexture(floor_dark_diamonds_, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_LINEAR);
    glTranslatef(0.0f, 0.125f, -dimension.getX());
    glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
    DrawPlane(position, dimension, texture_coordinate, texture_dimension, Vec3(0.0f, 1.0f, 0.0f), 3);

    // Back to the kitchen.
    glPopMatrix();

    glEnable(GL_DEPTH_TEST);
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

    // Turn on rendering to the frame buffer.
    glStencilFunc(GL_EQUAL, 1, 1);

    // Don't change the stencil values.
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

    // To the reflected worktop.
    glPushMatrix();

    // Making the kitchen objects upside down.
    glScalef(1.0f, -1.0f, 1.0f);

    // Placing the worktop exactly where I want it.
    glTranslatef((dimension.getX() / 2.0f) - 0.5f, 0.0f, -12.45f);
    glScalef(1.25f, 1.75f, 1.0f);
    glRotatef(270.0f, 0.0f, 1.0f, 0.0f);
    CreateWorkTop(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    glRotatef(-270.0f, 0.0f, 1.0f, 0.0f);
    glTranslatef(5.0f, 0.0f, 3.75f);
    glScalef(1.25f, 1.0f, 1.0f);
    glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    CreateWorkTop(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    // Back to the reflected kitchen.
    glPopMatrix();

    // To the reflected teapot model.
    glPushMatrix();

    glScalef(1.0f, -1.0f, 1.0f);
    glTranslatef((dimension.getX() / 2.0f) + 1.0f, 3.125f, (dimension.getX() / 2.0f) - 18.0f);
    glScalef(0.03125f, 0.03125f, 0.03125f);
    teapot_.Render();

    // Back to the reflected kitchen.
    glPopMatrix();

    // To the reflected cupboards.
    glPushMatrix();

    glScalef(1.0f, -1.0f, 1.0f);
    glTranslatef((dimension.getX() / 2.0f), 5.0f, -12.45f);
    glScalef(1.0f, 1.25f, 1.0f);
    glRotatef(270.0f, 0.0f, 1.0f, 0.0f);
    CreateCupboard(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    glTranslatef(0.0f, 0.0f, -3.0f);
    CreateCupboard(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    glRotatef(-270.0f, 0.0f, 1.0f, 0.0f);
    glTranslatef(3.0f, 0.0f, 1.0f);
    glScalef(1.5f, 1.0f, 1.0f);
    glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    CreateCupboard(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    glTranslatef(0.0f, 0.0f, -3.0f);
    CreateCupboard(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    // Back to the kitchen.
    glPopMatrix();

    // No longer need the stencil test.
    glDisable(GL_STENCIL_TEST);

    // To combine the flow and rendered reflection of the object.
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    // Lighting not really needed.
    glDisable(GL_LIGHTING);

    // To the floor.
    glPushMatrix();

    BindTexture(floor_dark_diamonds_, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_LINEAR);
    glTranslatef(0.0f, 0.125f, -dimension.getX());
    glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
    DrawPlane(position, dimension, texture_coordinate, texture_dimension, Vec3(0.0f, 1.0f, 0.0f), 3);

    // Back to the kitchen.
    glPopMatrix();

    glEnable(GL_LIGHTING);
    //glEnable(GL_DEPTH_TEST);
    glDisable(GL_BLEND);

    // To the light shade.
    glPushMatrix();

    // Places in a light shade.
    CreateLightShade(Vec3((dimension.getX() / 2.0f), -dimension.getY(), (-dimension.getX() / 2.0f)), Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    // Back to the kitchen.
    glPopMatrix();

    // To the worktop.
    glPushMatrix();

    glTranslatef((dimension.getX() / 2.0f) - 0.5f, 0.0f, -12.45f);
    glScalef(1.25f, 1.75f, 1.0f);
    glRotatef(270.0f, 0.0f, 1.0f, 0.0f);
    CreateWorkTop(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    glRotatef(-270.0f, 0.0f, 1.0f, 0.0f);
    glTranslatef(5.0f, 0.0f, 3.75f);
    glScalef(1.25f, 1.0f, 1.0f);
    glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    CreateWorkTop(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    // Back to the kitchen.
    glPopMatrix();

    // To the teapot model.
    glPushMatrix();

    glTranslatef((dimension.getX() / 2.0f) + 1.0f, 3.125f, (dimension.getX() / 2.0f) - 18.0f);
    glScalef(0.03125f, 0.03125f, 0.03125f);
    teapot_.Render();

    // Back to the kitchen.
    glPopMatrix();

    // To the cupboards.
    glPushMatrix();

    glTranslatef((dimension.getX() / 2.0f), 5.0f, -12.45f);
    glScalef(1.0f, 1.25f, 1.0f);
    glRotatef(270.0f, 0.0f, 1.0f, 0.0f);
    CreateCupboard(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    glTranslatef(0.0f, 0.0f, -3.0f);
    CreateCupboard(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    glRotatef(-270.0f, 0.0f, 1.0f, 0.0f);
    glTranslatef(3.0f, 0.0f, 1.0f);
    glScalef(1.5f, 1.0f, 1.0f);
    glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    CreateCupboard(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    glTranslatef(0.0f, 0.0f, -3.0f);
    CreateCupboard(position, Vec2(1.0f, 1.0f), texture_coordinate, texture_dimension);

    // Back to the kitchen.
    glPopMatrix();

    // Back to the original 3D scene.
    glPopMatrix();
}
コード例 #13
0
ファイル: Vec2.hpp プロジェクト: Senryoku/Physics
		inline friend bool operator<=(Vec2& V1, Vec2& V2) { return (V1.getSquaredLength() <= V2.getSquaredLength()); }
コード例 #14
0
ファイル: Util.cpp プロジェクト: daemon/monkeybot
Direction GetRotationDirection(Vec2 heading, Vec2 target) {
    Vec2 perp = heading.Perpendicular();
    target.Normalize();
    return perp.Dot(target) >= 0.0 ? Direction::Right : Direction::Left;
}
コード例 #15
0
ファイル: opivm_switch.cpp プロジェクト: bcorfman/opioid2d
	void ExecFrame::execute_ops(int num)
	{
		int opcode, param;
		floatval fa,fb;
		int ia, ib, ifor, iparam, ijmp;
		//char opfor,pfor;
		Vec2 *v1,*v2;
		Vec2 v;
		VMInterface* obj;
		ExecFrame* frame;
		CodeObj* cobj;
		
		while(num-- != 0)
		{
			opcode = (int)code->code[iptr++];
			param = (int)code->code[iptr++];
			
			//std::cout << opcode << ':' << param << std::endl;
			
			switch(opcode) {
				case OPC_EXIT:
					iptr-=2;
					return;
				case OPC_VMCALL:
					cobj = (CodeObj*)popp();
					ia = popi();
					frame = new ExecFrame(cobj);
					frame->restart();
					if (param > 0) move(param, frame);
					frame->execute();
					if (ia > 0) frame->move(ia, this);
					delete frame;
					break;
			    case OPC_CONSTF:
			    	pushf(code->conarray_f[param]);
			        break;
			    case OPC_CONSTI:
			        pushi(code->conarray_i[param]);
			        break;
			    case OPC_CONSTV:
			    	pushv(code->conarray_v[param]);
			        break;
			    case OPC_CONSTP:
			    	pushp(code->conarray_p[param]);
			    	break;
			    case OPC_PUSHVARF:
			        pushf(vararray_f[param]);
			        break;
			    case OPC_PUSHVARI:
			        pushi(vararray_i[param]);
			        break;
			    case OPC_PUSHVARV:
			        pushv(vararray_v[param]);
			        break;
			    case OPC_PUSHVARP:
			        pushp(vararray_p[param]);
			        break;
				case OPC_POP:
					top -= param;
					break;
			    case OPC_SETVARF:
			        vararray_f[param] = popf();
			        break;
			    case OPC_SETVARI:
			        vararray_i[param] = popi();
			        break;
			    case OPC_SETVARV:
			    	fb = popf();
			    	fa = popf();
			        vararray_v[param].set(fa,fb);
			        break;
			    case OPC_SETVARP:
			        vararray_p[param] = popp();
			        break;
			    case OPC_GETPROP:
			        obj = (VMInterface*)popp();
			        obj->VM_GetProp(this, param);
			        break;
			    case OPC_SETPROP:
			        obj = (VMInterface*)popp();
			        obj->VM_SetProp(this, param);
			        break;
			    case OPC_METCALL:
			        obj = (VMInterface*)popp();
			        obj->VM_MetCall(this, param);
			        break;
			    case OPC_GETPROPV:
			        v1 = (Vec2*)popp();
			        v1->VM_GetProp(this, param);
			        break;
			    case OPC_SETPROPV:		    
			        v1 = (Vec2*)popp();
			        v1->VM_SetProp(this, param);
			        break;
			    case OPC_METCALLV:
			        v1 = (Vec2*)popp();
			        v1->VM_MetCall(this, param);
			        break;
			    case OPC_JUMP:
			        iptr += param*2;
			        break;
			    case OPC_IFJUMP:
			        ia = popi();
			        if (ia == 0) iptr += param*2;
			        break;
			    case OPC_INITFOR:
			        ib = popi();
			        ia = popi();
			        ++iptr;
			        iparam = code->code[iptr++];
			        ijmp = iptr;
			        for(ifor=ia;ifor<ib;++ifor)
			        {
			        	iptr = ijmp;
			        	vararray_i[param] = ifor;
			        	execute_ops(iparam);
			        	/*for(iptr=ijmp;iptr<ijmp+iparam*2;++iptr)
			        	{
					        opfor = code->code[iptr];
					        pfor = code->code[++iptr];
					        if (opfor == OPC_EXIT)
					        {
					        	--iptr;
					        	return;
					        }
			        		execute_op(opfor, pfor);
			        	}*/
			        	 
			        }
			        break;
			    case OPC_LOOP:
			        ; // TODO
			        break;
			    case OPC_I2F:
			    //  this will break is floatval uses doubles !!
			    /*    ia = *((int*)top);
			        *((floatval*)top) = (float)ia;*/
			        ia = popi();
			        pushf((floatval)ia);		        
			        break;
			    case OPC_F2I:
			        /*fa = *((floatval*)top);
			        *((int*)top) = (int)fa;*/
			        fa = popf();
			        pushi((int)fa);		        
			        break;
			    case OPC_VEC2P:
			    	fb = popf();
			    	fa = popf();
			    	v1 = vectemp + (vecidx % 5);
			    	++vecidx;
			    	v1->set(fa,fb);
			    	pushp(v1);
			    	break;
			    case OPC_P2VEC:
			    	v1 = popv();
			    	pushv(*v1);
			    	break;
			    case OPC_LASTVEC:
			    	v1 = vectemp + ((vecidx-1)%5);
			    	pushv(*v1);
			    	break;
			        
		// --------------------------------------------------
		// -------------------- OPERATORS -------------------
		// --------------------------------------------------		        
			        
			    case OPC_OP_ADDFF:
			    	fa = popf();
			        *(((floatval*)top)-1) += fa;
			        break;
			    case OPC_OP_ADDII:
			    	ia = popi();
			        *(((int*)top)-1) += ia;
			        break;
			    case OPC_OP_ADDVV:
			        v2 = popv();
			        v1 = popv();
			        v.set(*v1);
			        v.add(*v2);
			        pushv(v);
			        break;
			    case OPC_OP_ANDBB:
			        ib = popi();
			        ia = popi();
			        pushi(ia & ib);
			        break;
			    case OPC_OP_DIVFF:
			    	fa = popf();
			        *(((floatval*)top)-1) /= fa;
			        break;
			    case OPC_OP_DIVII:
			    	ia = popi();
			        *(((int*)top)-1) /= ia;
			        break;
			    case OPC_OP_DIVVF:
			        fa = popf();
			        v1 = (Vec2*)popp();
			        v.set(*v1);
			        v.div(fa);
			        pushv(v);
			        break;
			    case OPC_OP_EQFF:
			        fb = popf();
			        fa = popf();
			        pushi((int)(fa == fb));
			        break;
			    case OPC_OP_EQII:
			        ib = popi();
			        ia = popi();
			        pushi((int)(ia == ib));
			        break;
			    case OPC_OP_EQVV:
			        v2 = popv();
			        v1 = popv();
			        pushi((int)(ia == ib));
			        break;
			    case OPC_OP_GEFF:
			        fb = popf();
			        fa = popf();
			        pushi((int)(fa >= fb));
			        break;
			    case OPC_OP_GEII:
			        ib = popi();
			        ia = popi();
			        pushi((int)(ia >= ib));
			        break;
			    case OPC_OP_GTFF:
			        fb = popf();
			        fa = popf();
			        pushi((int)(fa > fb));
			        break;
			    case OPC_OP_GTII:
			        ib = popi();
			        ia = popi();
			        pushi((int)(ia > ib));
			        break;
			    case OPC_OP_LEFF:
			        fb = popf();
			        fa = popf();
			        pushi((int)(fa <= fb));
			        break;
			    case OPC_OP_LEII:
			        ib = popi();
			        ia = popi();
			        pushi((int)(ia <= ib));
			        break;
			    case OPC_OP_LTFF:
			        fb = popf();
			        fa = popf();
			        pushi((int)(fa < fb));
			        break;
			    case OPC_OP_LTII:
			        ib = popi();
			        ia = popi();
			        pushi((int)(ia < ib));
			        break;
			    case OPC_OP_MULFF:
			    	fa = popf();
			        *(((floatval*)top)-1) *= fa;
			        break;
			    case OPC_OP_MULII:
			    	ia = popi();
			        *(((int*)top)-1) *= ia;
			        break;
			    case OPC_OP_MULVF:
			        fa = popf();
			        v1 = popv();
			        v.set(*v1);
			        v.mul(fa);
			        pushv(v);
			        break;
			    case OPC_OP_NEFF:
			        fb = popf();
			        fa = popf();
			        pushi((int)(fa != fb));
			        break;
			    case OPC_OP_NEGF:
			        *(((floatval*)top)-1) = -(*((floatval*)top));
			        break;
			    case OPC_OP_NEGI:
			        *(((int*)top)-1) = -(*((int*)top));
			        break;
			    case OPC_OP_NEGV:
			        v1 = popv();
			        v.set(-v1->x, -v1->y);
			        pushv(v);
			        break;
			    case OPC_OP_NEII:
			        ib = popi();
			        ia = popi();
			        pushi((int)(ia != ib));
			        break;
			    case OPC_OP_NEVV:
			        v2 = popv();
			        v1 = popv();
			        pushi((int)(ia != ib));
			        break;
			    case OPC_OP_NOTBB:
			        ; // TODO
			        break;
			    case OPC_OP_ORBB:
			        ; // TODO
			        break;
			    case OPC_OP_SUBFF:
			    	fa = popf();
			        *(((floatval*)top)-1) -= fa;
			        break;
			    case OPC_OP_SUBII:
			    	ia = popi();
			        *(((int*)top)-1) -= ia;
			        break;
			    case OPC_OP_SUBVV:
			        v2 = (Vec2*)popp();
			        v1 = (Vec2*)popp();
			        v.set(*v1);
			        v.sub(*v2);
			        pushv(v);
			        break;
			    case OPC_OP_XORBB:
			        ; // TODO
			        break;
			}
		}
	}
コード例 #16
0
ファイル: nn_widget.hpp プロジェクト: limebreaker/KONAHEN
 void setSize(const float w, const float h) { size_.set(w, h); }
コード例 #17
0
void RationalBilinearInverter::solve(
	Vec2 const & p,
	Vec4 const & p00, Vec4 const & p10,
	Vec4 const & p01, Vec4 const & p11
)
{
	double m[4][6] = {
		{ p00.x(), p10.x(), p01.x(), -p.x(), 0, -p11.x() },
		{ p00.y(), p10.y(), p01.y(), -p.y(), 0, -p11.y() },
		{ p00.z(), p10.z(), p01.z(),     -1, 0, -p11.z() },
		{ p00.w(), p10.w(), p01.w(),      0, 1, -p11.w() }
	};

	for (int j = 0; j < 4; ++j) {
		double a = 0.0;

		std::for_each(m[j], m[j + 1], [&] (double & f) { a = (std::max)(a, fabs(f)); });
		std::for_each(m[j], m[j + 1], [&] (double & f) { f /= a; });
	}

	for (int j = 0; j < 4; ++j) {
		int pivot_row = j; double pivot_value = fabsf(m[j][j]);

		for (int k = j + 1; k < 4; ++k) {
			auto t = fabsf(m[k][j]);
			if (t > pivot_value) {
				pivot_value = t;
				pivot_row = k;
			}
		}

		if (pivot_row != j) { swap(m[j], m[pivot_row]); }

		double * row = m[j] + j, * end = m[j + 1];
		normalize_front(row, end);

		for (int k = j + 1; k < 4; ++k) {
			scale_and_subtract_row(m[k] + j, m[k + 1], m[k][j], row);
		}
	}

	for (int i = 3; i > 0; --i) {
		for (int j = i - 1; j >= 0; --j) {
			scale_and_subtract_row(m[j] + i, m[j + 1], m[j][i], m[i] + i);
		}
	}

    double quad_a = m[0][5] - m[1][5] * m[2][5],
           quad_b = m[0][4] - m[1][4] * m[2][5] - m[1][5] * m[2][4],
           quad_c = - m[1][4] * m[2][4];

    if (-1e-3 < quad_a && quad_a < 1e-3) { quad_a = 0.; }
    if (-1e-3 < quad_b && quad_b < 1e-3) { quad_b = 0.; }
    if (-1e-3 < quad_c && quad_c < 1e-3) { quad_c = 0.; }

	QuadraticSolver<double> q(quad_a, quad_b, quad_c);

	for (auto it = q.begin(); it != q.end(); ++it) {
		double D = *it,
			alpha = m[3][4] + m[3][5] * D;

		if (alpha < 1.0 - 1e-3) { continue; }

		double A = m[0][4] + m[0][5] * D,
			B = m[1][4] + m[1][5] * D,
			C = m[2][4] + m[2][5] * D,
			d = A + B + C + D;
		
		if (!d || d != d) { continue; }

		double r = 1.0 / d,
			u = (B + D) * r,
			v = (C + D) * r;

		if (u < -1e-3 || u >= 1.0-1e-3) { continue; }
		if (v < -1e-3 || v >= 1.0-1e-3) { continue; }

		solutions_[size_++] = std::make_pair(alpha, Vec2(u, v));
	}
	
	if (size_ == 2 && solutions_[0].first > solutions_[1].first)
		{ std::swap(solutions_[0], solutions_[1]); }
}
コード例 #18
0
ファイル: nn_widget.hpp プロジェクト: limebreaker/KONAHEN
 void setUv(const float u, const float v) { uv_.set(u, v); }
コード例 #19
0
void ParticleSystemQuad::updateParticleQuads()
{
    if (_particleCount <= 0) {
        return;
    }

    Vec2 currentPosition;
    if (_positionType == PositionType::FREE)
    {
        currentPosition = this->convertToWorldSpace(Vec2::ZERO);
    }
    else if (_positionType == PositionType::RELATIVE)
    {
        currentPosition = _position;
    }

    V3F_C4B_T2F_Quad *startQuad;
    Vec2 pos = Vec2::ZERO;
    if (_batchNode)
    {
        V3F_C4B_T2F_Quad *batchQuads = _batchNode->getTextureAtlas()->getQuads();
        startQuad = &(batchQuads[_atlasIndex]);
        pos = _position;
    }
    else
    {
        startQuad = &(_quads[0]);
    }

    if( _positionType == PositionType::FREE )
    {
        Vec3 p1(currentPosition.x, currentPosition.y, 0);
        Mat4 worldToNodeTM = getWorldToNodeTransform();
        worldToNodeTM.transformPoint(&p1);
        Vec3 p2;
        Vec2 newPos;
        float* startX = _particleData.startPosX;
        float* startY = _particleData.startPosY;
        float* x = _particleData.posx;
        float* y = _particleData.posy;
        float* s = _particleData.size;
        float* r = _particleData.rotation;
        V3F_C4B_T2F_Quad* quadStart = startQuad;
        for (int i = 0 ; i < _particleCount; ++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r)
        {
            p2.set(*startX, *startY, 0);
            worldToNodeTM.transformPoint(&p2);
            newPos.set(*x,*y);
            p2 = p1 - p2;
            newPos.x -= p2.x - pos.x;
            newPos.y -= p2.y - pos.y;
            updatePosWithParticle(quadStart, newPos, *s, *r);
        }
    }
    else if( _positionType == PositionType::RELATIVE )
    {
        Vec2 newPos;
        float* startX = _particleData.startPosX;
        float* startY = _particleData.startPosY;
        float* x = _particleData.posx;
        float* y = _particleData.posy;
        float* s = _particleData.size;
        float* r = _particleData.rotation;
        V3F_C4B_T2F_Quad* quadStart = startQuad;
        for (int i = 0 ; i < _particleCount; ++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r)
        {
            newPos.set(*x, *y);
            newPos.x = *x - (currentPosition.x - *startX);
            newPos.y = *y - (currentPosition.y - *startY);
            newPos += pos;
            updatePosWithParticle(quadStart, newPos, *s, *r);
        }
    }
    else
    {
        Vec2 newPos;
        float* startX = _particleData.startPosX;
        float* startY = _particleData.startPosY;
        float* x = _particleData.posx;
        float* y = _particleData.posy;
        float* s = _particleData.size;
        float* r = _particleData.rotation;
        V3F_C4B_T2F_Quad* quadStart = startQuad;
        for (int i = 0 ; i < _particleCount; ++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r)
        {
            newPos.set(*x + pos.x, *y + pos.y);
            updatePosWithParticle(quadStart, newPos, *s, *r);
        }
    }

    //set color
    if(_opacityModifyRGB)
    {
        V3F_C4B_T2F_Quad* quad = startQuad;
        float* r = _particleData.colorR;
        float* g = _particleData.colorG;
        float* b = _particleData.colorB;
        float* a = _particleData.colorA;

        for (int i = 0; i < _particleCount; ++i,++quad,++r,++g,++b,++a)
        {
            GLubyte colorR = *r * *a * 255;
            GLubyte colorG = *g * *a * 255;
            GLubyte colorB = *b * *a * 255;
            GLubyte colorA = *a * 255;
            quad->bl.colors.set(colorR, colorG, colorB, colorA);
            quad->br.colors.set(colorR, colorG, colorB, colorA);
            quad->tl.colors.set(colorR, colorG, colorB, colorA);
            quad->tr.colors.set(colorR, colorG, colorB, colorA);
        }
    }
    else
    {
        V3F_C4B_T2F_Quad* quad = startQuad;
        float* r = _particleData.colorR;
        float* g = _particleData.colorG;
        float* b = _particleData.colorB;
        float* a = _particleData.colorA;

        for (int i = 0; i < _particleCount; ++i,++quad,++r,++g,++b,++a)
        {
            GLubyte colorR = *r * 255;
            GLubyte colorG = *g * 255;
            GLubyte colorB = *b * 255;
            GLubyte colorA = *a * 255;
            quad->bl.colors.set(colorR, colorG, colorB, colorA);
            quad->br.colors.set(colorR, colorG, colorB, colorA);
            quad->tl.colors.set(colorR, colorG, colorB, colorA);
            quad->tr.colors.set(colorR, colorG, colorB, colorA);
        }
    }
}
コード例 #20
0
ファイル: nn_widget.hpp プロジェクト: limebreaker/KONAHEN
 void setCenter(const float x, const float y) { center_.set(x, y); }
コード例 #21
0
ファイル: weapon.cpp プロジェクト: Chonger8888/project
void AutoWeapon::SeachTarget( float dt )
{
	//先按距离排序
	GameData::getInstance()->SortByDis();

	std::list<PhysicsUnit*> Planelist = GameData::getInstance()->getEnemyPlaneVec();
	std::list<PhysicsUnit*>::iterator it = Planelist.begin();
	Point targetPos = Vec2(0,0);
	if (Planelist.empty())
	{
		this->setRotation(0);
		setBullstType(BulletType::Self_Default);
		return;
	}

	bool isFound = false;
	if (m_isLeft)
	{
		for (it; it != Planelist.end(); it++)
		{
			targetPos = (*it)->getPosition();
			if (targetPos.x <= m_winSize.width*0.5 && targetPos.y > m_winSize.height*0.15 + 100)
			{
				isFound = true;
				break;
			}
		}
	}
	else
	{
		for (it; it != Planelist.end(); it++)
		{
			targetPos = (*it)->getPosition();
			if (targetPos.x >= m_winSize.width*0.5 && targetPos.y > m_winSize.height*0.15 + 100)
			{
				isFound = true;
				break;
			}
		}
	}

	//根据目标位置和自己的位置,计算需要旋转的角度
	Point myPos = this->convertToWorldSpaceAR(Point::ZERO);

	Vec2 newVec = targetPos - myPos;
	float r = newVec.getAngle() * Pi2Angle;
	r = 90 - r;

	if (r > 60)
	{
		r = 60;
	}
	else if(r < -60)
	{
		r = -60;
	}
	if (!isFound)
	{
		this->setRotation(0);
	}
	else
	{
		this->setRotation(r);
	}
	setBullstType(BulletType::Self_Default);
}
コード例 #22
0
ファイル: nn_widget.hpp プロジェクト: limebreaker/KONAHEN
 void setScale(const float w, const float h) { scale_.set(w, h); }
コード例 #23
0
ファイル: vertexarray.cpp プロジェクト: HaohaoLau/vdrift
void VertexArray::SetTo2DBox(float x, float y, float w, float h, float marginwidth, float marginheight, float clipx)
{
	const unsigned int quads = 9;
	float vcorners[12*quads];
	float uvs[8*quads];
	int bfaces[6*quads];

	//y1 = 1.0 - y1;
	//y2 = 1.0 - y2;

	Vec2 corner1;
	Vec2 corner2;
	Vec2 dim;
	dim.Set(w,h);
	Vec2 center;
	center.Set(x,y);
	corner1 = center - dim*0.5;
	corner2 = center + dim*0.5;
	Vec2 margin;
	margin.Set(marginwidth, marginheight);

	float lxmax = std::max((corner1-margin)[0],std::min(clipx,corner1[0]));
	float cxmax = std::max(corner1[0],std::min(clipx,corner2[0]));
	float rxmax = std::max(corner2[0],std::min(clipx,(corner2+margin)[0]));
	float lumax = (lxmax-(corner1-margin)[0])/(corner1[0]-(corner1-margin)[0])*0.5;
	float rumax = (rxmax-corner2[0])/((corner2+margin)[0]-corner2[0])*0.5+0.5;

	//upper left
	SetVertexData2DQuad((corner1-margin)[0],(corner1-margin)[1],lxmax,corner1[1],
			    0,0,lumax,0.5, vcorners,uvs,bfaces);

	//upper center
	SetVertexData2DQuad(corner1[0],(corner1-margin)[1],cxmax,corner1[1],
			     0.5,0,0.5,0.5,
			     &(vcorners[12*1]),&(uvs[8*1]),&(bfaces[6*1]),4*1);

	//upper right
	SetVertexData2DQuad(corner2[0],(corner1-margin)[1],rxmax,corner1[1],
			    0.5,0,rumax,0.5,
			    &(vcorners[12*2]),&(uvs[8*2]),&(bfaces[6*2]),4*2);

	//center left
	SetVertexData2DQuad((corner1-margin)[0],corner1[1],lxmax,corner2[1],
			    0,0.5,lumax,0.5,
			    &(vcorners[12*3]),&(uvs[8*3]),&(bfaces[6*3]),4*3);

	//center center
	SetVertexData2DQuad(corner1[0],corner1[1],cxmax,corner2[1],
			    0.5,0.5,0.5,0.5,
			    &(vcorners[12*4]),&(uvs[8*4]),&(bfaces[6*4]),4*4);

	//center right
	SetVertexData2DQuad(corner2[0],corner1[1],rxmax,corner2[1],
			    0.5,0.5,rumax,0.5,
			    &(vcorners[12*5]),&(uvs[8*5]),&(bfaces[6*5]),4*5);

	//lower left
	SetVertexData2DQuad((corner1-margin)[0],corner2[1],lxmax,(corner2+margin)[1],
			    0,0.5,lumax,1,
			    &(vcorners[12*6]),&(uvs[8*6]),&(bfaces[6*6]),4*6);

	//lower center
	SetVertexData2DQuad(corner1[0],corner2[1],cxmax,(corner2+margin)[1],
			    0.5,0.5,0.5,1,
			    &(vcorners[12*7]),&(uvs[8*7]),&(bfaces[6*7]),4*7);

	//lower right
	SetVertexData2DQuad(corner2[0],corner2[1],rxmax,(corner2+margin)[1],
			    0.5,0.5,rumax,1,
			    &(vcorners[12*8]),&(uvs[8*8]),&(bfaces[6*8]),4*8);

	SetFaces(bfaces, 6*quads);
	SetVertices(vcorners, 12*quads);
	SetTexCoordSets(1);
	SetTexCoords(0, uvs, 8*quads);
}
コード例 #24
0
ファイル: nn_widget.hpp プロジェクト: limebreaker/KONAHEN
  Widget(picojson::object& param, const TexMng::tex_ptr texture, const Vec2<int> *size, const float *y_bottom) :
    scale_(1,1),
    blend_mode_(),
    texture_(texture),
    layout_(LAYOUT_CENTER),
    id_(),
    window_size_(size),
    y_bottom_(y_bottom)
  {
    
    // FIXME: 以下、初期化リストで済ませたい
    {
      picojson::array& array = param["pos"].get<picojson::array>();
      pos_.set(array[0].get<double>(), array[1].get<double>());
      pos_orig_ = pos_;
    }
    {
      picojson::array& array = param["size"].get<picojson::array>();
      size_.set(array[0].get<double>(), array[1].get<double>());
      size_orig_ = size_;
    }
    {
      picojson::array& array = param["uv"].get<picojson::array>();
      uv_.set(array[0].get<double>(), array[1].get<double>());
      uv_orig_ = uv_;
    }
    {
      picojson::array& array = param["col"].get<picojson::array>();
      col_.set(array[0].get<double>(), array[1].get<double>(), array[2].get<double>(), array[3].get<double>());
      col_orig_ = col_;
    }
    {
      auto_center_ = !param["center"].is<picojson::array>();
      if (!auto_center_)
      {
        picojson::array& array = param["center"].get<picojson::array>();
        center_.set(array[0].get<double>(), array[1].get<double>());
        center_orig_ = center_;
      }
    }
    if (param["scale"].is<picojson::array>())
    {
      picojson::array& array = param["scale"].get<picojson::array>();
      scale_.set(array[0].get<double>(), array[1].get<double>());
    }

    if (param["ofs_size"].is<picojson::array>())
    {
      // UIで使う時のサイズに対するオフセット
      picojson::array& array = param["ofs_size"].get<picojson::array>();
      ofs_size_.set(array[0].get<double>(), array[1].get<double>());
    }

    if (param["x_layout"].is<double>())
    {
      layout_ |= (param["x_layout"].get<double>() > 0.0) ? LAYOUT_RIGHT : LAYOUT_LEFT;
    }
    if (param["y_layout"].is<double>())
    {
      layout_ |= (param["y_layout"].get<double>() > 0.0) ? LAYOUT_BOTTOM : LAYOUT_TOP;
    }
    if (param["id"].is<double>())
    {
      id_ = param["id"].get<double>();
    }
  }
コード例 #25
0
ファイル: level.cpp プロジェクト: Eldhelion/keeperrl
bool Level::isWithinVision(Vec2 from, Vec2 to, VisionId v) const {
  return Vision::get(v)->isNightVision() || from.distD(to) <= darkViewRadius || getLight(to) > 0.3;
}
コード例 #26
0
	void PhysicsObject::AddForce(Vec2 Force){
		Vec2 Arm;
		Arm.SetValue(0,0);
		AddForce(Force,Arm);
	}
コード例 #27
0
void PiecesLayer::dealCollision( float dur ){
	for (b2ContactEdge *c = monsterBody->GetContactList();c;c = c->next){
		b2Contact *contact = c->contact;
		b2Body *bodyA = contact->GetFixtureA()->GetBody();
		b2Body *bodyB = contact->GetFixtureB()->GetBody();


		b2Body *collidedBody = (bodyA == monsterBody)?bodyB:bodyA;
		Sprite* sp = (Sprite*)collidedBody->GetUserData();

		if (sp && sp->getName() == "paddle"&& contact->IsTouching() == true)
		{
			Vec2 vec1 = paddleNode->getPosition();
			Vec2 vec2 = paddleNode->convertToWorldSpace(sp->getPosition());

			 drawNode->drawSegment(vec1, vec2, 3.0f, Color4F(1, 1, 1, 1));

			Vec2 normalVec = vec1 - vec2;
			Vec2 monsterToCentreVec = paddleNode->getPosition() - monster->getPosition();
			//if the normalVec is pointing to the centre
			dirVec = normalVec.dot(monsterToCentreVec) > 0? normalVec:normalVec*(-1);

			dirVec.normalize();
			float m_velocity = sqrtf(monsterBody->GetLinearVelocity().x * monsterBody->GetLinearVelocity().x +
				monsterBody->GetLinearVelocity().y * monsterBody->GetLinearVelocity().y);

			forceVec.x = dirVec.x * 2 * monsterBody->GetMass() * m_velocity;
			forceVec.y = dirVec.y * 2 * monsterBody->GetMass() * m_velocity;

			//forceVec.Normalize();

			monsterBody->ApplyLinearImpulse(forceVec, monsterBody->GetWorldCenter(), true);
			oldVec = b2Vec2(monsterBody->GetLinearVelocity().x, monsterBody->GetLinearVelocity().y);
			oldVec.Normalize();
			monsterBody->SetLinearVelocity(b2Vec2(oldVec.x * 10, oldVec.y * 10));

			//sp->setName("deleting paddle");
			//Paddles[sp->getTag()]->scheduleOnce(schedule_selector(Paddle::dealPaddleDeletion),0.05f);
			Paddles[sp->getTag()]->beginDeletion();
			return;
		}

		
		if (sp && (sp->getName() == "brick" || sp->getName() == "wall") && contact->IsTouching() == true) {

			brickForceVec.x =monsterBody->GetPosition().x - collidedBody->GetPosition().x;
			brickForceVec.y =monsterBody->GetPosition().y - collidedBody->GetPosition().y;
			brickForceVec.Normalize();
			monsterBody->ApplyLinearImpulse(brickForceVec, monsterBody->GetWorldCenter(), true);
			oldVec = b2Vec2(monsterBody->GetLinearVelocity().x, monsterBody->GetLinearVelocity().y);
			oldVec.Normalize();
			monsterBody->SetLinearVelocity(b2Vec2(oldVec.x * 10, oldVec.y * 10));

			if (sp->getName() == "brick")
			{
				for (int i = 0; collidedBodies[i] == NULL; i++) 
				{
					collidedBodies[i] = collidedBody;
					break;
				}
				this->scheduleOnce(schedule_selector(PiecesLayer::dealDeletion),0.05f);
			}

		}
	}

}
コード例 #28
0
	void PhysicsObject::AddForce(double x,double y){
		Vec2 Force;
		Force.SetValue(x,y);
		AddForce(Force);
	}
コード例 #29
0
ファイル: vec2.cpp プロジェクト: icedmetal57/LD33
		Vec2 operator+(Vec2 left, const Vec2& right)
		{
			return left.add(right);
		}
コード例 #30
0
void CHUD::UpdateMissionObjectiveIcon(EntityId objective, int friendly, FlashOnScreenIcon iconType, bool forceNoOffset, Vec3 rotationTarget)
{
	IEntity *pObjectiveEntity = GetISystem()->GetIEntitySystem()->GetEntity(objective);
	if(!pObjectiveEntity) return;

	AABB box;
	pObjectiveEntity->GetWorldBounds(box);
	Vec3 vWorldPos = Vec3(0,0,0);

	SEntitySlotInfo info;
	int slotCount = pObjectiveEntity->GetSlotCount();
	for(int i=0; i<slotCount; ++i)
	{
		if (pObjectiveEntity->GetSlotInfo(i, info))
		{
			if (info.pCharacter)
			{
				int16 id = info.pCharacter->GetISkeletonPose()->GetJointIDByName("objectiveicon");
				if (id >= 0)
				{
					//vPos = pCharacter->GetISkeleton()->GetHelperPos(helper);
					vWorldPos = info.pCharacter->GetISkeletonPose()->GetAbsJointByID(id).t;
					if (!vWorldPos.IsZero())
					{
						vWorldPos = pObjectiveEntity->GetSlotWorldTM(i).TransformPoint(vWorldPos);
						break;
					}
				}
			}
		}
	}
	if(vWorldPos == Vec3(0,0,0))
		vWorldPos = pObjectiveEntity->GetWorldPos();

	if(!forceNoOffset)
		vWorldPos.z += 2.0f;

	Vec3 vEntityScreenSpace;
	m_pRenderer->ProjectToScreen(	vWorldPos.x, vWorldPos.y,	vWorldPos.z, &vEntityScreenSpace.x, &vEntityScreenSpace.y, &vEntityScreenSpace.z);
	Vec3 vEntityTargetSpace;
	bool useTarget = false;
	if(!rotationTarget.IsZero())
	{
		m_pRenderer->ProjectToScreen(	rotationTarget.x, rotationTarget.y,	rotationTarget.z, &vEntityTargetSpace.x, &vEntityTargetSpace.y, &vEntityTargetSpace.z);
		useTarget = true;
	}

	CActor *pActor = (CActor*)(gEnv->pGame->GetIGameFramework()->GetClientActor());
	bool bBack = false;
	if (IMovementController *pMV = pActor->GetMovementController())
	{
		SMovementState state;
		pMV->GetMovementState(state);
		Vec3 vLook = state.eyeDirection;
		Vec3 vDir = vWorldPos - pActor->GetEntity()->GetWorldPos();
		float fDot = vLook.Dot(vDir);
		if(fDot<0.0f)
			bBack = true;
	}

	bool bLeft(false), bRight(false), bTop(false), bBottom(false);

	if(vEntityScreenSpace.z > 1.0f && bBack)
	{
		Vec2 vCenter(50.0f, 50.0f);
		Vec2 vTarget(-vEntityScreenSpace.x, -vEntityScreenSpace.y);
		Vec2 vScreenDir = vTarget - vCenter;
		vScreenDir = vCenter + (100.0f * vScreenDir.NormalizeSafe());
		vEntityScreenSpace.y = vScreenDir.y;
		vEntityScreenSpace.x = vScreenDir.x;
		useTarget = false;
	}
	if(vEntityScreenSpace.x < 2.0f)
	{
		bLeft = true;
		vEntityScreenSpace.x = 2.0f;
		useTarget = false;
	}
	if(vEntityScreenSpace.x > 98.0f)
	{
		bRight = true;
		vEntityScreenSpace.x = 98.0f;
		useTarget = false;
	}
	if(vEntityScreenSpace.y < 2.01f)
	{
		bTop = true;
		vEntityScreenSpace.y = 2.0f;
		useTarget = false;
	}
	if(vEntityScreenSpace.y > 97.99f)
	{
		bBottom = true;
		vEntityScreenSpace.y = 98.0f;
		useTarget = false;
	}

	float fScaleX = 0.0f;
	float fScaleY = 0.0f;
	float fHalfUselessSize = 0.0f;
	GetProjectionScale(&m_animMissionObjective,&fScaleX,&fScaleY,&fHalfUselessSize);

	if(bLeft && bTop)
	{
		iconType = eOS_TopLeft;
	}
	else if(bLeft && bBottom)
	{
		iconType = eOS_BottomLeft;
	}
	else if(bRight && bTop)
	{
		iconType = eOS_TopRight;
	}
	else if(bRight && bBottom)
	{
		iconType = eOS_BottomRight;
	}
	else if(bLeft)
	{
		iconType = eOS_Left;
	}
	else if(bRight)
	{
		iconType = eOS_Right;
	}
	else if(bTop)
	{
		iconType = eOS_Top;
	}
	else if(bBottom)
	{
		iconType = eOS_Bottom;
	}

	float rotation = 0.0f;
	if(useTarget)
	{
		float diffX = (vEntityScreenSpace.x*fScaleX+fHalfUselessSize+16.0f) - (vEntityTargetSpace.x*fScaleX+fHalfUselessSize+16.0f);
		float diffY = (vEntityScreenSpace.y*fScaleY) - (vEntityTargetSpace.y*fScaleY);
		Vec2 dir(diffX, diffY);
		dir.NormalizeSafe();

		float fAngle;
		if(dir.y < 0)
		{
			fAngle = RAD2DEG(acos_tpl(dir.x));
		}
		else
		{
			fAngle = RAD2DEG(gf_PI2-acos_tpl(dir.x));
		}
		rotation = fAngle - 90.0f;
	}

	int		iMinDist = g_pGameCVars->hud_onScreenNearDistance;
	int		iMaxDist = g_pGameCVars->hud_onScreenFarDistance;
	float	fMinSize = g_pGameCVars->hud_onScreenNearSize;
	float	fMaxSize = g_pGameCVars->hud_onScreenFarSize;

	CActor *pPlayerActor = static_cast<CActor *>(gEnv->pGame->GetIGameFramework()->GetClientActor());

	float	fDist = (vWorldPos-pPlayerActor->GetEntity()->GetWorldPos()).len();
	float fSize = 1.0;
	if(fDist<=iMinDist)
	{
		fSize = fMinSize;
	}
	else if(fDist>=iMaxDist)
	{
		fSize = fMaxSize;
	}
	else if(iMaxDist>iMinDist)
	{
		float fA = ((float)iMaxDist - fDist);
		float fB = (float)(iMaxDist - iMinDist);
		float fC = (fMinSize - fMaxSize);
		fSize = ((fA / fB) * fC) + fMaxSize;
	}

	float centerX = 50.0;
	float centerY = 50.0;

	m_missionObjectiveNumEntries += FillUpMOArray(&m_missionObjectiveValues, objective, vEntityScreenSpace.x*fScaleX+fHalfUselessSize+16.0f, vEntityScreenSpace.y*fScaleY, iconType, friendly, (int)fDist, fSize*fSize, -rotation);
	bool nearCenter = (pow(centerX-vEntityScreenSpace.x+1.5f,2.0f)+pow(centerY-vEntityScreenSpace.y+2.5f,2.0f))<16.0f;
	if(nearCenter && (gEnv->bMultiplayer || m_pHUDScopes->IsBinocularsShown()))
	{
		m_objectiveNearCenter = objective;
	}
}