Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/unlin/libbwabstraction
02 July 2024, 03:47:45 UTC
  • Code
  • Branches (3)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/v0.1
    • refs/tags/v0.2
    • 8c90648f07f68d37b9b0ad0581e44fa069aa758a
    No releases to show
  • e393547
  • /
  • examples
  • /
  • 02_rotation.cpp
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:53cbd6e8f163080a79a39186efa5def53a88b706
origin badgedirectory badge
swh:1:dir:dff328e068346ece3b9c6d02be7067bc0eae6d09
origin badgerevision badge
swh:1:rev:8c90648f07f68d37b9b0ad0581e44fa069aa758a
origin badgesnapshot badge
swh:1:snp:cb883043adc01860813783e30023d60370b3e719

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 8c90648f07f68d37b9b0ad0581e44fa069aa758a authored by unlin on 24 October 2019, 15:04:51 UTC
Update Readme.md.
Tip revision: 8c90648
02_rotation.cpp
// Example code for multiple render with different viewing angles.

#include <bwabstraction.hpp>
#include <opencv2/opencv.hpp>

// include glm for mvp computation.
#include <glm/vec3.hpp>
#include <glm/mat4x4.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/transform.hpp>

int main(void)
{
    bwabstraction::BWAbstraction bwa;
    bwabstraction::Result result;
    bwabstraction::Parameters param;
    param.verbose = true;

    // once a model is loaded, it can be rendered multiple times.
    if(!bwa.LoadModel("model/DualShock3.obj", param))
    {
        exit(1);
    }

    glm::mat4 mvp = 
        glm::perspective(30.0f, 4.0f / 3.0f, 0.1f, 3.0f) *
        glm::lookAt(glm::vec3(2.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
    glm::mat4 rotation = glm::rotate(30.0f, glm::vec3(0.0f, 0.0f, 1.0f));

    // render the model in a loop, updating param.mvpMatrix each time.
    for (int i = 0; i < 6; ++i)
    {
        mvp = mvp * rotation;
        memcpy(param.mvpMatrix, glm::value_ptr(mvp), sizeof(float) * 16);
        bwa.Render(&result, param);
        char filename[15];
        sprintf(filename, "bwaImage%d.png", i);
        cv::imwrite(filename, result.bwaImage);
    }

    #ifdef _MSC_VER
    system("PAUSE");
    #endif

    return 0;
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API