Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPerVertexColorMateral Qusetion

QPerVertexColorMateral Qusetion

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 293 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    ofmrew
    wrote on last edited by
    #1

    I use a ply file with color for each vertex, namely:
    ply
    format ascii 1.0
    element vertex 5
    property float32 x
    property float32 y
    property float32 z
    property uchar red
    property uchar green
    property uchar blue
    element face 6
    property list uint8 int32 vertex_index
    end_header
    0 0 0 225 0 0
    10 5 0 0 225 0
    10 -5 0 0 0 225
    7 2 4 225 225 0
    7 -2 4 0 225 225
    3 0 4 3
    3 0 3 1
    3 4 1 3
    3 2 1 4
    3 0 2 4
    3 0 2 1

    However, Qt 3D shows it as I black object, while MeshLab show the color. The code snippet shows the material and lighting:
    Qt3DExtras::QPerVertexColorMaterial *material = new Qt3DExtras::QPerVertexColorMaterial;

    Qt3DRender::QMesh *flyingwedgeMesh = new Qt3DRender::QMesh;
    flyingwedgeMesh->setMeshName("FlyingWedge");
    flyingwedgeMesh->setSource(data);
    Qt3DCore::QTransform *flyingwedgeTransform = new Qt3DCore::QTransform;
    flyingwedgeTransform->setScale3D(QVector3D(1.0, 1.0, 1.0));
    Qt3DRender::QFrontFace *frontFace = new Qt3DRender::QFrontFace(rootEntity);
    frontFace->setDirection(Qt3DRender::QFrontFace::CounterClockWise);
    flyingwedge->addComponent(flyingwedgeMesh);
    flyingwedge->addComponent(material);
    flyingwedge->addComponent(flyingwedgeTransform);
    
    Qt3DCore::QEntity *lightEntity = new Qt3DCore::QEntity(rootEntity);
    Qt3DRender::QPointLight *light = new Qt3DRender::QPointLight(lightEntity);
    light->setColor("white");
    light->setIntensity(0.5);
    lightEntity->addComponent(light);
    Qt3DCore::QTransform *lightTransform = new Qt3DCore::QTransform(lightEntity);
    lightTransform->setTranslation(QVector3D(60, 0, 40.0f));
    lightEntity->addComponent(lightTransform);
    

    What am I missing?

    1 Reply Last reply
    1

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved