Ejemplo n.º 1
0
  protected void CreateBracketMesh() {
    // System.err.println( iWidth + " " + iHeight + " " + iDepth );
    Attributes kAttributes = new Attributes();
    kAttributes.SetPChannels(3);

    int iVQuantity = 3;
    VertexBuffer pkVB = new VertexBuffer(kAttributes, iVQuantity);

    // generate geometry

    float[] afChannels = pkVB.GetData();
    int iIndex = 0;
    afChannels[iIndex++] = 0;
    afChannels[iIndex++] = -1.0f;
    afChannels[iIndex++] = 0.0f;
    afChannels[iIndex++] = 0;
    afChannels[iIndex++] = 0.0f;
    afChannels[iIndex++] = 0.5f;
    afChannels[iIndex++] = 0;
    afChannels[iIndex++] = 0.95f;
    afChannels[iIndex++] = 1.0f;

    m_kBracketPoints = new Polypoint(pkVB);
    AlphaState kAlpha = new AlphaState();
    kAlpha.BlendEnabled = true;
    kAlpha.SrcBlend = AlphaState.SrcBlendMode.SBF_ONE;
    kAlpha.DstBlend = AlphaState.DstBlendMode.DBF_ONE;
    m_kBracketPoints.AttachGlobalState(kAlpha);
    m_kBracketPoints.UpdateGS();
    m_kBracketPoints.UpdateRS();
  }
Ejemplo n.º 2
0
  protected void CreateHistogramMesh(int iWidth, int iHeight) {
    Attributes kAttributes = new Attributes();
    kAttributes.SetPChannels(3);

    int iVQuantity = iWidth * iHeight;
    VertexBuffer pkVB = new VertexBuffer(kAttributes, iVQuantity);

    // generate geometry
    float fInv0 = 1.0f / (iWidth);
    float fInv1 = 1.0f / (iHeight);
    float fU, fV;
    int i0, i1;

    float[] afChannels = pkVB.GetData();
    int iIndex = 0;

    for (i1 = 0; i1 < iHeight; i1++) {
      fV = i1 * fInv1;
      for (i0 = 0; i0 < iWidth; i0++) {
        fU = i0 * fInv0;
        afChannels[iIndex++] = ((2.0f * fU - 1.0f));
        afChannels[iIndex++] = ((2.0f * fV - 1.0f));
        afChannels[iIndex++] = 0f;

        // System.err.println( ((2.0f*fU-1.0f)) + " " + ((2.0f*fV-1.0f)));
      }
    }
    m_kHistogramPoints2D = new Polypoint(pkVB);
    m_kEntropyPoints2D = new Polypoint(pkVB);

    AlphaState kAlpha = new AlphaState();
    kAlpha.BlendEnabled = true;
    kAlpha.SrcBlend = AlphaState.SrcBlendMode.SBF_ONE;
    kAlpha.DstBlend = AlphaState.DstBlendMode.DBF_ONE;

    m_kHistogramPoints2D.AttachGlobalState(kAlpha);
    m_kHistogramPoints2D.UpdateGS();
    m_kHistogramPoints2D.UpdateRS();

    m_kEntropyPoints2D.AttachGlobalState(kAlpha);
    m_kEntropyPoints2D.UpdateGS();
    m_kEntropyPoints2D.UpdateRS();
  }
Ejemplo n.º 3
0
  protected ResourceIdentifier CreateImageMesh(int iWidth, int iHeight, int iDepth) {
    // System.err.println( iWidth + " " + iHeight + " " + iDepth );
    Attributes kAttributes = new Attributes();
    kAttributes.SetPChannels(3);

    int iVQuantity = iWidth * iHeight * iDepth;
    VertexBuffer pkVB = new VertexBuffer(kAttributes, iVQuantity);

    // generate geometry
    float fInv0 = 1.0f / (iWidth - 1.0f);
    float fInv1 = 1.0f / (iHeight - 1.0f);
    float fInv2 = 1.0f / (iDepth);
    float fU, fV, fW;
    int i0, i1, i2;

    float[] afChannels = pkVB.GetData();
    int iIndex = 0;

    for (i2 = 0; i2 < iDepth; i2++) {
      fW = i2 * fInv2;
      for (i1 = 0; i1 < iHeight; i1++) {
        fV = i1 * fInv1;
        for (i0 = 0; i0 < iWidth; i0++) {
          fU = i0 * fInv0;
          afChannels[iIndex++] = ((2.0f * fU - 1.0f));
          afChannels[iIndex++] = ((2.0f * fV - 1.0f));
          afChannels[iIndex++] = ((2.0f * fW - 1.0f));
        }
      }
    }

    m_kImagePointsDual = new Polypoint(pkVB);
    m_kAlpha = new AlphaState();
    m_kAlpha.BlendEnabled = true;
    m_kAlpha.SrcBlend = AlphaState.SrcBlendMode.SBF_ONE;
    m_kAlpha.DstBlend = AlphaState.DstBlendMode.DBF_ONE;
    m_kImagePointsDual.AttachGlobalState(m_kAlpha);
    m_kImagePointsDual.UpdateGS();
    m_kImagePointsDual.UpdateRS();

    return m_pkRenderer.LoadVBuffer(pkVB.GetAttributes(), pkVB.GetAttributes(), pkVB);
  }