本文整理汇总了C++中GetMaterial函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMaterial函数的具体用法?C++ GetMaterial怎么用?C++ GetMaterial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMaterial函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CreateBurnMark
global func CreateBurnMark(int iX, int iY, int iLevel, int Count)
{
var boom;
if(!ObjectCount(BOOM)) boom = CreateObject(BOOM,0,0,-1);
else boom = FindObject(BOOM);
var angle=Random(360/Count); //variablen für die überprüfung
var type;
for(var z; z < Count; z++)
{
angle += Max(1,360/Count);
// Check: Sky or Solid/Liquid
var x = iX+Cos(angle,iLevel);
var y = iY+Sin(angle,iLevel);
if((GetMaterialVal("Density","Material",GetMaterial(x,y)) != 0) || (GetMaterial(x,y) == -1))
continue;
type = 1+Random(3);
var size = BurnMarkCheck(angle,RandomX(iLevel/2,iLevel*2),iX,iY);
var sin = Sin(angle,(size-iLevel)/2+iLevel+Random(3));
var cos = Cos(angle,(size-iLevel)/2+iLevel+Random(3));
CreateParticle("BurnMark",iX+cos,iY+sin,Cos(angle+RandomX(-5,5),50),Sin(angle+RandomX(-5,5),50),size*5+Random(25),RGBa(0,0,0,64),boom,1);
}
}
开发者ID:lluchs,项目名称:ClonkMars,代码行数:26,代码来源:Script.c
示例2: GetMaterial
void PointCloud::NotifyMouseClicked( const Events::MouseEvent& event )
{
// If we are scrolling == Zooming
if(event.GetType() == Events::MouseEventType::SCROLL_DOWN)
{
glm::vec3 cameraPosition = Atum::SceneManager::SceneManager::GetInstance().GetCurrentScene()->GetCurrentCamera()->GetPosition();
glm::vec3 objectPosition = m_transform.GetPosition();
float distance = glm::length(objectPosition - cameraPosition);
float pointSize = 20.0f/(distance+1.0f);
LowLevelGraphics::LowLevelAPI::BindShaders(GetMaterial()->GetShaderList());
GetMaterial()->GetShaderList()->GetShaderProgram()->UpdateShaderParameterWithName("pointSize", &pointSize, SHADER_FLOAT);
}
else if(event.GetType() == Events::MouseEventType::SCROLL_UP)
{
glm::vec3 cameraPosition = Atum::SceneManager::SceneManager::GetInstance().GetCurrentScene()->GetCurrentCamera()->GetPosition();
glm::vec3 objectPosition = m_transform.GetPosition();
float distance = glm::length(objectPosition - cameraPosition);
float pointSize = 20.0f/(distance+1.0f);
LowLevelGraphics::LowLevelAPI::BindShaders(GetMaterial()->GetShaderList());
GetMaterial()->GetShaderList()->GetShaderProgram()->UpdateShaderParameterWithName("pointSize", &pointSize, SHADER_FLOAT);
}
LowLevelGraphics::ShaderProgram::UpdateGlobalShaderParameter(LowLevelGraphics::VIEWMATRIX, glm::value_ptr(Atum::SceneManager::SceneManager::GetInstance().GetCurrentScene()->GetCurrentCamera()->GetViewMatrix()), SHADER_MATRIX44);
}
开发者ID:Tetriste,项目名称:LudumDare29,代码行数:26,代码来源:PointCloud.cpp
示例3: GetMaterial
/*
============
idMapPatch::Write
============
*/
bool idMapPatch::Write( idFile *fp, int primitiveNum, const idVec3 &origin ) const {
int i, j;
const idDrawVert *v;
if ( GetExplicitlySubdivided() ) {
fp->WriteFloatString( "// primitive %d\n{\n patchDef3\n {\n", primitiveNum );
fp->WriteFloatString( " \"%s\"\n ( %d %d %d %d 0 0 0 )\n", GetMaterial(), GetWidth(), GetHeight(), GetHorzSubdivisions(), GetVertSubdivisions());
} else {
fp->WriteFloatString( "// primitive %d\n{\n patchDef2\n {\n", primitiveNum );
fp->WriteFloatString( " \"%s\"\n ( %d %d 0 0 0 )\n", GetMaterial(), GetWidth(), GetHeight());
}
fp->WriteFloatString( " (\n" );
for ( i = 0; i < GetWidth(); i++ ) {
fp->WriteFloatString( " ( " );
for ( j = 0; j < GetHeight(); j++ ) {
v = &verts[ j * GetWidth() + i ];
fp->WriteFloatString( " ( %f %f %f %f %f )", v->xyz[0] + origin[0],
v->xyz[1] + origin[1], v->xyz[2] + origin[2], v->st[0], v->st[1] );
}
fp->WriteFloatString( " )\n" );
}
fp->WriteFloatString( " )\n }\n}\n" );
return true;
}
开发者ID:Kaan88,项目名称:doom3.gpl,代码行数:31,代码来源:MapFile.cpp
示例4: MaterialDepthCheck
global func MaterialDepthCheck(int x, int y, string mat, int depth)
{
var travelled;
var xval = x;
var yval = y;
//If depth is equal to zero, the function will always measure the depth of the material.
//If depth is not equal to zero, the function will return true if the material is as deep or deeper than depth (in pixels).
if (depth == nil)
depth = LandscapeHeight();
while (travelled != depth)
{
if (GetMaterial(xval, yval) == Material(mat))
{
travelled++;
yval++;
}
if (GetMaterial(xval, yval) != Material(mat))
return travelled; // Returns depth of material.
}
if (travelled == depth)
return true;
return false;
}
开发者ID:ckanibal,项目名称:openclonk,代码行数:25,代码来源:Material.c
示例5: GetMaterial
KVIonRangeTableMaterial *KVIonRangeTable::GetMaterialWithPointer(TGeoMaterial *material)
{
// Returns pointer to material for given TGeoMaterial
// We try both the name and the title of the TGeoMaterial
KVIonRangeTableMaterial *mat = GetMaterial(material->GetTitle());
if(!mat) mat = GetMaterial(material->GetName());
return mat;
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:8,代码来源:KVIonRangeTable.cpp
示例6: PFOperatorMaterialStatic
RefTargetHandle PFOperatorMaterialStatic::Clone(RemapDir &remap)
{
PFOperatorMaterialStatic* newOp = new PFOperatorMaterialStatic();
newOp->ReplaceReference(0, remap.CloneRef(pblock()));
if (GetMaterial() != NULL) newOp->SetMaterial(GetMaterial());
BaseClone(this, newOp, remap);
return newOp;
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:8,代码来源:PFOperatorMaterialStatic.cpp
示例7: PlaceObjects2
/*
* Better EarthObj Placement. Besides many new parameters it also does the following:
* - Leaves at least 10 pixels distance between each placed object
* - Makes sure they are *really* stuck in the material
* Parameters:
*
* objectid: Object to be placed
* quantity: Quantity to be planted
* rect: Target rect as array [x,y,wdt,hgt], Offset in local calls
* materials: array of materials it should be placed in. If not set, the objects will be placed in Materials with Soil=1
* nearbymaterials: material the object has to be somewhat close to
*
* Returns:
* Amount of actually placed objects (algo gives up after 10.000 iterations)
*
* Examples:
*
* PlaceObjects2(FLNT, 20, 0, LandscapeHeight()/3, LandscapeWidth(), LandscapeHeight()/3, ["Rock", "Granite"])
* - Places 20 flints inside rock and granite between 33% and 66% landscape height
*/
global func PlaceObjects2(id objectid, int quantity, array rect, array inmaterials, int nearbymaterial) {
var x = rect[0], y = rect[1], wdt = rect[2], hgt = rect[3];
var haveinmaterials = GetType(inmaterials) == C4V_Array;
// Failsafe
var attempts = 0;
var placed = 0;
// Create a dozen random places and try there
var rndx, rndy, valid, obj, matatpos;
var objhgt = GetDefHeight(objectid);
if (nearbymaterial) {
while (quantity > 0 && attempts++ < 20000) {
rndx = x + Random(wdt);
rndy = y + Random(hgt);
matatpos = GetMaterial(rndx,rndy);
if (matatpos == nearbymaterial) {
for (var i = 0; i < 8; i++) {
// Generate a random number between -10 to -4 or 4 to 10
rndx += RandomX(10, 20) * (Random(2)*2-1);
rndy += RandomX(10, 20) * (Random(2)*2-1);
matatpos = GetMaterial(rndx,rndy);
valid = false;
if (haveinmaterials) {
for (var mat in inmaterials) {
if (mat == matatpos && mat != nearbymaterial) {
valid = true;
break;
}
}
} else {
valid = isMaterialSoil(rndx, rndy);
}
if (valid) {
obj = CreateObject(objectid, rndx, rndy + objhgt / 2, -1);
obj->SetR(Random(360));
}
if (Stuck(obj)) {
placed++;
quantity--;
break;
} else {
RemoveObject(obj);
}
}
}
}
} else {
开发者ID:ev1313,项目名称:Widening-III,代码行数:77,代码来源:Landscape_PlaceObjects2.c
示例8: GetMaterial
inline static IGameMaterial* GetMaterial(size_t& index, IGameMaterial* pRootMat, IGameMaterial* pParent, int nChildID, IGameMaterial** pParentRet, int* pChildIDRet)
{
BEATS_ASSERT(pRootMat != NULL);
BEATS_ASSERT(pParentRet != NULL);
if(index == 0 && !pRootMat->IsMultiType())
{
*pParentRet = pParent;
*pChildIDRet = nChildID;
return pRootMat;
}
else if(index == 0 && pRootMat->IsMultiType())
{
int nSubMatCnt = pRootMat->GetSubMaterialCount();
for(int x = 0; x < nSubMatCnt; x++)
{
IGameMaterial* pSubMat = pRootMat->GetSubMaterial(x);
pSubMat = GetMaterial(index, pSubMat, pRootMat, x, pParentRet, pChildIDRet);
if(pSubMat != NULL)
return pSubMat;
}
}
else if(index != 0 && !pRootMat->IsMultiType())
{
index--;
int nSubMatCnt = pRootMat->GetSubMaterialCount();
for(int x = 0; x<nSubMatCnt; x++)
{
IGameMaterial* pSubMat = pRootMat->GetSubMaterial(x);
pSubMat = GetMaterial(index, pSubMat, pRootMat, x, pParentRet, pChildIDRet);
if(pSubMat != NULL)
return pSubMat;
}
}
else
{
int nSubMatCnt = pRootMat->GetSubMaterialCount();
for(int x = 0; x < nSubMatCnt; x++)
{
IGameMaterial* pSubMat = pRootMat->GetSubMaterial(x);
pSubMat = GetMaterial(index, pSubMat, pRootMat, x, pParentRet, pChildIDRet);
if(pSubMat != NULL)
return pSubMat;
}
}
return NULL;
}
开发者ID:alonecat06,项目名称:BeyondEngine,代码行数:50,代码来源:ModelExporter.cpp
示例9: GetMaterial
void CGameMtlLibrary::NameToMtlPair (LPCSTR name, int& mtl0, int& mtl1)
{
string256 buf0, buf1;
if (_GetItemCount(name,'\\')<2){
mtl0 = GAMEMTL_NONE_ID;
mtl1 = GAMEMTL_NONE_ID;
return;
}
_GetItem (name,0,buf0,'\\');
_GetItem (name,1,buf1,'\\');
_ChangeSymbol (buf0,'/','\\');
_ChangeSymbol (buf1,'/','\\');
SGameMtl* M0 = GetMaterial(buf0); mtl0=M0?M0->GetID():GAMEMTL_NONE_ID;
SGameMtl* M1 = GetMaterial(buf1); mtl1=M1?M1->GetID():GAMEMTL_NONE_ID;
}
开发者ID:2asoft,项目名称:xray,代码行数:15,代码来源:GameMtlLib_Editor.cpp
示例10: BindArgToEntity
void CPlayerViewProxy::OnBind( void *pC_BaseEntity )
{
if (!pC_BaseEntity)
return;
// Find the view angle between the player and this entity....
C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );
C_BaseEntity* pPlayer = C_BasePlayer::GetLocalPlayer();
if (!pPlayer)
return;
Vector delta;
VectorSubtract( pEntity->WorldSpaceCenter(), pPlayer->WorldSpaceCenter(), delta );
VectorNormalize( delta );
Vector forward;
AngleVectors( pPlayer->GetAbsAngles(), &forward );
Assert( m_pResult );
SetFloatResult( DotProduct( forward, delta ) * m_Factor );
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
开发者ID:Entropy-Soldier,项目名称:ges-legacy-code,代码行数:26,代码来源:proxyplayer.cpp
示例11: GetNumMaterials
void UDebugSkelMeshComponent::SetShowBoneWeight(bool bNewShowBoneWeight)
{
// Check we are actually changing it!
if(bNewShowBoneWeight == bDrawBoneInfluences)
{
return;
}
// if turning on this mode
if(bNewShowBoneWeight)
{
SkelMaterials.Empty();
int32 NumMaterials = GetNumMaterials();
for (int32 i=0; i<NumMaterials; i++)
{
// Back up old material
SkelMaterials.Add(GetMaterial(i));
// Set special bone weight material
SetMaterial(i, GEngine->BoneWeightMaterial);
}
}
// if turning it off
else
{
int32 NumMaterials = GetNumMaterials();
check(NumMaterials == SkelMaterials.Num());
for (int32 i=0; i<NumMaterials; i++)
{
// restore original material
SetMaterial(i, SkelMaterials[i]);
}
}
bDrawBoneInfluences = bNewShowBoneWeight;
}
开发者ID:VZout,项目名称:Team6UnrealEngine,代码行数:35,代码来源:DebugSkelMeshComponent.cpp
示例12: GetMaterial
Ogre::MaterialPtr Renderer::GetMaterialCopy(const String& originalName, const String& newName)
{
Ogre::MaterialPtr material = GetMaterial(originalName);
if (material.isNull())
return material;
return material->clone(newName);
}
开发者ID:JamesLinus,项目名称:dawnengine,代码行数:7,代码来源:Renderer.cpp
示例13: GetOpenGLContext
//TODO: need refine!!!
void ctLineBorders::Draw()
{
//if(!rectDotIndexes) return;
//glDisable(GL_DEPTH_TEST);
GetOpenGLContext()->functions()->glBindBuffer(GL_ARRAY_BUFFER, meshVBO);
if (posAtribLoc != -1)
{
GetOpenGLContext()->functions()->glVertexAttribPointer(posAtribLoc, 3, GL_FLOAT, GL_FALSE,
(3 * sizeof(GLfloat)), (const GLvoid*)0);
GetOpenGLContext()->functions()->glEnableVertexAttribArray(posAtribLoc);
}
else
{qDebug()<<"isShit pos!!!";}
m_currentShader->bind();
m_currentShader->setUniformValue(matrixUniform, GetProjectionMatrix().GetMatrix());
m_currentShader->setUniformValue(materialUniform, GetMaterial()->GetRGBA());
m_currentShader->setUniformValue(transformMatrixUniform, GetTransform()->GetGlobalTransformMatrix().GetMatrix());
glDrawElements(GL_LINE_LOOP, m_dots.count(), GL_UNSIGNED_SHORT, planeIndexes);
GetOpenGLContext()->functions()->glBindBuffer(GL_ARRAY_BUFFER, 0);
m_currentShader->release();
}
开发者ID:vdoom,项目名称:TestAssignment,代码行数:27,代码来源:ctLineBorders.cpp
示例14: Assert
void CWrapMinMaxProxy::OnBind( void *pC_BaseEntity )
{
Assert( m_pSrc1 && m_pResult );
if ( m_flMaxVal.GetFloat() <= m_flMinVal.GetFloat() ) // Bad input, just return the min
{
SetFloatResult( m_flMinVal.GetFloat() );
}
else
{
float flResult = ( m_pSrc1->GetFloatValue() - m_flMinVal.GetFloat() ) / ( m_flMaxVal.GetFloat() - m_flMinVal.GetFloat() );
if ( flResult >= 0.0f )
{
flResult -= ( float )( int )flResult;
}
else // Negative
{
flResult -= ( float )( ( ( int )flResult ) - 1 );
}
flResult *= ( m_flMaxVal.GetFloat() - m_flMinVal.GetFloat() );
flResult += m_flMinVal.GetFloat();
SetFloatResult( flResult );
}
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:32,代码来源:mathproxy.cpp
示例15: exp
void CExponentialProxy::OnBind( void *pC_BaseEntity )
{
float flVal = m_Scale.GetFloat() * exp(m_pSrc1->GetFloatValue( ) + m_Offset.GetFloat());
float flMaxVal = m_flMaxVal.GetFloat();
float flMinVal = m_flMinVal.GetFloat();
if (flMinVal > flMaxVal)
{
float flTemp = flMinVal;
flMinVal = flMaxVal;
flMaxVal = flTemp;
}
// clamp
if (flVal < flMinVal)
flVal = flMinVal;
else if ( flVal > flMaxVal )
flVal = flMaxVal;
SetFloatResult( flVal );
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:27,代码来源:mathproxy.cpp
示例16: if
void CGaussianNoiseProxy::OnBind( void *pC_BaseEntity )
{
float flMean = m_Mean.GetFloat();
float flStdDev = m_StdDev.GetFloat();
float flVal = randomgaussian->RandomFloat( flMean, flStdDev );
float flMaxVal = m_flMaxVal.GetFloat();
float flMinVal = m_flMinVal.GetFloat();
if (flMinVal > flMaxVal)
{
float flTemp = flMinVal;
flMinVal = flMaxVal;
flMaxVal = flTemp;
}
// clamp
if (flVal < flMinVal)
flVal = flMinVal;
else if ( flVal > flMaxVal )
flVal = flMaxVal;
SetFloatResult( flVal );
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:28,代码来源:mathproxy.cpp
示例17: Initialize
func Initialize()
{
var iTimeout,pWipf;
SetGamma(RGB(15,15,15),RGB(118,118,118),RGB(215,215,215));
SetSkyParallax(0,15,17,0,0,0,0);
//Handgemacht... ;)
Meeresrauschen(170);
Meeresrauschen(1100);
Meeresrauschen(2060);
Meeresrauschen(2900);
Meeresrauschen(3800);
Meeresrauschen(4800);
Meeresrauschen(5700);
Moewen(900);
Moewen(2300);
Moewen(3900);
Moewen(5000);
//Nebel platzieren
for(var i;i<260;++i)
CreateParticle("Fog",Random(LandscapeWidth()),Random(LandscapeHeight()*2/3),RandomX(3,9),0,RandomX(1000,1500));
//Wipfe platzieren
while(pWipf=FindObject(WIPF,0,0,0,0,0,0,0,0,pWipf)) {
iTimeout=0;
while(Stuck(pWipf)||GetMaterial(GetX(pWipf),GetY(pWipf))!=Material("Tunnel")) {
SetPosition(Random(LandscapeWidth()),RandomX(LandscapeHeight()*2/3,LandscapeHeight()),pWipf);
if(iTimeout++ > 50000) { RemoveObject(pWipf); break; }
}
}
ScriptGo(1);
}
开发者ID:ckanibal,项目名称:clonk-content,代码行数:30,代码来源:Script.c
示例18: GetMaterial
/// \brief
/// Internal function
inline MeshMaterial_t *GetSharedUVMaterial(int iMaterialIndex) const
{
MeshMaterial_t &mat = GetMaterial(iMaterialIndex);
if (mat.m_iLightmapMergeID==-1) ///< never share
return NULL;
for (int i=0;i<iMaterialIndex;i++)
{
MeshMaterial_t &other(GetMaterial(i));
if (i==iMaterialIndex || other.m_iLightmapMergeID!=mat.m_iLightmapMergeID)
continue;
if ((other.m_iOverrideFlags&PRIMITIVEFLAG_RECEIVESHADOWS)==0) // this might be a submesh with collapsed UV - don't consider it
continue; // also works for m_iOverrideFlags==-1
return &other;
}
return NULL;
}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:18,代码来源:VLightmapHelper.hpp
示例19: DrawIslands
global func DrawIslands(iX, iY, iWidth, iHeight)
{
DrawMap(iX, iY, iWidth, iHeight, "map new { overlay { algo=bozo; turbulence=100; loosebounds=1; a=10; } & overlay { algo=rndchecker; turbulence=1000; a=1; mat=Earth; tex=Rough; overlay { algo=random; mat=Earth; tex=Smooth; }; overlay InEarth { grp=1; invert=1;overlay { algo=bozo; a=6; turbulence=1000; } & overlay { algo=rndchecker; a=2;turbulence=1000; mat=Rock; tex=Rough; };}; InEarth & overlay { mat=Gold; tex=Rough; }; InEarth & overlay { mat=Coal; tex=Swirl; };};overlay { algo=poly;point { x=0px; y=0px; };point { x=1px; y=0px; };point { x=1px; y=100%; };point { x=0px; y=100%; };}; overlay { algo=poly;point { x=99%; y=0px; };point { x=100%; y=0px; };point { x=100%; y=100%; };point { x=99%; y=100%; };}; overlay { algo=poly;point { x=0%; y=0px; };point { x=100%; y=0px; };point { x=100%; y=1%; };point { x=0%; y=1%; };};overlay { algo=poly;point { x=0%; y=99%; };point { x=100%; y=99%; };point { x=100%; y=100%; };point { x=0%; y=100%; };}; };");
for(var x=0; x < iWidth; x++)
for(var y=0; y < iHeight; y++)
DrawMaterialQuad (MaterialName(GetMaterial(x+iX, y+iY)), LandscapeWidth()-x-iX, y+iY, LandscapeWidth()-x-iX, y+iY+1, LandscapeWidth()-x-iX+1, y+iY+1, LandscapeWidth()-x-iX+1, y+iY);
}
开发者ID:ckanibal,项目名称:clonk-content,代码行数:7,代码来源:Script.c
示例20: GetMaterial
void MaterialEditor::SelectMaterial(int materialIndex)
{
Material *mat = GetMaterial(materialIndex);
if(mat)
{
selectedMaterial = materialIndex;
if(noMaterials->GetParent())
{
RemoveControl(noMaterials);
}
PreparePropertiesForMaterialType(mat->type);
}
else
{
selectedMaterial = -1;
if (materialProps->GetParent())
{
RemoveControl(materialProps);
}
if(!noMaterials->GetParent())
{
AddControl(noMaterials);
}
}
}
开发者ID:abaradulkin,项目名称:dava.framework,代码行数:29,代码来源:MaterialEditor.cpp
注:本文中的GetMaterial函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论