コード例 #1
0
ファイル: render.cpp プロジェクト: b3sigma/fourd
bool Render::Initialize(int width, int height) {
  m_bufferWidth = width;
  m_bufferHeight = height;
  UpdateViewHeightFromBuffer();

  std::unique_ptr<Shader> overdraw(new Shader());
  overdraw->AddDynamicMeshCommonSubShaders();
  if(!overdraw->LoadFromFileDerivedNames("OverdrawRainbow")) {
    return false;
  }
  m_pOverdrawQuaxol = overdraw.release();

  std::unique_ptr<Shader> sliced(new Shader());
  sliced->AddDynamicMeshCommonSubShaders();
  if(!sliced->LoadFromFileDerivedNames("Sliced")) {
    return false;
  }
  m_pSlicedQuaxol = sliced.release();

  std::unique_ptr<Shader> compose(new Shader());
  if(!compose->LoadFromFile(
      "Compose", "data/uivCompose.glsl", "data/uifCompose.glsl")) {
    return false;
  }
  m_pComposeRenderTargets = compose.release();

  if(!ResizeRenderTargets(width, height))
    return false;

  if(!InitializeComposeVerts())
    return false;

  return true;
}
コード例 #2
0
ファイル: Material.cpp プロジェクト: UIKit0/resinlib
Material::Material(Material_t tag)
    : tag(tag),
      vertexShader(this),
      fragmentShader(this),
      index0AttributeName(this)
{
    mId = Material::MaterialIdCount++;

    mUuid = Math::generateUUID();

    mName = "";

    side() = kFrontSide;

    opacity() = 1.0f;
    transparent() = false;

    blending() = kNormalBlending;

    blendSrc() = kSrcAlphaFactor;
    blendDst() = kOneMinusSrcAlphaFactor;
    blendEquation() = kAddEquation;

    depthTest() = true;
    depthWrite() = true;

    polygonOffset() = false;
    polygonOffsetFactor() = 0;
    polygonOffsetUnits() = 0;

    // mAlphaTest = 0;

    overdraw() = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer

    visible() = true;

    needsUpdate() = true;

    // By default, bind position to attribute index 0. In WebGL, attribute 0
    // should always be used to avoid potentially expensive emulation.
    index0AttributeName("position");

    linewidth() = 1.0f;
    metal() = false;
    perPixel() = true;
    shading() = kNoShading;
	vertexColors() = kNoColors;
    wireframe() = false;
    wireframeLinewidth() = 1.0f;
}