本文整理汇总了C++中Material函数的典型用法代码示例。如果您正苦于以下问题:C++ Material函数的具体用法?C++ Material怎么用?C++ Material使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Material函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
Material Material::cloneMe()
{
String name = mMaterial->getName();
unsigned int i = 0;
Ogre::MaterialPtr ptr = Ogre::MaterialManager::getSingletonPtr()->getByName(name+StringUtils::toString(i));
while(ptr.getPointer())
{
++i;// keep going until we get a unique name
ptr = Ogre::MaterialManager::getSingletonPtr()->getByName(name+StringUtils::toString(i));
}
Ogre::MaterialPtr newptr = mMaterial->clone(name+StringUtils::toString(i));
return Material(newptr.getPointer());
}
示例2: TEXT
SoftBody::Material * SoftBody::PushMaterial()
{
PhysicsFn->SelectMemory( TEXT("SoftBodies") );
Material * pMaterial = New Material();
PhysicsFn->UnSelectMemory();
pMaterial->fLinearStiffness = 0.0f;
pMaterial->fAngularStiffness = 0.0f;
pMaterial->fAreaStiffness = 0.0f;
pMaterial->fVolumeStiffness = 0.0f;
pMaterial->dwFlags = 0;
m_arrMaterials.Push( pMaterial );
return pMaterial;
}
示例3: Material
Material AasRenderer::CreateGeometryShadowMaterial(gfx::RenderingDevice &device)
{
BlendState blendState;
blendState.blendEnable = true;
blendState.srcBlend = D3DBLEND_SRCALPHA;
blendState.destBlend = D3DBLEND_INVSRCALPHA;
RasterizerState rasterizerState;
rasterizerState.cullMode = D3DCULL_NONE;
DepthStencilState depthStencilState;
depthStencilState.depthWrite = false;
auto vs{ device.GetShaders().LoadVertexShader("shadow_geom_vs") };
auto ps{ device.GetShaders().LoadPixelShader("diffuse_only_ps") };
return Material(blendState, depthStencilState, rasterizerState, {}, vs, ps);
}
示例4: REQUIRE_PARSE_SUCCESS
ParserResult MaterialSymbol::ParseLine(const std::vector<std::string>& aParameters, Scene& aOutput){
if(aParameters.size() != 6){
return kParseMalformedLine;
}
double se, diffuse, specular, shininess, reflectivity;
REQUIRE_PARSE_SUCCESS(Misc::GetDouble(aParameters[1], &se));
REQUIRE_PARSE_SUCCESS(Misc::GetDouble(aParameters[2], &diffuse));
REQUIRE_PARSE_SUCCESS(Misc::GetDouble(aParameters[3], &specular));
REQUIRE_PARSE_SUCCESS(Misc::GetDouble(aParameters[4], &shininess));
REQUIRE_PARSE_SUCCESS(Misc::GetDouble(aParameters[5], &reflectivity));
aOutput.mMaterials.push_back(Material(se, diffuse, specular, shininess, reflectivity));
return kParseSuccess;
}
示例5: readColor
Material SceneSettingReader::readMaterial()
{
settings_.beginGroup("material");
settings_.beginGroup("diffuse");
const Color diffuse = readColor();
settings_.endGroup();
settings_.beginGroup("specular");
const Color specular = readColor();
settings_.endGroup();
settings_.beginGroup("ambient");
const Color ambient = readColor();
settings_.endGroup();
const double shininess = settings_.value("shininess").toDouble();
settings_.endGroup();
return Material(specular, diffuse, ambient, shininess);
}
示例6: setGame
void MainMenu::init(Game* game)
{
// Important to set the game for changeState() to work!
setGame(game);
// Create the menu.
mMenu = new Menu("MainMenu", NavigationType::MOUSE, HOR);
mMenu->setSize(880, 700, 256, 512);
mMenu->addMenuItem(new MenuItem("SelectLevel", "data/imgs/buttons/play_standard.png", "data/imgs/buttons/play_glow.png"));
mMenu->addMenuItem(new MenuItem("About", "data/imgs/buttons/about_standard.png", "data/imgs/buttons/about_glow.png"));
mMenu->addMenuItem(new MenuItem("Quit", "data/imgs/buttons/quit_standard.png", "data/imgs/buttons/quit_glow.png"));
mMenu->buildMenu(116*1.5, 50*1.5);
mMenu->connect(&MainMenu::menuMessage, this);
// Side menu.
mAboutMenu = new Menu("SideMenu", NavigationType::MOUSE, HOR);
mAboutMenu->setSize(1000, 700, 256, 512);
MenuItem* item = new MenuItem("Back", "data/imgs/buttons/back_standard.png", "data/imgs/buttons/back_glow.png");
mAboutMenu->addMenuItem(item);
mAboutMenu->buildMenu(116*1.5, 50*1.5);
mAboutMenu->connect(&MainMenu::menuMessage, this);
// Create the world.
mWorld = new World();
mLight = new Light(D3DXVECTOR3(0, 25, 0), D3DXVECTOR3(0, -1, 0), Material(WHITE, 0), 32, 1600.0f);
mWorld->addLight(mLight);
mWorld->addAmbientLight(D3DCOLOR_ARGB(200, 100, 100, 100));
mLogo = gGraphics->loadTexture("data/imgs/logo.png");
mAboutTexture = gGraphics->loadTexture("data/imgs/about.png");
// Set the graphics light list.
gGraphics->setLightList(mWorld->getLights());
// Setup the camera.
gCamera->setPosition(D3DXVECTOR3(0, 5000, 0));
gCamera->setDirection(D3DXVECTOR3(0, -0.6, 0.4));
ShowCursor(true);
gSound->muteMusic(false);
gSound->playMusic("data/sound/menu_loop.wav", true, 0);
gSound->setVolume(0.15f);
mShowingAbout = false;
}
示例7: GraphicsInit
bool GraphicsInit()
{
graphicsEngine = new Renderer();
customScene = new CustomScene("MeshScene", graphicsEngine);
// Set the lights
globalLight = new Light(Material(MaterialWhite), glm::vec4(0.00001, 2.0, 25.0, 1.0));
customScene->addLight(globalLight);
// Camera's are added in the CustomScene's constructor
customModel = new CustomModel( customScene, NULL, None );
customScene->addModel(customModel);
graphicsEngine->initializeScenes();
graphicsEngine->initializeScenes();
return true;
}
示例8: QOpenGLShaderProgram
//===================================================================
Mesh::Mesh(const Mesh &mesh)
{
// copy ctor
mShaderProgram = new QOpenGLShaderProgram(this);
mDebugView = mesh.mDebugView;
mIndexBuffer = QOpenGLBuffer(mesh.mIndexBuffer);
mMode = mesh.mMode;
mTextureImage = mesh.mTextureImage;
setTextureImage(mTextureImage);
for (int index = 0; index < mesh.mVertices.count(); index++)
mVertices.append(mesh.vertices().at(index)) ;
addMaterial(Material());
mOpacity = mesh.mOpacity;
}
示例9: Vector3f
//----------------------------------------------------------------------------------------------
DebugMultiPoly::DebugMultiPoly()
{
m_origin = Vector3f();
m_firstColor = Color4f();
m_timeToLiveSeconds = 0.f;
m_killNextFrame = false;
m_shouldBeRemoved = false;
m_hasTexture = false;
m_material = Material();
m_material.m_useVBO = true;
//m_VBOOffset = 0;
genVBO();
//Texture* currTex = new Texture(".\\Data\\cobblestonesDiffuse.png");
//m_material.m_useVBO = true;
//m_material.m_useDiffuse = true;
//m_material.m_useShaderProgram=true;
////currMat-._useShaderProgram = true;
//m_material.m_diffuseID = currTex->m_openGLTextureID;
}
示例10: Id
void TPZBndCond::Clone(std::map<int, TPZAutoPointer<TPZMaterial> > &matvec) {
int matid = Id();
TPZAutoPointer<TPZMaterial> refmaterial = Material();
TPZAutoPointer<TPZMaterial> newrefmaterial;
int refmatid = 0;
if(refmaterial) {
refmaterial->Clone(matvec);
refmatid = refmaterial->Id();
newrefmaterial = matvec[refmatid];
}
std::map<int, TPZAutoPointer<TPZMaterial> >::iterator matit;
matit = matvec.find(matid);
if(matit == matvec.end())
{
TPZAutoPointer<TPZMaterial> newmat = TPZAutoPointer<TPZMaterial>(new TPZBndCond(*this, newrefmaterial));
matvec[matid] = newmat;
}
}
示例11: HR
void Graphics::drawTest(ID3DXMesh* mesh, IDirect3DTexture9* texture, D3DXVECTOR3 position, D3DXVECTOR3 rotation)
{
HR(mFX->SetTechnique(mhTexTech));
D3DXMATRIX M;
float rotY = atan2f(rotation.x, rotation.z);
D3DXMatrixRotationY(&M, rotY);
setEffectData(texture, position, Dimensions(500), Material(), 0, M, true);
HR(mFX->Begin(0, 0));
HR(mFX->BeginPass(0));
mesh->DrawSubset(0);
HR(mFX->EndPass());
HR(mFX->End());
}
示例12: FindPosInMat
global func FindPosInMat(string sMat, int iXStart, int iYStart, int iWidth, int iHeight, int iSize)
{
var iX, iY;
var iMaterial = Material(sMat);
for(var i = 0; i < 500; i++)
{
iX = AbsX(iXStart+Random(iWidth));
iY = AbsY(iYStart+Random(iHeight));
if(GetMaterial(iX,iY)==iMaterial &&
GetMaterial(iX+iSize,iY+iSize)==iMaterial &&
GetMaterial(iX+iSize,iY-iSize)==iMaterial &&
GetMaterial(iX-iSize,iY-iSize)==iMaterial &&
GetMaterial(iX-iSize,iY+iSize)==iMaterial
) {
return [iX, iY]; // Location found.
}
}
return 0; // No location found.
}
示例13: GraphicsInit
bool GraphicsInit()
{
graphicsEngine = new Renderer();
scene1 = new Scene("MeshScene", graphicsEngine);
scene1->addLight(new Light(Material(MaterialWhite),glm::vec4(0.0, 0.0, 10.0, 1.0)));
// Base
Base = new ObjLoader ( scene1, NULL, CUBE, None );
Base->SetMaterial(Material(MaterialSilver));
Base->SetName(std::string("Base"));
Base->ScaleLocal(1.5, 0.25, 1.5);
// Stand
Stand = new ObjLoader ( scene1, Base, SEMI_HOLLOW_CYLINDER, None );
Stand->SetMaterial(Material(MaterialSilver));
Stand->SetName(std::string("Stand"));
Stand->Translate(0.0, 4.0, 0.0);
Stand->ScaleLocal(0.5, 4.0, 0.5);
// Motor Shaft
MotorShaft = new ObjLoader ( scene1, Stand, CUBE, None );
MotorShaft->SetMaterial(Material(MaterialSilver));
MotorShaft->SetName(std::string("MotorShaft"));
MotorShaft->Translate(0.0, 4.0, 1.0);
MotorShaft->ScaleLocal(0.5, 0.5, 2.0);
// Motor Engine
Sphere = new ObjLoader ( scene1, MotorShaft, SPHERE, None );
Sphere->SetMaterial(Material(MaterialGold));
Sphere->Translate(0.0, 0.0, 2.0);
Sphere->SetName(std::string("Sphere"));
// Fan Blades
for(int i=0; i<360; i+=360/18){
CubePlane = new ObjLoader ( scene1, Sphere, CUBE, None );
CubePlane->SetMaterial(Material(MaterialCopper));
CubePlane->SetName(std::string("FanBlade"));
CubePlane->Translate(0.0, 2.0, 0.0);
CubePlane->SetCenter(glm::vec3(0.0, -2.0, 0.0));
CubePlane->ScaleLocal(0.20, 2.0, 0.20);
CubePlane->Rotate(i, 0.0, 0.0, 1.0);
}
scene1->addModel( Base);
graphicsEngine->initializeScenes();
// Sphere->SetVisible(!true, true);
// Sphere->SetVisible(true, !true);
Base->Rotate(45.0, 0.0, 1.0, 0.0);
// Sphere->SetVisible(true, true);
return true;
}
示例14: TEXT
UMaterial* UGTCaptureComponent::GetMaterial(FString InModeName = TEXT(""))
{
// Load material for visualization
static TMap<FString, FString>* MaterialPathMap = nullptr;
if (MaterialPathMap == nullptr)
{
MaterialPathMap = new TMap<FString, FString>();
MaterialPathMap->Add(TEXT("depth"), TEXT("Material'/UnrealCV/SceneDepthWorldUnits.SceneDepthWorldUnits'"));
MaterialPathMap->Add(TEXT("plane_depth"), TEXT("Material'/UnrealCV/ScenePlaneDepthWorldUnits.ScenePlaneDepthWorldUnits'"));
MaterialPathMap->Add(TEXT("vis_depth"), TEXT("Material'/UnrealCV/SceneDepth.SceneDepth'"));
MaterialPathMap->Add(TEXT("debug"), TEXT("Material'/UnrealCV/debug.debug'"));
// MaterialPathMap->Add(TEXT("object_mask"), TEXT("Material'/UnrealCV/VertexColorMaterial.VertexColorMaterial'"));
MaterialPathMap->Add(TEXT("normal"), TEXT("Material'/UnrealCV/WorldNormal.WorldNormal'"));
FString OpaqueMaterialName = "Material'/UnrealCV/OpaqueMaterial.OpaqueMaterial'";
MaterialPathMap->Add(TEXT("opaque"), OpaqueMaterialName);
}
static TMap<FString, UMaterial*>* StaticMaterialMap = nullptr;
if (StaticMaterialMap == nullptr)
{
StaticMaterialMap = new TMap<FString, UMaterial*>();
for (auto& Elem : *MaterialPathMap)
{
FString ModeName = Elem.Key;
FString MaterialPath = Elem.Value;
ConstructorHelpers::FObjectFinder<UMaterial> Material(*MaterialPath); // ConsturctorHelpers is only available for UObject.
if (Material.Object != NULL)
{
StaticMaterialMap->Add(ModeName, (UMaterial*)Material.Object);
}
}
}
UMaterial* Material = StaticMaterialMap->FindRef(InModeName);
if (Material == nullptr)
{
UE_LOG(LogUnrealCV, Warning, TEXT("Can not recognize visualization mode %s"), *InModeName);
}
return Material;
}
示例15: draw_template_
LeafSystem::LeafSystem(const Mesh& mesh, TextureType texture_type, const glm::vec3& origin, int numParticles) :
draw_template_({
ShaderType::DEFERRED,
mesh,
Material(),
Texture(texture_type, DIFFUSE_TEXTURE),
boost::none,
EffectSet({EffectType::CASTS_SHADOW, EffectType::CASTS_REFLECTION})
}),
origin_(origin),
scale_(0.7f),
velocity_(glm::vec3(0.0f, -0.00001f, 0.0f)),
acceleration_(glm::vec3(0.0f, -0.000001f, 0.0f)) {
for (int i = 0; i < numParticles; i++) {
glm::vec3 randVec = getRandomVec();
float randAngle = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / ROT_MAX));
particles_.push_back(Particle(glm::vec3(origin_.x + randVec.x, origin_.y + randVec.y, origin_.z + randVec.z),
scale_, randAngle, velocity_, acceleration_));
}
}