Exemplo n.º 1
0
shared_ptr<VertexBuffer> createQuad2(const VertexFormat &vf, float x, float y, float w, float h, GpuBufferUsageType usage)
{
    // TODO_REFACTO remove this shit!!!

    float w2 = w / 2.0f;
    float h2 = h / 2.0f;

    float quad_pos[][2] =
    {
        { x - w2, y - h2 },
        { x + w2, y - h2 },
        { x + w2, y + h2 },
        { x + w2, y + h2 },
        { x - w2, y + h2 },
        { x - w2, y - h2 }
    };
    float quad_uv[][2] =
    {
        { 0.0, 0.0 },
        { 1.0, 0.0 },
        { 1.0, 1.0 },
        { 1.0, 1.0 },
        { 0.0, 1.0 },
        { 0.0, 0.0 }
    };

    VertexData vertexData(vf);

    for (int i = 0; i < 6; i++)
    {
        auto v = vertexData.allocVertex();

        v.setPosition({ quad_pos[i][0], quad_pos[i][1], 0.0f });
        v.setTx({ quad_uv[i][0], quad_uv[i][1] });
        v.setColor({ 1.0f, 1.0f, 1.0f, 1.0f });
    }

    auto result = make_shared<VertexBuffer>(vf);
    result->alloc(vertexData, usage);

    return result;
}
Exemplo n.º 2
0
/**
 * Creates a new DataStore object with the given input information
 *
 * @param sourceRef specifies the source address from the associated
 *                  command - NOT NULL
 * @param displayName the display name
 * @param maxGUIDSize the maximum GUID size. Set to -1 if the Maximum GUID
 *                  size is unknown or unspecified. Otherwise, this
 *                  parameter should be a positive number.
 * @param rxPref the relative information received to the content type
 *               preferred - NOT NULL
 * @param rx an array of the relative info received to the content type
 *           supported - NOT NULL
 * @param txPref the relative information trasmitted
 *                  to the content type preferred - NOT NULL
 * @param tx an array of the relative info trasmitted to the content type
 *           supported - NOT NULL
 * @param ctCaps an array of the relative CtCaps
 * @param dsMem the datastore memory info
 * @param syncCap the synchronization capabilities - NOT NULL
 *
 */
DataStore::DataStore(SourceRef* sourceRef,
                      const char* displayName,
                      long maxGUIDSize,
                      ContentTypeInfo* rxPref,
                      ArrayList* rx,
                      ContentTypeInfo* txPref,
                      ArrayList* tx,
                      ArrayList* ct_Caps,
                      DSMem* dsMem,
                      SyncCap* syncCap) {

        initialize();
        setSourceRef(sourceRef);
        setMaxGUIDSize(maxGUIDSize);
        setRxPref(rxPref);
        setRx(rx);
        setTxPref(txPref);
        setTx(tx);
        setSyncCap(syncCap);
        setCtCaps(ct_Caps);
        setDisplayName(displayName);
        setDSMem(dsMem);
}