本文整理汇总了C++中setMaterial函数的典型用法代码示例。如果您正苦于以下问题:C++ setMaterial函数的具体用法?C++ setMaterial怎么用?C++ setMaterial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setMaterial函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ColorNode
ColorNode()
: m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
{
setGeometry(&m_geometry);
QSGSimpleMaterial<State> *material = Shader::createMaterial();
material->setFlag(QSGMaterial::Blending);
setMaterial(material);
setFlag(OwnsMaterial);
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:10,代码来源:simplematerial.cpp
示例2: setActive
bool GuiMaterialCtrl::onWake()
{
if ( !Parent::onWake() )
return false;
setActive( true );
setMaterial( mMaterialName );
return true;
}
开发者ID:fr1tz,项目名称:alux3d,代码行数:10,代码来源:guiMaterialCtrl.cpp
示例3: bench
void bench( float shrink ) {
setMaterial( &benchMats );
glPushMatrix();
glTranslatef(0, 0, -shrink*BENCH_DEPTH);
box(shrink*BENCH_WIDTH, shrink*BENCH_HEIGHT, shrink*BENCH_DEPTH);
glPopMatrix();
box(shrink*BENCH_WIDTH, shrink*BENCH_HEIGHT/2, shrink*BENCH_DEPTH);
}
开发者ID:llovett,项目名称:ferriswheel,代码行数:10,代码来源:ferriswheel.cpp
示例4: m_geometry
PlotNode2D::PlotNode2D():
m_geometry(QSGGeometry::defaultAttributes_Point2D(), 0)
{
m_geometry.setDrawingMode(GL_LINE_STRIP);
m_geometry.setLineWidth(1);
//m_geometry.setVertexDataPattern(QSGGeometry::DynamicPattern);
setGeometry(&m_geometry);
setMaterial(&m_material);
}
开发者ID:jleben,项目名称:quickcollider,代码行数:10,代码来源:oscilloscope.cpp
示例5: drawHandle
void drawHandle ()
{
int i;
glPushMatrix();
glTranslatef(0, 0, -0.5);
setMaterial(plasticDiffuse, plasticSpecular, plasticShininess);
gluCylinder(qobj, 0.1, 0.1, 1.0, 12, 1);
glTranslatef(0.0, 0.0, 1.0);
if (robotMode == BADASS) {
setMaterial(beaterDiffuse, beaterSpecular, beaterShininess);
//glColor3f(0.8, 0.8, 0.8);
gluCylinder(qobj, 0.02, 0.02, 1.0, 12, 1);
for (i = 0; i < 4; i++) {
glPushMatrix();
glTranslatef(0, 0, 0.5);
glRotatef(90.0*i + beaterAngle, 0.0, 0.0, 1.0);
/*
glBegin(GL_LINE_STRIP);
glVertex3f(0.0, 0.0, 0.5);
glVertex3f(0.1, 0.0, 0.6);
glVertex3f(0.1, 0.0, 0.9);
glVertex3f(0.0, 0.0, 1.0);
glEnd();
*/
glPushMatrix();
glTranslatef(0.1, 0.0, 0.1);
gluCylinder(qobj, 0.01, 0.01, 0.3, 12, 1);
glPopMatrix();
glPushMatrix();
glRotatef(45, 0, 1, 0);
gluCylinder(qobj, 0.01, 0.01, 0.1*sqrtf(2), 12, 1);
glPopMatrix();
glPushMatrix();
glTranslatef(0.1, 0, 0.4);
glRotatef(-45, 0, 1, 0);
gluCylinder(qobj, 0.01, 0.01, 0.1*sqrtf(2), 12, 1);
glPopMatrix();
glPopMatrix();
}
}
glPopMatrix();
}
开发者ID:pombredanne,项目名称:anacrolix,代码行数:42,代码来源:robot.c
示例6: setMaterial
//! deletes all textures
void CNullDriver::deleteAllTextures()
{
// we need to remove previously set textures which might otherwise be kept in the
// last set material member. Could be optimized to reduce state changes.
setMaterial(SMaterial());
for (u32 i=0; i<Textures.size(); ++i)
Textures[i].Surface->releaseRef();
Textures.clear();
}
开发者ID:ChangerR,项目名称:dream,代码行数:12,代码来源:CNullDriver.cpp
示例7: setMaterial
FORCEINLINE void TVoxelData::initializeMaterial() {
const int s = voxel_num * voxel_num * voxel_num;
material_data = new unsigned short[s];
for (auto x = 0; x < voxel_num; x++) {
for (auto y = 0; y < voxel_num; y++) {
for (auto z = 0; z < voxel_num; z++) {
setMaterial(x, y, z, base_fill_mat);
}
}
}
}
开发者ID:bw2012,项目名称:UnrealSandboxTerrain,代码行数:11,代码来源:VoxelData.cpp
示例8: displayObject
void displayObject()
{
setMaterial();
setLighting();
setViewport();
setCamera();
//startDrawing
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
sate();//memanggil fungsi menggambar objek sate
glFlush();//mengirim semua objek untuk dirender
}
开发者ID:hindaka,项目名称:TUGAS-KELOMPOK-3D,代码行数:11,代码来源:main.cpp
示例9: mUseVertexColour
NxLine::NxLine( OperationType opType, bool UseVertexColour ) : mUseVertexColour(UseVertexColour)
{
initialize(opType,false);
setMaterial("BaseWhiteNoLighting");
mDirty = true;
setRenderQueueGroup( RENDER_QUEUE_OVERLAY - 1);
// animation spline
mAnimSpline = new SimpleSpline();
mAnimSpline->setAutoCalculate(true);
}
开发者ID:nxgraphics,项目名称:NxGraphics,代码行数:11,代码来源:NxRenderablesLines.cpp
示例10: setFlag
SGPolyLineNode::SGPolyLineNode( const QVector<QPointF>& points ) noexcept :
QSGGeometryNode{}
{
setFlag( QSGNode::OwnedByParent, true );
try {
_material = new qgl::SGPolyLineAAMaterial{};
setFlag( QSGNode::OwnsMaterial );
setMaterial( _material );
markDirty( QSGNode::DirtyMaterial );
} catch (...) { }
createGeometry(points);
}
开发者ID:cneben,项目名称:QuickQanava,代码行数:12,代码来源:qglSGPolyLineNode.cpp
示例11: setMaterial
void DynamicLines::setColor(Ogre::ColourValue color)
{
// color-coded id
unsigned int matIndex = ((unsigned int)(color.r) << 24) +
((unsigned int)(color.g) << 16) +
((unsigned int)(color.b) << 8) +
((unsigned int)(color.a));
Ogre::String matName = "DL" + Ogre::StringConverter::toString(matIndex);
Ogre::MaterialPtr materialPtr = Ogre::MaterialManager::getSingleton().createOrRetrieve(matName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME).first.staticCast<Ogre::Material>();
materialPtr->setAmbient(color);
setMaterial(matName);
}
开发者ID:onze,项目名称:Steel,代码行数:12,代码来源:DynamicLines.cpp
示例12: display
void
display(void)
{
if (useSpecularTexture && needsLightUpdate) {
setMaterial(MAT_GEN_SPECULAR_TEXTURE);
needsLightUpdate = GL_FALSE;
}
redraw();
glFlush();
glutSwapBuffers();
checkErrors();
}
开发者ID:hiteshsathawane,项目名称:Cube-Rotation,代码行数:12,代码来源:envphong.c
示例13: m_geometry
QSGNinePatchNode::QSGNinePatchNode()
: m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0)
, m_horizontalTileMode(QSGBorderImage::Stretch)
, m_verticalTileMode(QSGBorderImage::Stretch)
, m_dirtyGeometry(false)
, m_mirror(false)
{
setOpaqueMaterial(&m_material);
setMaterial(&m_materialO);
setGeometry(&m_geometry);
m_geometry.setDrawingMode(GL_TRIANGLES);
}
开发者ID:yinyunqiao,项目名称:qtdeclarative,代码行数:12,代码来源:qsgninepatchnode.cpp
示例14: m_geometry
AddChain::Node::Node(std::vector<QPointF> pts)
: m_geometry({{2, GL_FLOAT}}, pts.size() + 1, sizeof(QVector2D)) {
setMaterial(&m_material);
setGeometry(&m_geometry);
m_geometry.setDrawingMode(GL_LINE_STRIP);
QVector2D* array = m_geometry.vertexData<QVector2D>();
for (size_t i = 0; i < pts.size(); i++)
array[i] = QVector2D(pts[i].x(), pts[i].y());
array[pts.size()] = array[pts.size() - 1];
m_geometry.updateVertexData();
}
开发者ID:lemourin,项目名称:GameEngine,代码行数:12,代码来源:AddChain.cpp
示例15: QWidget
QgsPhongMaterialWidget::QgsPhongMaterialWidget( QWidget *parent )
: QWidget( parent )
{
setupUi( this );
setMaterial( QgsPhongMaterialSettings() );
connect( btnDiffuse, &QgsColorButton::colorChanged, this, &QgsPhongMaterialWidget::changed );
connect( btnAmbient, &QgsColorButton::colorChanged, this, &QgsPhongMaterialWidget::changed );
connect( btnSpecular, &QgsColorButton::colorChanged, this, &QgsPhongMaterialWidget::changed );
connect( spinShininess, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsPhongMaterialWidget::changed );
}
开发者ID:CS-SI,项目名称:QGIS,代码行数:12,代码来源:qgsphongmaterialwidget.cpp
示例16: Sprite
TextSprite::TextSprite(MaterialPtr material, const std::string &text, FontPtr font, PropertiesPtr properties)
: Sprite(), _text(text), _font(font)
{
// Create geometry
createGeometry();
// Add atlas texture to the material
material->setTexture(bRenderer::DEFAULT_SHADER_UNIFORM_CHARACTER_MAP(), font->getAtlas());
setMaterial(material);
setProperties(properties);
}
开发者ID:CglProject,项目名称:underwater-2,代码行数:12,代码来源:TextSprite.cpp
示例17: PatternAnimation
Player::Player(Updatable* parent) : PatternAnimation(parent, NULL, textureResources.get("character"),
Vector2ui(0, 0), Vector2ui(0, 0), Vector2ui(118, 99), Vector2ui(3, 1), 3, 10), m_shots(NULL), m_nbShots(0), m_orientation(AHEAD), m_currentWeapon(NULL)
{
m_updateFocus = false;
m_currentWeapon = new MachineGun(this, NULL);
m_weapons.add("MachineGun", m_currentWeapon);
m_currentWeapon = new ShotGun(this, NULL);
m_weapons.add("ShotGun", m_currentWeapon);
setMaterial(&m_textureMaterial);
scale(glm::vec3(0.22, 0.15, 1.0));
setPositionOrigin(glm::vec3(0.5, 0.5, 0.0), true);
}
开发者ID:MickaelSERENO,项目名称:ZombieAttack,代码行数:12,代码来源:Player.cpp
示例18: setTranslate
void flag::drawObject() {
GLenum errCode;
const GLubyte *errString;
//glPushMatrix();
//glLoadIdentity();
setTranslate();
setRotate();
if(colorMode == _glColor) {
glEnable(GL_COLOR_MATERIAL);
setColor();
} else {
glDisable(GL_COLOR_MATERIAL);
}
setScale();
//qDebug() << "Drawing object\n";
glBindTexture(GL_TEXTURE_2D,textureId);
if ((errCode = glGetError()) != GL_NO_ERROR) {
errString = gluErrorString(errCode);
qDebug() << "OpenGL Error: 8" << errCode;
}
setMaterial();
if ((errCode = glGetError()) != GL_NO_ERROR) {
errString = gluErrorString(errCode);
qDebug() << "OpenGL Error: 9" << errCode;
}
glBegin(GL_TRIANGLES);
for(int i = 0; i < vertices.size();i++) {
glNormal3f(normals.at(i).x(), normals.at(i).y(), normals.at(i).z());
glTexCoord2f(textures.at(i).x(), textures.at(i).y());
glVertex3f(vertices.at(i).x(), vertices.at(i).y(), vertices.at(i).z());
}
glEnd();
if ((errCode = glGetError()) != GL_NO_ERROR) {
errString = gluErrorString(errCode);
qDebug() << "OpenGL Error: 10" << errCode;
}
glBindTexture(GL_TEXTURE_2D,0);
if ((errCode = glGetError()) != GL_NO_ERROR) {
errString = gluErrorString(errCode);
qDebug() << "OpenGL Error: 11" << errCode;
}
//glPopMatrix();
if(debug) {
debug = false;
}
}
开发者ID:xeii,项目名称:ComputerGraphics,代码行数:53,代码来源:flag.cpp
示例19: createGameObject
std::shared_ptr<MeshRenderer> Scene::createPlane(GameObject *gameObject){
if (!gameObject) {
gameObject = createGameObject("Plane");
}
auto meshRenderer = gameObject->addComponent<MeshRenderer>();
auto mesh = make_shared<Mesh>();
mesh->setMeshData(MeshFactory::createPlaneData());
meshRenderer->setMesh(mesh);
Material* mat = Project::createMaterial("assets/shaders/diffuse.shader");
meshRenderer->setMaterial(mat);
return meshRenderer;
}
开发者ID:buffer8848,项目名称:kick,代码行数:13,代码来源:scene.cpp
示例20: setSphere
// Specify the values of a sphere struct in the fragment shader
void setSphere(GLuint shaderProgram, const char *sphereName, Vec3 point, float radius, Material mat)
{
char sphereMember[30];
strcpy(sphereMember, sphereName);
strcat(sphereMember, ".center");
glUniform3f(glGetUniformLocation(shaderProgram, sphereMember), point[0], point[1], point[2]);
strcpy(sphereMember, sphereName);
strcat(sphereMember, ".radius");
glUniform1f(glGetUniformLocation(shaderProgram, sphereMember), radius);
setMaterial(shaderProgram, sphereName, mat);
}
开发者ID:entropian,项目名称:glslraytracer,代码行数:14,代码来源:main.cpp
注:本文中的setMaterial函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论