Example #1
0
static void VulcanGun(
    char solid)
{
    int i;
    GLUquadricObj *Barrel[5];
    GLUquadricObj *BarrelFace[5];
    GLUquadricObj *Barrel2[5];
    GLUquadricObj *Barrel3[5];
    GLUquadricObj *BarrelFace2[5];
    GLUquadricObj *Mount = gluNewQuadric();
    GLUquadricObj *Mount_face = gluNewQuadric();

    glNewList(SOLID_MECH_VULCAN, GL_COMPILE);

#ifdef LIGHT
    SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
    glColor3f(0.5, 0.5, 0.5);

    if (!solid) {
        gluQuadricDrawStyle(Mount, GLU_LINE);
        gluQuadricDrawStyle(Mount_face, GLU_LINE);
        }
    gluCylinder(Mount, 0.5, 0.5, 0.5, 16, 10);
    glTranslatef(0.0, 0.0, 0.5);
    gluDisk(Mount_face, 0.0, 0.5, 16, 10);

    for (i = 0; i < 5; i++) {
        Barrel[i] = gluNewQuadric();
        BarrelFace[i] = gluNewQuadric();
        BarrelFace2[i] = gluNewQuadric();
        Barrel2[i] = gluNewQuadric();
        Barrel3[i] = gluNewQuadric();
        glRotatef(72.0, 0.0, 0.0, 1.0);
        glTranslatef(0.0, 0.3, 0.0);
        if (!solid) {
            gluQuadricDrawStyle(Barrel[i], GLU_LINE);
            gluQuadricDrawStyle(BarrelFace[i], GLU_LINE);
            gluQuadricDrawStyle(BarrelFace2[i], GLU_LINE);
            gluQuadricDrawStyle(Barrel2[i], GLU_LINE);
            gluQuadricDrawStyle(Barrel3[i], GLU_LINE);
            }
        gluCylinder(Barrel[i], 0.15, 0.15, 2.0, 16, 10);
        gluCylinder(Barrel3[i], 0.06, 0.06, 2.0, 16, 10);
        glTranslatef(0.0, 0.0, 2.0);
        gluDisk(BarrelFace[i], 0.1, 0.15, 16, 10);
        gluCylinder(Barrel2[i], 0.1, 0.1, 0.1, 16, 5);
        glTranslatef(0.0, 0.0, 0.1);
        gluDisk(BarrelFace2[i], 0.06, 0.1, 16, 5);
        glTranslatef(0.0, -0.3, -2.1);
        }
    glEndList();
}
Example #2
0
void FntLabel::UpdateMesh()
{
	if (mString.IsEmpty())
	{
		if (mFont->HasSinglePage() && mFont->IsFixed())
		{
			SetMesh(nullptr);
			SetMaterial(nullptr);
		}

		if (!mManagedNodes.IsEmpty())
		{
			DeleteAllChilds(NodeRemoveFlags::OnlyManaged);
		}
		SetSize(Size2F::Zero);
		mInternalMeshes.Clear();
		return;
	}
	else if (mRenderingObject.Mesh() ==nullptr)
	{
		CreateMesh();
	}


	Size2F outSize;

	if (mIsMultipleLine)
	{
		TextLayouter::LayoutMultipleLineText(mInternalMeshes, mInternalPages, outSize, *mFont, mString, mAlignment, mRestrictSize, this, mIsStatic);
	}
	else
	{
		TextLayouter::LayoutSingleLineText(mInternalMeshes, mInternalPages, outSize, *mFont, mString, mAlignment, mRestrictSize, this, mIsStatic);
	}

	SetSize(outSize);

	//check if there are some mesh has no char after layout,this is rarely hit
	size_t meshCount = mInternalMeshes.Count();
	if (meshCount>1)
	{
		List<size_t> unusedIndices;
		List<INode*> unusedSprites;
		FOR_EACH_SIZE(i, meshCount)
		{
			BaseFontMesh* mesh = mInternalMeshes[i];
			if (!mesh->HasChars())
			{
				unusedIndices.Add(i);
				unusedSprites.Add(mManagedNodes[i]);
			}
		}
Example #3
0
    std::map<unsigned int, SceneNode *> SceneManager::CreateNodes(const std::map<unsigned int, std::shared_ptr<EntityComponent> > components, SceneNode * pParent)
    {
        std::map<unsigned int, SceneNode *> nodes;

        for (auto component : components)
        {
            // creat this node
            std::shared_ptr<SceneComponent> scene_component = std::dynamic_pointer_cast<SceneComponent>(component.second);
            auto node = new SceneNode(pParent, scene_component);

            // add any necessary assets to the scene node
            // XXX this should also happen during update incase the model asset is changed anytime during 
            // the scene components life cycle
            if (auto mesh_component = std::dynamic_pointer_cast<MeshComponent>(scene_component))
            {
                auto path = mesh_component->GetMeshPath();
                if (m_pAssets != nullptr)
                {
                    auto asset = m_pAssets->GetAsset(path.c_str());
                    node->SetMesh(asset);
                }
            }

            // get the material path, load as an asset, and set it on the node.
            auto material_path = scene_component->GetMaterialPath();
            std::shared_ptr<Material> pMaterial;
            if (m_pAssets != nullptr)
            {
                auto pAsset = m_pAssets->GetAsset(material_path.c_str());

                // XXX TODO - pass asset through a material manager, so that only one
                // material every exists for a given material script.
                pMaterial = std::make_shared<Material>(pAsset);
                node->SetMaterial(pMaterial);
            }

            if (auto light_component = std::dynamic_pointer_cast<LightComponent>(scene_component))
            {
                // create a light based on the light component and set it on the scene node
                Light * pLight = new Light(light_component);
                node->SetLight(pLight);
            }

            // do a depth first creation, so the list of child nodes can be passed into the scene node creation.
            std::map<unsigned int, SceneNode *> child_nodes = this->CreateNodes(component.second->GetComponents(), node);
            node->SetChildren(child_nodes);

            nodes[component.first] = node;
        }

        return nodes;
    }
Example #4
0
void
Foot(char solid) {

	glNewList(SOLID_MECH_FOOT, GL_COMPILE);
#ifdef LIGHT
	SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
	glColor3f(0.5, 0.5, 0.5);
	glRotatef(90.0, 1.0, 0.0, 0.0);
	Octagon(1.5, 0.6, solid);
	glRotatef(-90.0, 1.0, 0.0, 0.0);
	glEndList();
}
Example #5
0
void RendererD3D::DrawSprites(Texture* texture, int numSprites, VertexBuffer* vb)
{    
    // Bind the sprite profile & material
    Matrix4x4 ltw;
    VertexProfile* currentProfile = SetVertexProfile(mSpriteProfile);
    Material* currentMaterial = SetMaterial(mSpriteMaterial, ltw);
    VertexBuffer* currentVB = SetVertexBuffer(0, vb);
    IndexBuffer* currentIB = SetIndexBuffer(0);

    // Bind the texture
    TextureD3D9* d3d9Tex = (TextureD3D9*)texture;
    mDevice->SetTexture(0, d3d9Tex->GetTexture());
    
    // Draw the sprites
    Draw(numSprites * 6, numSprites * 2, ePT_Triangles);

    // Restore the old profile and material
    SetVertexBuffer(0, currentVB);
    SetIndexBuffer(currentIB);
    SetVertexProfile(currentProfile);
    SetMaterial(currentMaterial, ltw);    
}
Example #6
0
	Component::Ptr MeshRender::Clone() const
	{
		auto clone = MeshRender::Create(nullptr, m_Mesh.lock());
		unsigned int materialCount = m_Materials.size();

		for (unsigned int i = 0; i < materialCount; i++)
		{
			auto material = m_Materials[i];
			clone->SetMaterial(material.lock(), i);
		}
		
		return clone;
	}
Example #7
0
void
Shoulder(char solid)
{
  glNewList(SOLID_MECH_SHOULDER, GL_COMPILE);
#ifdef LIGHT
  SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess);
#endif
  glColor3f(1.0, 1.0, 0.0);
  Box(1.0, 0.5, 0.5, solid);
  glTranslatef(0.9, 0.0, 0.0);
#ifdef LIGHT
  SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
  glColor3f(0.5, 0.5, 0.5);
#ifdef SPHERE
  if (!solid)
    gluQuadricDrawStyle(qobj, GLU_LINE);
  gluSphere(qobj, 0.6, 16, 16);
#endif
  glTranslatef(-0.9, 0.0, 0.0);
  glEndList();
}
Example #8
0
/*struct part{
   void move(float step, part* thing);
   void create(float step, part* thing);
   void destroy(float step, part* thing);

   glm::mat4 (*getPos)();
   float scatter;
   int amount;
   float transp;
   int seed;

   int posBuff;
   glm::vec3[] pos;

   int norBuff;
   glm::vec3[] normal;

   int sizVbo;
   float[] size;

   glm::vec3[] velocity;
glm::vec3[] ambientColor;
}*/
void drawPart(part* thing){
      thing->age++;
      thing->move(1.0,thing);
      glPointSize(10);
      //printf("draw a part\n");
      //
      SetModel(0,0,0,1,1,1,0);
      SetMaterial(thing->mat);//7
      //SetMaterial(18);//7
      glBindBuffer(GL_ARRAY_BUFFER, thing->posBuff);
      float* pointdata = (float*)glMapBuffer(GL_ARRAY_BUFFER,GL_READ_WRITE);
      for(int i=0;i<thing->amount;i++){
         //printf("orig %f %f %f\n",data[i],data[i+1],data[i+2]);
         //printf("%f %f %f is pos of e part\n",thing->pos[i].x,thing->pos[i].x,thing->pos[i].x);
         vec3 tmp = thing->pos[i];
         pointdata[i*3+0] = tmp.x;
         pointdata[i*3+1] = tmp.y;
         pointdata[i*3+2] = tmp.z;
         //printf("now  %f %f %f\n",data[i],data[i+1],data[i+2]);
      }
      glUnmapBuffer(GL_ARRAY_BUFFER);

      glBindBuffer(GL_ARRAY_BUFFER, thing->sizBuff);
      float* sizedata = (float*)glMapBuffer(GL_ARRAY_BUFFER,GL_READ_WRITE);
      for(int i=0;i<thing->amount;i++){
         //printf("psize is %f\n",sizedata[i]);
         sizedata[i] = thing->size[i];
      }
      glUnmapBuffer(GL_ARRAY_BUFFER);

      //set transforms to idents
      safe_glEnableVertexAttribArray(h_aPosition);
      glBindBuffer(GL_ARRAY_BUFFER, thing->posBuff);
      safe_glVertexAttribPointer(h_aPosition, 3, GL_FLOAT, GL_FALSE, 0, 0);

      safe_glEnableVertexAttribArray(h_aNormal);
      glBindBuffer(GL_ARRAY_BUFFER, thing->norBuff);
      safe_glVertexAttribPointer(h_aNormal, 3, GL_FLOAT, GL_FALSE, 0, 0);

      safe_glEnableVertexAttribArray(h_aPointSize);
      glBindBuffer(GL_ARRAY_BUFFER, thing->sizBuff);
      safe_glVertexAttribPointer(h_aPointSize, 1, GL_FLOAT, GL_FALSE, 0, 0);

      //printf("the buff is h_aPointSize %d\n",h_aPointSize);

      //draw
      glBindBuffer(GL_ARRAY_BUFFER, thing->posBuff);
      //printf("the amt is %d\n",thing->amount);
      glDrawArrays(GL_POINTS,0, thing->amount);

}
Example #9
0
/*!****************************************************************************
 @Function		DrawDuck
 @Description	Draws duck.
******************************************************************************/
void OGLESFur::DrawDuck()
{
	glPushMatrix();
		// Apply the transformation for the duck
		glMultMatrixf(m_mDuckWorld.f);

		// Draw the duck body
		SetMaterial(&c_pMaterial[3], m_aTexIDs[eTexSkin]);
		DrawMesh(eDuckBody);

		// Draw the duck's eyes
		SetMaterial(&c_pMaterial[1], 0);
		DrawMesh(eDuckEyeL);
		DrawMesh(eDuckEyeR);

		// Draw his beak
		SetMaterial(&c_pMaterial[2], 0);
		DrawMesh(eDuckBeak);

		// Draw the fur shells
		DrawFurShells();
	glPopMatrix();
}
Example #10
0
void SkyboxTestScene::Initialize()
{
	//Fonts
	//**************************
	m_pDebugFont = ContentManager::Load<SpriteFont>("Resources/Fonts/Consolas_32.fnt");

	//Camera
	//**************************
	//auto cam = new OrbitCamera();
	//AddEntity(cam);

	//Materials
	//**************************
	m_pMat = new TexPBRMaterial(
		"Resources/Textures/BaseColor.png",
		"Resources/Textures/Roughness.png",
		"Resources/Textures/Metalness.png",
		"Resources/Textures/AOMap.png",
		"Resources/Textures/NormalMap.png");
	m_pMat->SetSpecular(0.5f);

	//Skybox
	//**************************
	//SetSkybox("Resources/Textures/CharlesRiver_Ref.hdr");
	//SetSkybox("Resources/Textures/Harbour_3_Ref.hdr");
	SetSkybox("Resources/Textures/Ice_Lake_Ref.hdr");
	//SetSkybox("Resources/Textures/TropicalRuins_3k.hdr");
	//SetSkybox("Resources/Textures/WinterForest_Ref.hdr");

	//Models
	//*************************
	auto pModelComp = new ModelComponent("Resources/Models/helmet.dae");
	pModelComp->SetMaterial(m_pMat);
	auto pHelmet = new Entity();
	pHelmet->AddComponent(pModelComp);
	pHelmet->GetTransform()->Translate(vec3(0, 0, 0));
	AddEntity(pHelmet);

	//Lights
	//**************************
	m_pLigEntity = new Entity();
	m_pLight = new DirectionalLight(vec3(1, 1, 1), 0.99f);
	m_pLight->SetShadowEnabled(true);
	m_pLigEntity->AddComponent(new LightComponent( m_pLight));
	m_pLigEntity->GetTransform()->Scale(0.1f, 0.1f, 0.1f);
	//m_pLigEntity->GetTransform()->SetRotation(glm::lookAtLH())
	AddEntity(m_pLigEntity);

	SETTINGS->Window.VSync(true);
}
void UPaperFlipbookComponent::PostLoad()
{
	Super::PostLoad();

	const int32 PaperVer = GetLinkerCustomVersion(FPaperCustomVersion::GUID);

	if (PaperVer < FPaperCustomVersion::ConvertPaperFlipbookComponentToBeMeshComponent)
	{
		if (Material_DEPRECATED != nullptr)
		{
			SetMaterial(0, Material_DEPRECATED);
		}
	}
}
Example #12
0
void
MechHip(char solid) {
	int i;
	GLUquadricObj *hip[2];

	glNewList(SOLID_MECH_HIP, GL_COMPILE);
#ifdef LIGHT
	SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess);
#endif
	glColor3f(1.0, 1.0, 0.0);
	Octagon(0.7, 0.5, solid);
#ifdef SPHERE

	for (i = 0; i < 2; i++) {
		if (i) {
			glScalef(-1.0, 1.0, 1.0);
		}

		glTranslatef(1.0, 0.0, 0.0);
		hip[i] = gluNewQuadric();
#ifdef LIGHT
		SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
		glColor3f(0.5, 0.5, 0.5);

		if (!solid) {
			gluQuadricDrawStyle(hip[i], GLU_LINE);
		}

		gluSphere(hip[0], 0.2, 16, 16);
		glTranslatef(-1.0, 0.0, 0.0);
	}

	glScalef(-1.0, 1.0, 1.0);
#endif
	glEndList();
}
Example #13
0
static void myinit(void)
{
    char i = 1;

    /* Init animation variables */
    leg = 0;
    shoulder1 = 0;
    shoulder2 = 0;
    shoulder3 = 0;
    shoulder4 = 0;
    lat1 = 20;
    lat2 = 20;
    elbow1 = 0;
    elbow2 = 0;
    pivot = 0;
    tilt = 10;
    ankle1 = 0;
    ankle2 = 0;
    heel1 = 0;
    heel2 = 0;
    hip11 = 0;
    hip12 = 10;
    hip21 = 0;
    hip22 = 10;
    fire = 0;
    solid_part = 1;
    turn = 0;
    turn1 = 0;
    lightturn = 0;
    lightturn1 = 0;
    elevation = 0.0;
    distance = 0.0;
    frame = 3.0;

#ifdef LIGHT
    SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
    glEnable(GL_DEPTH_TEST);
    MechTorso(i);
    MechHip(i);
    Shoulder(i);
    RocketPod(i);
    UpperArm(i);
    ForeArm(i);
    UpperLeg(i);
    Foot(i);
    VulcanGun(i);
    Enviro(i);
}
void BoneObject::Initialize(const GameContext& gameContext)
{
	UNREFERENCED_PARAMETER(gameContext);

	auto model = new ModelComponent(L"./Resources/Meshes/Bone.ovm");
	
	model->SetMaterial(m_MaterialId);

	auto gameObj = new GameObject();

	gameObj->AddComponent(model);
	AddChild(gameObj);

	gameObj->GetTransform()->Scale(m_Length, m_Length, m_Length);
}
//----------------------------------------------------------------------------
medGUILutHistogramSwatch::medGUILutHistogramSwatch(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
:wxPanel(parent,id,pos,size,style)         
//----------------------------------------------------------------------------
{
  m_ShowThreshold= false;
	m_Listener = NULL;
  m_Editable = false;
  SetMaterial(NULL);

  m_MouseInWindow = false;
  m_Tip = "";
  SetCursor(*wxCROSS_CURSOR);

  m_Font = wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
  m_Font.SetPointSize(9);
}
Example #16
0
/*!****************************************************************************
 @Function		DrawFurShells
 @Description	Draw the duck shells that represent the fur
******************************************************************************/
void OGLESFur::DrawFurShells()
{
	// Get the mesh associated with the duck body
	int i32MeshID = m_Scene.pNode[eDuckBody].nIdx;
	SPODMesh* pMesh  = &m_Scene.pMesh[i32MeshID];

	// Bind the index buffer for the ducks body as the shells use the same indices
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_puiIndexVbo[i32MeshID]);

	// Enable alpha blending. The Alpha-test is not required and would be slower than alpha-blend
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	// Set up the lighting
	glLightfv(GL_LIGHT0, GL_SPECULAR, &c_vColourBlack.x);

	// Enable the texture coordinates. The vertices and normals should already be enabled
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);

	SetMaterial(&c_pMaterial[0], m_aTexIDs[eTexFur]);

	for(int i = 0; i < m_i32FurShellNo; ++i)
	{
		// If we are drawing the most outer shell change the lighting
		if(i == m_i32FurShellNo - 1)
			glLightfv(GL_LIGHT0, GL_SPECULAR, &c_vLightColour.x);

		// Bind the VBO for the shells vertices
		glBindBuffer(GL_ARRAY_BUFFER, m_uiShellVbo[i]);

		// Setup the pointers
		glVertexPointer(3, GL_FLOAT, sizeof(SVertex), 0);
		glNormalPointer(GL_FLOAT, sizeof(SVertex), (GLvoid*) (sizeof(float) * 3));
		glTexCoordPointer(2, GL_FLOAT, sizeof(SVertex), (GLvoid*) (sizeof(float) * 6));

		// Draw primitive
		glDrawElements(GL_TRIANGLES, pMesh->nNumFaces * 3, GL_UNSIGNED_SHORT, 0);
	}

	// Unbind the VBOs
	glBindBuffer(GL_ARRAY_BUFFER, 0);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

	// Disable blending as it is no longer needed
	glDisable(GL_BLEND);
}
Example #17
0
    void DiLineList::Init()
    {
        m_uiMaxVerts         = 0;
        m_pLockedPositions     = 0;
        m_uiPositionStride     = 0;
        m_pLockedColors         = 0;
        m_uiColorStride         = 0;

        mSourceData.push_back(Driver->CreateVertexBuffer());

        mVertexDecl = Driver->CreateVertexDeclaration();
        mVertexDecl->AddElement(0, VERT_TYPE_FLOAT3, VERT_USAGE_POSITION);
        mVertexDecl->AddElement(0, VERT_TYPE_COLOR,  VERT_USAGE_COLOR);
        mVertexDecl->Create();

        SetMaterial("unlighting_color.mtl");
    }
CVXS_Voxel& CVXS_Voxel::operator=(const CVXS_Voxel& VIn)
{
	p_Sim = VIn.p_Sim;

	MyXIndex = VIn.MyXIndex;
	MySIndex = VIn.MySIndex;
	OriginalPos = VIn.OriginalPos;
	OriginalSize = VIn.OriginalSize;
	SetMaterial(VIn.MatIndex);

	DofFixed = VIn.DofFixed;
	ExternalForce = VIn.ExternalForce;
	ExternalDisp = VIn.ExternalDisp;
	ExternalTorque = VIn.ExternalTorque;
	ExternalTDisp = VIn.ExternalTDisp;
	ExtInputScale=VIn.ExtInputScale;

	S = VIn.S;
	PrevS = S;
	dS = VIn.dS;

//	MaxBondStrain = VIn.MaxBondStrain;
//	MaxBondStress = VIn.MaxBondStress;
	StaticFricFlag = VIn.StaticFricFlag;
	VYielded = VIn.VYielded;
	VBroken = VIn.VBroken;

//	ResidualDisp=VIn.ResidualDisp;
//	ResidualAng=VIn.ResidualAng;

	UnlinkAllBonds();
	for (int i=0; i<VIn.NumLocalBonds; i++)	LinkBond(VIn.GetBondIndex(i));

	NearbyVoxInds = VIn.NearbyVoxInds;

	BlendingEnabled = VIn.BlendingEnabled;
	BlendMix = VIn.BlendMix;

	m_Red = VIn.m_Red;
	m_Green = VIn.m_Green;
	m_Blue = VIn.m_Blue;
	m_Trans = VIn.m_Trans;

	return *this;
}
void UKUIMaterialInterfaceComponent::Render( AKUIInterface* aHud, UCanvas* oCanvas, const FVector2D& v2Origin, UKUIInterfaceElement* oRenderCacheObject )
{
	if ( mMaterialPtr != NULL && *mMaterialPtr != mMaterial )
	{
		if ( this->mMaterial != NULL && mMaterialPtr != NULL && *mMaterialPtr != NULL )
		{
			UMaterialInstance* const mCurrent = Cast<UMaterialInstance>( this->mMaterial );
			UMaterialInstanceDynamic* const mNew = Cast<UMaterialInstanceDynamic>( *mMaterialPtr );

			if ( mCurrent != NULL && mNew != NULL )
				mNew->CopyParameterOverrides( mCurrent );
		}

		SetMaterial( *mMaterialPtr );
	}

	if ( mMaterial != NULL )
	{
		UMaterialInstanceDynamic* const mDynamic = Cast<UMaterialInstanceDynamic>( mMaterial );

		if ( mDynamic != NULL )
		{
			for ( int32 i = 0; i < arTextureParameters.Num(); ++i )
			{
				if ( *( arTextureParameters[ i ].tTexturePtr ) == arTextureParameters[ i ].tTextureValue )
					continue;
					
				mDynamic->SetTextureParameterValue( arTextureParameters[ i ].nParameterName, *( arTextureParameters[ i ].tTexturePtr ) );
				arTextureParameters[ i ].tTextureValue = *( arTextureParameters[ i ].tTexturePtr );
			}
		}
	}

	if ( stItem.IsValid() )
	{
		static_cast<FCanvasTileItem*>(&*stItem)->Size = v2Size;
		static_cast<FCanvasTileItem*>(&*stItem)->UV0 = v2MaterialCoords;
		static_cast<FCanvasTileItem*>(&*stItem)->UV1 = v2MaterialCoords + v2MaterialSize;
		static_cast<FCanvasTileItem*>(&*stItem)->Rotation = rRotation;
		static_cast<FCanvasTileItem*>(&*stItem)->PivotPoint = v2PivotPoint;
		static_cast<FCanvasTileItem*>(&*stItem)->Z = fDepth;
	}

	Super::Render( aHud, oCanvas, v2Origin, oRenderCacheObject );
}
void UKUIMaterialInterfaceComponent::SetMaterialPointer( UMaterialInterface** mMaterialPtr )
{
	if ( this->mMaterialPtr == mMaterialPtr )
		return;

	this->mMaterialPtr = mMaterialPtr;

	if ( this->mMaterial != NULL && mMaterialPtr != NULL && *mMaterialPtr != NULL )
	{
		UMaterialInstance* const mCurrent = Cast<UMaterialInstance>( this->mMaterial );
		UMaterialInstanceDynamic* const mNew = Cast<UMaterialInstanceDynamic>( *mMaterialPtr );

		if ( mCurrent != NULL && mNew != NULL )
			mNew->CopyParameterOverrides( mCurrent );
	}

	SetMaterial( *mMaterialPtr );
}
Example #21
0
void CParticleSystem::Unload()
{
	if (!IsLoaded())
		return;

	TAssert(m_iReferences == 0);

	m_bLoaded = false;

	SetMaterial(CMaterialHandle());

	if (GetModelName().length() > 0)
		CModelLibrary::ReleaseModel(GetModelName());

	CParticleSystemLibrary::Get()->m_iParticleSystemsLoaded--;

	for (size_t i = 0; i < GetNumChildren(); i++)
		CParticleSystemLibrary::Get()->GetParticleSystem(GetChild(i))->Unload();
}
Example #22
0
void CParticleSystem::Load()
{
	if (IsLoaded())
		return;

	m_iReferences = 1;
	m_bLoaded = true;

	if (GetMaterialName().length() > 0)
		SetMaterial(CMaterialLibrary::AddMaterial(GetMaterialName()));

	if (GetModelName().length() > 0)
		SetModel(CModelLibrary::AddModel(GetModelName()));

	CParticleSystemLibrary::Get()->m_iParticleSystemsLoaded++;

	for (size_t i = 0; i < GetNumChildren(); i++)
		CParticleSystemLibrary::Get()->GetParticleSystem(GetChild(i))->Load();
}
/*
======================
BSEntity::ReadFromSaveGame
======================
*/
void BSEntity::ReadFromSaveGame( idFile *savefile, idGameBearShootWindow* _game ) {
	game = _game;

	game->ReadSaveGameString( materialName, savefile );
	SetMaterial( materialName );

	savefile->Read( &width, sizeof(width) );
	savefile->Read( &height, sizeof(height) );
	savefile->Read( &visible, sizeof(visible) );

	savefile->Read( &entColor, sizeof(entColor) );
	savefile->Read( &position, sizeof(position) );
	savefile->Read( &rotation, sizeof(rotation) );
	savefile->Read( &rotationSpeed, sizeof(rotationSpeed) );
	savefile->Read( &velocity, sizeof(velocity) );

	savefile->Read( &fadeIn, sizeof(fadeIn) );
	savefile->Read( &fadeOut, sizeof(fadeOut) );
}
Example #24
0
void
init(void) {
	char i = 1;

#ifdef LIGHT
	SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
	glEnable(GL_DEPTH_TEST);
	MechTorso(i);
	MechHip(i);
	Shoulder(i);
	RocketPod(i);
	UpperArm(i);
	ForeArm(i);
	UpperLeg(i);
	Foot(i);
	VulcanGun(i);
	Enviro(i);
}
/*
======================
BOEntity::ReadFromSaveGame
======================
*/
void BOEntity::ReadFromSaveGame( idFile *savefile, idGameBustOutWindow* _game ) {
	game = _game;

	savefile->Read( &visible, sizeof(visible) );

	game->ReadSaveGameString( materialName, savefile );
	SetMaterial( materialName );

	savefile->Read( &width, sizeof(width) );
	savefile->Read( &height, sizeof(height) );

	savefile->Read( &color, sizeof(color) );
	savefile->Read( &position, sizeof(position) );
	savefile->Read( &velocity, sizeof(velocity) );

	savefile->Read( &powerup, sizeof(powerup) );
	savefile->Read( &removed, sizeof(removed) );
	savefile->Read( &fadeOut, sizeof(fadeOut) );
}
Example #26
0
void plPlate::SetTexture(plBitmap *texture)
{
    plLayer         *layer;
    hsGMaterial     *material;
    plString        keyName;

    material = new hsGMaterial();
    keyName = plString::Format( "PlateBlank#%d", fMagicUniqueKeyInt++ );
    hsgResMgr::ResMgr()->NewKey( keyName, material, plLocation::kGlobalFixedLoc );
    layer = material->MakeBaseLayer();
    layer->SetShadeFlags( layer->GetShadeFlags() | hsGMatState::kShadeNoShade | hsGMatState::kShadeWhite | hsGMatState::kShadeReallyNoFog );
    layer->SetZFlags( layer->GetZFlags() | hsGMatState::kZNoZRead );
    layer->SetBlendFlags( layer->GetBlendFlags() | hsGMatState::kBlendAlpha );
    layer->SetOpacity( fOpacity );
    layer->SetUVWSrc(plLayerInterface::kUVWPassThru);

    hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), new plGenRefMsg(layer->GetKey(), plRefMsg::kOnCreate, -1, plLayRefMsg::kTexture), plRefFlags::kActiveRef);

    SetMaterial(material);
}
void UPaperSpriteComponent::PostLoad()
{
	Super::PostLoad();

	const int32 PaperVer = GetLinkerCustomVersion(FPaperCustomVersion::GUID);

	if (PaperVer < FPaperCustomVersion::ConvertPaperSpriteComponentToBeMeshComponent)
	{
		if (MaterialOverride_DEPRECATED != nullptr)
		{
			SetMaterial(0, MaterialOverride_DEPRECATED);
		}
	}

	if (PaperVer < FPaperCustomVersion::FixVertexColorSpace)
	{
		const FColor SRGBColor = SpriteColor.ToFColor(/*bSRGB=*/ true);
		SpriteColor = SRGBColor.ReinterpretAsLinear();
	}
}
Example #28
0
void DrawShadow(float x, float z, float Sx, float Sy, float Sz, float angle) {
    /*Shadow*/
    SetModel(x, -0.5, z, Sx, Sy, Sz, angle);
    SetMaterial(1);
    safe_glEnableVertexAttribArray(h_aPosition);
    glBindBuffer(GL_ARRAY_BUFFER, ShadowCubeBuffObj);
    safe_glVertexAttribPointer(h_aPosition, 3, GL_FLOAT, GL_FALSE, 0, 0);

    safe_glEnableVertexAttribArray(h_aNormal);
    glBindBuffer(GL_ARRAY_BUFFER, ShadowNormalBuffObj);
    safe_glVertexAttribPointer(h_aNormal, 3, GL_FLOAT, GL_FALSE, 0, 0);

    /* draw!*/
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, SCIndxBuffObj);
    glDrawElements(GL_TRIANGLES, g_SCiboLen, GL_UNSIGNED_SHORT, 0);

    /* Disable the attributes used by our shader*/
    safe_glDisableVertexAttribArray(h_aPosition);
    safe_glDisableVertexAttribArray(h_aNormal);
}
    bool MeshMaterialGraphicsObject::InitializeAsync()
    {
        assert(_mesh != nullptr);
        SetMaterial(material());

        for (size_t i = 0; i < _mesh->vertices->size(); i++)
        {
            AddVertex((*_mesh->vertices)[i], (*_mesh->texCoords)[i], (*_mesh->normals)[i]);
        }
        for (Vector<3, unsigned> triangle : *_mesh->triangles)
        {
            AddTriangle(triangle[0], triangle[1], triangle[2]);
        }
        for (Vector<4, unsigned> quad : *_mesh->quads)
        {
            AddQuad(quad[0], quad[1], quad[2], quad[3]);
        }

        return VboGraphicsObject::InitializeAsync();
    }
Example #30
0
void StaticModel::ApplyMaterialList(const String& fileName)
{
    String useFileName = fileName;
    if (useFileName.Trimmed().Empty() && model_)
        useFileName = ReplaceExtension(model_->GetName(), ".txt");

    ResourceCache* cache = GetSubsystem<ResourceCache>();
    SharedPtr<File> file = cache->GetFile(useFileName, false);
    if (!file)
        return;

    unsigned index = 0;
    while (!file->IsEof() && index < batches_.Size())
    {
        Material* material = cache->GetResource<Material>(file->ReadLine());
        if (material)
            SetMaterial(index, material);

        ++index;
    }
}