Exemple #1
0
Matrix4 Matrix4::ChangeOfBasis(const Vec3f &Source0, const Vec3f &Source1, const Vec3f &Source2, const Vec3f &SourceOrigin, 
                               const Vec3f &Target0, const Vec3f &Target1, const Vec3f &Target2, const Vec3f &TargetOrigin)
{
    Matrix4 RotationComponent = Matrix4(Source0, Source1, Source2).Inverse() * Matrix4(Target0, Target1, Target2);
    //Matrix4 TranslationComponent = Translation(TargetOrigin - SourceOrigin);
    Matrix4 Result = Translation(-SourceOrigin) * RotationComponent * Translation(TargetOrigin);
    return Result;
    //return Translation(TargetOrigin - SourceOrigin);
}
Exemple #2
0
bool World::resetTet(TetrominoType* type) {
    Vec2d* newCoords = new Vec2d(spawnPoint);
    if (nextTet == nullptr) {
        TetrominoType* randomType = typeFactory->getRandomType();
        int spawnOffset = randomType->getHeight();
        newCoords->setY(newCoords->getY() - spawnOffset);
        activeTet = tetFactory->getTetromino(randomType, newCoords)->withDirection(defaultDirection);
    } else {
        delete activeTet;
        activeTet = nextTet;
    }

    type = typeFactory->getRandomType();
    int spawnOffset = type->getHeight();
    delete newCoords;

    newCoords = new Vec2d(spawnPoint);
    if (mode == INFINITY_MODE) newCoords->setX((rand() % 8) + 1);
    newCoords->setY(newCoords->getY() - spawnOffset);
    nextTet = tetFactory->getTetromino(type, newCoords)->withDirection(defaultDirection);
    
    Translation translation = Translation(activeTet->getCoords());
    
    vector<Quad*>* resetQuads = translation.transform(activeTet->getQuads());
    bool success = !heap->collidesWithQuads(resetQuads);
    
    Quad::deleteQuads(resetQuads, true);

    delete newCoords;
    
    return success;
}
Exemple #3
0
void CModel::Scale( const CVec3 &v ){
	SetTranslation( Translation() * v );
	TransformSurfaces( CMat4::ScaleMatrix( v ) );
	for( CEntity *child=Children();child;child=child->Next() ){
		if( CModel *model=dynamic_cast<CModel*>( child ) ) model->Scale( v );
	}
}
Exemple #4
0
int CALL RadTrfTrsl(int* n, double* pV)
{
	Translation(pV[0], pV[1], pV[2]);

	*n = ioBuffer.OutInt();
	return ioBuffer.OutErrorStatus();
}
Exemple #5
0
    void Node::Update() const
    {
        if (!dirty_ || hide_)
            return;

        dirty_ = false;

        PNode parent = parent_.lock();

        if (parent)
        {
            globalModel_ = parent->GetGlobalModelMatrix() * GetTransform();
            globalPosition_ = Translation(globalModel_);
            globalOrientation_ = parent->GetGlobalOrientation() * q_;
            globalScale_ = Scale(globalModel_);
        }
        else
        {
            globalModel_ = GetTransform();
            globalPosition_ = position_;
            globalOrientation_ = q_;
            globalScale_ = scale_;
        }

        isScaleUniform_ = NSG::IsScaleUniform(globalScale_);
        globalModelInv_ = Inverse(globalModel_);
        globalModelInvTransp_ = Transpose(Inverse(Matrix3(globalModel_)));
        lookAtDirection_ = globalOrientation_ * VECTOR3_LOOKAT_DIRECTION;
        upDirection_ = globalOrientation_ * VECTOR3_UP;
        signalUpdated_->Run();
    }
Exemple #6
0
//腐蚀
void Erode(double *src,int s_width,int s_height,double *dst,int d_width,int d_height,double *se,int se_width,int se_height,Position *center){
    
    if(center==NULL){
        Position temp;
        temp.x=se_width/2;
        temp.y=se_height/2;
        center=&temp;
    }
    MoveDirection m;
    double *temp=(double *)malloc(sizeof(double)*d_width*d_height);
    double *tempdst=(double *)malloc(sizeof(double)*d_width*d_height);
    double *realdst=(double *)malloc(sizeof(double)*d_width*d_height);
    Zero(realdst, d_width, d_height);
    Zoom(src,s_width,s_height,temp,d_width,d_height);
    for(int i=0;i<se_width;i++){
        for(int j=0;j<se_height;j++){
            if(se[j*se_width+i]>100.0){
                m.x=center->x-i;
                m.y=center->y-j;
                Translation(temp,tempdst,d_width,d_height, &m);
                And(tempdst, realdst, realdst,d_width,d_height);
            }
        }
    }
    matrixCopy(realdst, dst, d_width, d_height);
    free(temp);
    free(realdst);
    free(tempdst);
}
Exemple #7
0
	Matrix4x4 Matrix4x4::TRS(const Vector3 &t, const Quaternion &r, const Vector3 &s)
	{
		Matrix4x4 mt = Translation(t);
		Matrix4x4 mr = Rotation(r);
		Matrix4x4 ms = Scaling(s);

		return mt * mr * ms;
	}
Exemple #8
0
void renderScene(void) {
  int sx = glutGet(GLUT_WINDOW_WIDTH);
  int sy = glutGet(GLUT_WINDOW_HEIGHT);
  //SAspect = Scaling(1, (float)sx / sy, 1);
  VECTOR4D worldRayOrigin, worldRayDir;
  VECTOR4D modelRayOrigin, modelRayDir;
  MATRIX4D InvW;
  multimap<float, CMesh::INTERSECTIONINFO> faces;
  bool fill = false;

  SAspect = Scaling((float)sy / sx, 1, 1);
  W = Identity();

  P = PerspectiveWidthHeightRH(0.5f, 0.5f, 1.0f, 10.0f);
  EC = SAspect * T * Translation(0.0f, 0.0f, -1.0f);

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  BuildRayFromPerspective(EC, mx, my, worldRayOrigin, worldRayDir);
  Inverse(W, InvW);
  modelRayOrigin = InvW * worldRayOrigin;
  modelRayDir = InvW * worldRayDir;
  fill = g_EggCarton.RayCast(modelRayOrigin, modelRayDir, faces);

  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  glBegin(GL_TRIANGLES);
  g_EggCarton.Draw(EC);
  glEnd();
  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  glBegin(GL_TRIANGLES);
  if (fill)
    g_EggCarton.Draw(EC, faces.begin()->second.Face, 1);
  glEnd();

  if (bWireframe)
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  else
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  glBegin(GL_TRIANGLES);
  g_Plate.Draw(SAspect * T * Translation(0.0f, 0.0f, -0.1f));
  g_Sphere.Draw(SAspect * T * Translation(0.4f, 0.4f, 0.32f));
  g_Bananas.Draw(SAspect * T * Translation(0.45f, 0.45f, 0.48f));
  g_Flower.Draw(SAspect * T * Translation(-0.5f, 0.5f, 0.8f));
  glEnd();

  glutSwapBuffers();
}
Exemple #9
0
// set the rotation of the 3D viewer
void  Viewer3dParam::SetPose( Quaternion q, Vec3f t )
{

    Rotation( q.Conjugate() );
    
    Translation( t );

}
Exemple #10
0
EntityRef MainState::createSprite(Sprite* sprite, const Vector3& pos,
                                  const Vector2& scale, const char* name) {
    EntityRef entity = _entities.createEntity(_entities.root(), name);
    _sprites.addComponent(entity);
    entity.sprite()->setSprite(sprite);
    entity.place(Translation(pos) * Eigen::Scaling(scale.x(), scale.y(), 1.f));
    _anims.addComponent(entity);
    return entity;
}
Exemple #11
0
Web::Translation Web::translate(const QString &dict, const QString &word)
{
    if (! m_loadedDicts.contains(dict))
        return Translation();
    QUrl url(m_loadedDicts[dict].query.replace("%s", word));
    QEventLoop loop;
    QHttp http(url.host(), url.port(80), &loop);
    connect(&http, SIGNAL(done(bool)), &loop, SLOT(quit()));
    http.get(url.path() + "?" + url.encodedQuery());
    loop.exec();
    QTextCodec *codec = QTextCodec::codecForName(m_loadedDicts[dict].codec);
    QString translation;
    if (codec)
        translation = codec->toUnicode(http.readAll());
    else
        translation = QString::fromUtf8(http.readAll());
    return Translation(dict, word, translation);
}
void Sequence::initialize_Sequence(int RU_number, std::string promoter, int p_size,
                                  std::string gene, int g_size) {
    regulation_unit_number = RU_number;
    gene_sequence += gene;
    gene_size = g_size;
    promoter_sequence += promoter;
    promoter_size = p_size;
    Translation();
}
Exemple #13
0
EntityRef MainState::createHealthBar(const Vector3& pos, float size) {
    EntityRef parent = _entities.createEntity(_entities.root());
    parent.place(Transform(Translation(pos)));

    Box2 view(Vector2(0, 0), Vector2(size, 1));
    EntityRef empty = _entities.createEntity(parent, "healthEmpty");
    _sprites.addComponent(empty);
    empty.sprite()->setSprite(&_healthEmptySprite);
    empty.sprite()->setView(view);

    EntityRef full = _entities.createEntity(parent, "healthFull");
    _sprites.addComponent(full);
    full.sprite()->setSprite(&_healthFullSprite);
    full.sprite()->setView(view);
    full.place(Transform(Translation(Vector3(0, 0, 0.01))));

    return full;
}
Exemple #14
0
EntityRef MainState::createText(const std::string& text, const Vector3& pos,
                                const Vector4& color) {
    EntityRef entity = _entities.createEntity(_entities.root(), "text");
    _texts.addComponent(entity);
    TextComponent* comp = _texts.get(entity);
    comp->font = _font.get();
    comp->text = text;
    comp->color = color;
    entity.place(Transform(Translation(pos)));
    return entity;
}
Exemple #15
0
// FinishTransaction
Command*
TransformBox::FinishTransaction()
{
	Command* command = fCurrentCommand;
	if (fCurrentCommand) {
		fCurrentCommand->SetNewTransformation(Pivot(), Translation(),
			LocalRotation(), LocalXScale(), LocalYScale());
		fCurrentCommand = NULL;
	}
	return command;
}
Exemple #16
0
void OpenGLRenderSingleTextureEntities(const Entity* entities, int count, int model_location, int texture_id, int texture_location)
{
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glUniform1i(texture_location, 0);//GL_TEXTURE0

    for (int i = 0; i < count; ++i)
    {
        Mat4 model;
        const Entity& e = entities[i];

        float c = cos(ToRadian(e.rotation.x));
        float s = sin(ToRadian(e.rotation.x));
        Mat4 rotation_x =
        {
            1.f, 0.f, 0.f, 0.f,
            0.f, c, -s, 0.f,
            0.f, s, c, 0.f,
            0.f, 0.f, 0.f, 1.f
        };

        c = cos(ToRadian(e.rotation.y));
        s = sin(ToRadian(e.rotation.y));
        Mat4 rotation_y =
        {
            c, 0.f, -s, 0.f,
            0.f, 1.f, 0.f, 0.f,
            s, 0.f, c, 0.f,
            0.f, 0.f, 0.f, 1.f
        };

#if 0//TODO: Not used yet. Use this when has to be used.

        c = cos(ToRadian(e.rotation.y));
        s = sin(ToRadian(e.rotation.y));
        float c = cos(ToRadian(e.rotation.y));
        float s = sin(ToRadian(e.rotation.y));
        Mat4 rotation_z =
        {
            c, s, 0.f, 0.f,
            -s, c, 0.f, 0.f,
            0.f, 0.f, 1.f, 0.f,
            0.f, 0.f, 0.f, 1.f
        };
#endif
        model =
            Translation(e.position.x, e.position.y, e.position.z) *
            rotation_x *
            rotation_y *
            Scale(e.scale.x, e.scale.y, e.scale.z);
        glUniformMatrix4fv(model_location, 1, GL_TRUE, model.m);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    }
}
Exemple #17
0
//===============================================
//処理
//===============================================
//[input]
//	なし
//[return]
//	なし
//===============================================
void CField::Exec()
{
	//::D3DXVec3TransformCoord(&vAxisX, &vAxisX, &m_matRotate);
	//::D3DXVec3TransformCoord(&vAxisZ, &vAxisZ, &m_matRotate);
	
	//if(CJoyPad::GetState(0, PAD_STATE_HOLD, PAD_DIR_LEFT) )
	//{
	//	m_vPos -= vAxisX*0.1f;
	//	//m_Anim += 1.0f;
	//}
	//
	//if(CJoyPad::GetState(0, PAD_STATE_HOLD, PAD_DIR_RIGHT) )
	//{
	//	m_vPos += vAxisX*0.1f;
	//	//m_Anim += 1.0f;
	//}	
	//
	//if(CJoyPad::GetState(0, PAD_STATE_HOLD, PAD_DIR_UP) )
	//{
	//	m_vPos -= vAxisZ * 0.1f;
	//	//m_vPos.z -= 0.1f;
	//	//m_Anim += 1.0f;
	//}
	//
	//if(CJoyPad::GetState(0, PAD_STATE_HOLD, PAD_DIR_DOWN) )
	//{
	//	m_vPos += vAxisZ * 0.1f;
	//	//m_vPos.z += 0.1f;
	//	//m_Anim += 1.0f;
	//}
	
	
	//if(CJoyPad::GetState(0, PAD_STATE_HOLD, PAD_BUTTON_02) )
	//{
	//	m_vRot.x += 0.1f;
	//}
	
//	Update(0.000f);
	
	Translation(m_vPos.x, m_vPos.y, m_vPos.z);
	
	Scaling(m_vScale.x, m_vScale.y, m_vScale.z);
	
	Heading(m_vRot.x);
	
	Pitching(m_vRot.x);
	
	Rolling(m_vRot.x);
	
	Render(Joker::GetDevice());
	
	SetWorldMatrix();
}
Exemple #18
0
namespace CGAL {

const Translation             TRANSLATION = Translation();
const Rotation                ROTATION = Rotation();
const Scaling                 SCALING = Scaling();
const Reflection              REFLECTION = Reflection();
const Identity_transformation IDENTITY = Identity_transformation();

const Origin      ORIGIN = Origin();
const Null_vector NULL_VECTOR = Null_vector();

} //namespace CGAL
Exemple #19
0
void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
{
	bool forcePal = (renderstyle == LegacyRenderStyles[STYLE_Shaded] || renderstyle == LegacyRenderStyles[STYLE_AddShaded]);
	SetTexture(tex, translationID, forcePal);

	if (renderstyle == LegacyRenderStyles[STYLE_Normal] || (r_drawfuzz == 0 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
	{
		SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 1.0, 0.0);
	}
	else if (renderstyle == LegacyRenderStyles[STYLE_Add] && fullbright && alpha == 1.0 && !Translation())
	{
		SetStyle(TriBlendMode::TextureAddSrcColor, 1.0, 1.0);
	}
	else if (renderstyle == LegacyRenderStyles[STYLE_Add])
	{
		SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, alpha, 1.0);
	}
	else if (renderstyle == LegacyRenderStyles[STYLE_Subtract])
	{
		SetStyle(Translation() ? TriBlendMode::TranslatedRevSub : TriBlendMode::TextureRevSub, alpha, 1.0);
	}
	else if (renderstyle == LegacyRenderStyles[STYLE_SoulTrans])
	{
		SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, transsouls, 1.0 - transsouls);
	}
	else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 1 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
	{
		SetColor(0xff000000, 0);
		SetStyle(TriBlendMode::Fuzz);
	}
	else if (renderstyle == LegacyRenderStyles[STYLE_Shadow] || (r_drawfuzz == 2 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
	{
		SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 0.0, 160 / 255.0);
	}
	else if (renderstyle == LegacyRenderStyles[STYLE_TranslucentStencil])
	{
		SetColor(0xff000000 | fillcolor, fillcolor >> 24);
		SetStyle(TriBlendMode::Stencil, alpha, 1.0 - alpha);
	}
Exemple #20
0
void renderScene(void) {
  int sx = glutGet(GLUT_WINDOW_WIDTH);
  int sy = glutGet(GLUT_WINDOW_HEIGHT);
  MATRIX4D SAspect = Scaling((float)sy / sx, 1, 1);
  //MATRIX4D SAspect = Scaling(1, (float)sx / sy, 1);

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  if(bWireframe)
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  else
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

  glBegin(GL_TRIANGLES);
    g_EggCarton.Draw(SAspect * T * Translation(0.0f, 0.0f, -1.0f));
    g_Plate.Draw(SAspect * T * Translation(0.0f, 0.0f, -0.1f));
    g_Sphere.Draw(SAspect * T * Translation(0.4f, 0.4f, 0.32f));
    g_Bananas.Draw(SAspect * T * Translation(0.45f, 0.45f, 0.48f));
    g_Flower.Draw(SAspect * T * Translation(-0.5f, 0.5f, 0.8f));
  glEnd();

  glutSwapBuffers();
}
Matrix ModelCompositeW(HomVector T, HomVector R, HomVector S){
	Matrix Trans, Sc, TR, Rx, Ry, Rxy, Rz, Rxyz, W;
	Trans = Translation(T.x, T.y, T.z);
	Rx = RotateX(R.x);
	Ry = RotateY(R.y);
	Rz = RotateZ(R.z);
	Sc = Scale(S.x, S.y, S.z);
	Rxy = MatMatMul(Rx, Ry);
	Rxyz = MatMatMul(Rxy, Rz);
	TR = MatMatMul(Trans, Rxyz);
	W = MatMatMul(TR, Sc);
	return W;
}
Matrix ModelOrigin(){
	Vector T = {0.0f, 0.0f, 0.0f}, S = {1.0f, 1.0f, 1.0f}, R = {0.0f, 0.0f, 0.0f};
	Matrix Trans, Sc, TR, Rx, Ry, Rxy, Rz, Rxyz, W;
	Trans = Translation(T.x, T.y, T.z);
	Rx = RotateX(R.x);
	Ry = RotateY(R.y);
	Rz = RotateZ(R.z);
	Sc = Scale(S.x, S.y, S.z);
	Rxy = MatMatMul(Rx, Ry);
	Rxyz = MatMatMul(Rxy, Rz);
	TR = MatMatMul(Trans, Rxyz);
	W = MatMatMul(TR, Sc);
	return W;
}
Exemple #23
0
int main(){
	Macro();
	int n;for (scanf("%d", &n); n; n--) {
		char c;	Point_3 p;
		scanf("\n%c%lf%lf%lf", &c, &p.x, &p.y, &p.z);
		if (c == 'T') Translation(p);	if (c == 'S') Scaling(p);
		if (c == 'R') {	double r;scanf("%lf\n", &r);
			Rotate(p, r);	//===========绕OP逆时针旋转r角度
        }}
	for (scanf("%d", &n); n; n--) {
		Point_3 p, p2;	scanf("%lf%lf%lf", &p.x, &p.y, &p.z);
		p2 = opt(p); 	printf(“%f %f %f\n”,p2.x,p2.y,p2.z);
    }
}
Exemple #24
0
void	cBullet::Update()
{ 
	if( m_pResourceFile->GetKey() == "virus" )
	{
		m_vRotation.y += 0.25f * D3DX_PI * _GETSINGLE( cSystemMgr )->GetDeltaTime();

	}
	if( m_vPos.z > 200.0f || m_vPos.z < -50.0f )
	{
		DestroyObject();
	}
	DirectionMove();
	DirectionRotation();
	Translation();
}
 Mat4 TransformComponent::GetTransform(bool Relative)
 {
     if(m_Updated)
     {
         /* To do: Optimize. */
         
         m_Transform = Mat4::Identity;
         if(m_Position.x + m_Position.y + m_Position.z != 0.0f) m_Transform = Translation(m_Position);
         if(!m_FirstPerson) {
             if(m_Orientation.w != 0.0f) m_Transform *= m_Orientation.ToMat();
         } else {
             Quat pitch = Quat(Vec3(1,0,0), m_FirstPersonYRot);
             Quat yaw = Quat(Vec3(0,1,0), m_FirstPersonXRot);
             m_Orientation = yaw * pitch;
             if(m_Orientation.w != 0.0f) m_Transform *= m_Orientation.ToMat();
         }
         m_Transform *= SandboxSimulator::Scale(m_Scale);
         m_NormalMatrix = m_Orientation.ToMat().Inverse().Transpose();
         m_Updated = false;
     }
     //Entity* Parent = m_Entity->GetParent();
     if(m_HasParent) {
         TransformComponent* t = (TransformComponent*)m_RelativeTo->GetComponentByType(CT_TRANSFORM);
         if(t)
         {
             Mat4 ret = m_Transform;
             ret = t->GetOrientation(false).ToMat() * ret;
             ret = SandboxSimulator::Translation(t->GetPosition(false)) * ret;
             ret = SandboxSimulator::Scale(t->GetScale()) * ret;
             return ret;
         }
     }
     /*if(Parent && !m_Simulated && !Relative && (m_InheritPosition || m_InheritOrientation || m_InheritScale))
     {
         TransformComponent* t = GetTransformComponent(Parent);
         if(t)
         {
             if(m_InheritPosition && m_InheritOrientation && m_InheritScale) return t->GetTransform(Relative) * m_Transform;
             Matrix4 ret = m_Transform;
             if(m_InheritOrientation) ret = t->GetOrientation(false).ToMatrix() * ret;
             if(m_InheritPosition   ) ret = Translation(t->GetPosition(false))  * ret;
             if(m_InheritScale      ) ret = Reality::Scale(t->GetScale())       * ret;
             return ret;
         }
     }*/
     return m_Transform;
 }
Exemple #26
0
  bool Model::
  getGlobalFrame(taoDNode const * node,
		 Transform & global_transform) const
  {
    if ( ! node) {
      return false;
    }
    
    deFrame const * tao_frame(node->frameGlobal());
    deQuaternion const & tao_quat(tao_frame->rotation());
    deVector3 const & tao_trans(tao_frame->translation());
    
    // beware: Eigen::Quaternion(w, x, y, z) puts w first, whereas
    // deQuaternion(qx, qy, qz, qw) puts w last. Of course.
    global_transform = Translation(tao_trans[0], tao_trans[1], tao_trans[2]);
    global_transform *= Quaternion(tao_quat[3], tao_quat[0], tao_quat[1], tao_quat[2]);
    
    return true;
  }
void clLocalizer::SetLocale( const LString& LocaleName )
{
	guard( "%s", LocaleName.c_str() );

	ClearLocalization();

	FLocaleName = LocaleName;

	const LString FileName( FLocalePath + "/Localizer-" + LocaleName + ".txt" );

	if ( Env->FileSystem->FileExists( FileName ) )
	{
		Env->Logger->LogP( L_NOTICE, "Reading locale from %s", FileName.c_str() );

		iIStream* Stream = Env->FileSystem->CreateFileReader( FileName );

		while ( !Stream->Eof() )
		{
			LString Line = Stream->ReadLine();

			size_t SepPos = Line.find( "~" );

			FATAL( SepPos == Line.npos, "Invalid locale translation file format: missing ~" );

			LString Text( Line.substr( 0, SepPos ) );
			LString Translation( Line.substr( SepPos + 1, Line.length() - SepPos - 1 ) );

			FTranslations[ Text ] = Translation;
		}

		delete( Stream );
	}
	else
	{
		Env->Logger->LogP( L_NOTICE, "Locale %s not found", FileName.c_str() );
	}

	this->SendAsync( L_EVENT_LOCALE_CHANGED, LEventArgs(), false );

	unguard();
}
Exemple #28
0
void fog_of_war::Render(Controller * ctrl, ScreenUniformData * u_data, glm::vec2 position, GameObject *g_obj)
{

	this->GetFOW(g_obj,glm::ivec2(position));

	


	for (int j = g_obj->GetScroller()->GetBeginLimit().y; j < g_obj->GetScroller()->GetEndLimit().y; j++)
	{



		for (int i = g_obj->GetScroller()->GetBeginLimit().x; i < g_obj->GetScroller()->GetEndLimit().x; i++)
		{



			if (this->s_map[i][j] == DARK)
			{


				u_data->SetAmbientLight(glm::vec4(1.f, 1.f, 1.f, 0.8f));
				u_data->ApplyMatrix(Translation(glm::vec2(i * 32, j * 32))*Scale(glm::vec2(32, 32)));
				this->m_sprite->Render(NULL);



			}



		}



	}

	this->Advance(g_obj);
}
Exemple #29
0
void Button::RenderItem(Controller * ctrl, ScreenUniformData * u_data, Sprite * m_sprite, GLuint frame, GLuint action)
{
	u_data->ApplyMatrix(Translation(this->m_prop->position)*Scale(this->m_prop->size));


	glm::vec4 color;
	if (action == NONE)
		color = this->m_prop->color;
	else if (action == HOVER)
		color = this->m_prop->color * glm::vec4(1.2f, 1.2f, 1.2f, 1.0f);
	else if (action == PRESSED)
		color = this->m_prop->color * glm::vec4(0.8f, 0.8f, 0.8f, 1.0f);



	u_data->SetAmbientLight(color);


	m_sprite->Render(frame);


}
 void Travail ()
 { // create random acceleration vector
   acceleration = Vect (Random (-1.0, 1.0), Random (-1.0, 1.0), 0);
   acceleration.Scale (0.5);
   // add acceleration
   velocity += acceleration;
   // limit the speed, see Limit method below
   velocity = Limit (velocity, top_speed);
   // update position, translating velocity onto Feld size and orientation
   IncTranslation (MapToFeld (velocity));
   
   // detect bounds
   Vect v = Translation ();
   if (v . Dot (over) > (loc + over * wid / 2.0) . Dot (over))
     IncTranslation (MapToFeld (Vect (-wid, 0, 0)));
   if (v . Dot (over) < (loc - over * wid / 2.0) . Dot (over))
     IncTranslation (MapToFeld (Vect (wid, 0, 0)));
   if (v . Dot (up) > (loc + up * hei / 2.0) . Dot (up))
     IncTranslation (MapToFeld (Vect (0, -hei, 0)));
   if (v . Dot (up) < (loc - up * hei / 2.0) . Dot (up))
     IncTranslation (MapToFeld (Vect (0, hei, 0)));
 }