QString Z3DImage2DRenderer::generateHeader()
{
    QString headerSource = Z3DPrimitiveRenderer::generateHeader();

    if (hasVolume()) {
        if (m_volumes[0]) {
            headerSource += "#define VOLUME_1_EXIST\n";
        }
        if (m_volumes[1]) {
            headerSource += "#define VOLUME_2_EXIST\n";
        }
        if (m_volumes[2]) {
            headerSource += "#define VOLUME_3_EXIST\n";
        }
        if (m_volumes[3]) {
            headerSource += "#define VOLUME_4_EXIST\n";
        }
        if (m_volumes[4]) {
            headerSource += "#define VOLUME_5_EXIST\n";
        }
    } else {
        headerSource += "#define DISABLE_TEXTURE_COORD_OUTPUT\n";
    }

    return headerSource;
}
void Z3DImage2DRenderer::render(Z3DEye eye)
{
    if (!m_initialized)
        return;

    bool needRender = hasVolume() && !m_quads.empty();
    if (!needRender)
        return;

    m_image2DShader.bind();
    m_rendererBase->setGlobalShaderParameters(m_image2DShader, eye);

    bindVolumes(m_image2DShader);

    for (size_t i=0; i<m_quads.size(); ++i)
        renderTriangleList(m_image2DShader, m_quads[i]);

    m_image2DShader.release();
}
示例#3
0
char *wb_nrep::nameName(const char *n, int ntype, char *res)
{
  static char result[512];
  int colon_added = 0;

  if ( !res)
    res = result;
  if ( ntype & cdh_mName_volume && ntype & cdh_mName_object)
    ntype |= cdh_mName_path;
  if ( ntype & cdh_mName_path && ntype & cdh_mName_attribute)
    ntype |= cdh_mName_object;
  if ( ntype & cdh_mName_volume && ntype & cdh_mName_attribute)
    ntype = ntype | cdh_mName_path | cdh_mName_object;
  strcpy( res, "");

  if ( ntype & cdh_mName_idString) {
#if 0
    if ( ntype & cdh_mName_volume) printf( "wname: volume\n");
    if ( ntype & cdh_mName_object) printf( "wname: object\n");
    if ( ntype & cdh_mName_attribute) printf( "wname: attribute\n");
#endif
    if ( !(ntype & cdh_mName_attribute)) {
      if ( ntype & cdh_mName_volume && !(ntype & cdh_mName_object))
        strcat( res, "_V");
      else if ( !(ntype & cdh_mName_volume))
        strcat( res, "_X");
      else
        strcat( res, "_O");
    }
    else
      strcat( res, "_A");
  }
  if ( ntype & cdh_mName_volume)
    volumeName( n, res + strlen(res));
  else if ( ntype & cdh_mName_ref)
    volumeName( n, res + strlen(res));
  if ( ntype & cdh_mName_path) {
    if ( ntype & cdh_mName_volume && hasVolume()) {
      strcat( res, ":");
      colon_added = 1;
    }
    pathName( n, res + strlen(res));
  }
  if ( ntype & cdh_mName_object) {
    if ( ntype & cdh_mName_path && hasPath())
      strcat( res, "-");
    else if ( ntype & cdh_mName_volume && !hasPath() && hasVolume() && !colon_added)
      strcat( res, ":");
    objectName( n, res + strlen(res));
  }
  if ( ntype & cdh_mName_attribute && hasAttribute()) {
    if ( !m_hasSuper || m_shadowed || ntype & cdh_mName_trueAttr) {
      strcat( res, ".");
      strcat( res, n + attr[0].offs);
    }
    else {
      for ( int i = 0; i < num_attr; i++) {
	if ( !attr[i].isSuper) {
	  strcat( res, ".");
	  int l = strlen(res);
	  strncat( res, n + attr[i].offs, attr[i].len);
	  if ( attr[i].index != -1)
	    sprintf( &res[ l + attr[i].len], "[%d]", attr[i].index);
	  else
	  res[ l + attr[i].len] = 0;
	}
      }
    }
  }
  return res;
}