本文整理汇总了C++中GetMaterial函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMaterial函数的具体用法?C++ GetMaterial怎么用?C++ GetMaterial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMaterial函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 {
示例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;
}
示例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;
}
示例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() );
}
}
示例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;
}
示例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);
}
示例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();
}
示例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() );
}
}
示例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() );
}
}