hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
109
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
48.5k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a7f1bb691a74cb7a47e0e0fe8076658cdb0b8887
| 40,903
|
cpp
|
C++
|
toonz/sources/tnztools/plastictool_meshedit.cpp
|
wofogen/tahoma2d
|
ce5a89a7b1027b2c1769accb91184a2ee6442b4d
|
[
"BSD-3-Clause"
] | 3,710
|
2016-03-26T00:40:48.000Z
|
2022-03-31T21:35:12.000Z
|
toonz/sources/tnztools/plastictool_meshedit.cpp
|
wofogen/tahoma2d
|
ce5a89a7b1027b2c1769accb91184a2ee6442b4d
|
[
"BSD-3-Clause"
] | 4,246
|
2016-03-26T01:21:45.000Z
|
2022-03-31T23:10:47.000Z
|
toonz/sources/tnztools/plastictool_meshedit.cpp
|
wofogen/tahoma2d
|
ce5a89a7b1027b2c1769accb91184a2ee6442b4d
|
[
"BSD-3-Clause"
] | 633
|
2016-03-26T00:42:25.000Z
|
2022-03-17T02:55:13.000Z
|
// TnzCore includes
#include "tmeshimage.h"
#include "tgl.h"
#include "tundo.h"
// TnzExt includes
#include "ext/plasticdeformerstorage.h"
// tcg includes
#include "tcg/tcg_macros.h"
#include "tcg/tcg_point_ops.h"
#include <unordered_set>
#include <unordered_map>
using namespace tcg::bgl;
#include <boost/graph/breadth_first_search.hpp>
// STD includes
#include <stack>
#include "plastictool.h"
using namespace PlasticToolLocals;
//****************************************************************************************
// Local namespace stuff
//****************************************************************************************
namespace {
typedef PlasticTool::MeshIndex MeshIndex;
typedef TTextureMesh::vertex_type vertex_type;
typedef TTextureMesh::edge_type edge_type;
typedef TTextureMesh::face_type face_type;
//------------------------------------------------------------------------
bool borderEdge(const TTextureMesh &mesh, int e) {
return (mesh.edge(e).facesCount() < 2);
}
bool borderVertex(const TTextureMesh &mesh, int v) {
const TTextureVertex &vx = mesh.vertex(v);
tcg::vertex_traits<TTextureVertex>::edges_const_iterator et,
eEnd(vx.edgesEnd());
for (et = vx.edgesBegin(); et != eEnd; ++et) {
if (borderEdge(mesh, *et)) return true;
}
return false;
}
//============================================================================
bool testSwapEdge(const TTextureMesh &mesh, int e) {
return (mesh.edge(e).facesCount() == 2);
}
//------------------------------------------------------------------------
bool testCollapseEdge(const TTextureMesh &mesh, int e) {
struct Locals {
const TTextureMesh &m_mesh;
int m_e;
const TTextureMesh::edge_type &m_ed;
bool testTrianglesCount() {
// There must be at least one remanining triangle
return (m_mesh.facesCount() > m_ed.facesCount());
}
bool testBoundary() {
// Must not join two non-adjacent boundary vertices
return (!borderVertex(m_mesh, m_ed.vertex(0)) ||
!borderVertex(m_mesh, m_ed.vertex(1)) || borderEdge(m_mesh, m_e));
}
bool testAdjacency() {
// See TriMesh<>::collapseEdge()
// Retrieve allowed adjacent vertices
int f, fCount = m_ed.facesCount();
int allowedV[6], *avt, *avEnd = allowedV + 3 * fCount;
for (f = 0, avt = allowedV; f != fCount; ++f, avt += 3)
m_mesh.faceVertices(m_ed.face(f), avt[0], avt[1], avt[2]);
// Test adjacent vertices
int v0 = m_ed.vertex(0), v1 = m_ed.vertex(1);
const vertex_type &vx0 = m_mesh.vertex(v0);
tcg::vertex_traits<vertex_type>::edges_const_iterator et,
eEnd = vx0.edgesEnd();
for (et = vx0.edgesBegin(); et != eEnd; ++et) {
int otherV = m_mesh.edge(*et).otherVertex(v0);
if (m_mesh.edgeInciding(v1, otherV) >= 0) {
// Adjacent vertex - must be found in the allowed list
if (std::find(allowedV, avEnd, otherV) == avEnd) return false;
}
}
return true;
}
} locals = {mesh, e, mesh.edge(e)};
return (locals.testTrianglesCount() && locals.testBoundary() &&
locals.testAdjacency());
}
} // namespace
//****************************************************************************************
// PlasticToolLocals stuff
//****************************************************************************************
namespace PlasticToolLocals {
struct Closer {
const TTextureMesh &m_mesh;
TPointD m_pos;
double dist2(const TTextureMesh::vertex_type &a) {
return tcg::point_ops::dist2<TPointD>(a.P(), m_pos);
}
double dist2(const TTextureMesh::edge_type &a) {
const TTextureMesh::vertex_type &avx0 = m_mesh.vertex(a.vertex(0)),
&avx1 = m_mesh.vertex(a.vertex(1));
return sq(tcg::point_ops::segDist<TPointD>(avx0.P(), avx1.P(), m_pos));
}
bool operator()(const TTextureMesh::vertex_type &a,
const TTextureMesh::vertex_type &b) {
return (dist2(a) < dist2(b));
}
bool operator()(const TTextureMesh::edge_type &a,
const TTextureMesh::edge_type &b) {
return (dist2(a) < dist2(b));
}
};
//==============================================================================
static std::pair<double, int> closestVertex(const TTextureMesh &mesh,
const TPointD &pos) {
Closer closer = {mesh, pos};
int vIdx = int(
std::min_element(mesh.vertices().begin(), mesh.vertices().end(), closer)
.index());
return std::make_pair(closer.dist2(mesh.vertex(vIdx)), vIdx);
}
//------------------------------------------------------------------------
static std::pair<double, int> closestEdge(const TTextureMesh &mesh,
const TPointD &pos) {
Closer closer = {mesh, pos};
int eIdx =
int(std::min_element(mesh.edges().begin(), mesh.edges().end(), closer)
.index());
return std::make_pair(closer.dist2(mesh.edge(eIdx)), eIdx);
}
//------------------------------------------------------------------------
std::pair<double, MeshIndex> closestVertex(const TMeshImage &mi,
const TPointD &pos) {
std::pair<double, MeshIndex> closest((std::numeric_limits<double>::max)(),
MeshIndex());
const TMeshImage::meshes_container &meshes = mi.meshes();
TMeshImage::meshes_container::const_iterator mt, mEnd = meshes.end();
for (mt = meshes.begin(); mt != mEnd; ++mt) {
const std::pair<double, int> &candidateIdx = closestVertex(**mt, pos);
std::pair<double, MeshIndex> candidate(
candidateIdx.first,
MeshIndex(mt - meshes.begin(), candidateIdx.second));
if (candidate < closest) closest = candidate;
}
return closest;
}
//------------------------------------------------------------------------
std::pair<double, MeshIndex> closestEdge(const TMeshImage &mi,
const TPointD &pos) {
std::pair<double, MeshIndex> closest((std::numeric_limits<double>::max)(),
MeshIndex());
const TMeshImage::meshes_container &meshes = mi.meshes();
TMeshImage::meshes_container::const_iterator mt, mEnd = meshes.end();
for (mt = meshes.begin(); mt != mEnd; ++mt) {
const std::pair<double, int> &candidateIdx = closestEdge(**mt, pos);
std::pair<double, MeshIndex> candidate(
candidateIdx.first,
MeshIndex(mt - meshes.begin(), candidateIdx.second));
if (candidate < closest) closest = candidate;
}
return closest;
}
} // namespace
//****************************************************************************************
// Cut Mesh operation
//****************************************************************************************
namespace {
struct EdgeCut {
int m_vIdx; //!< Vertex index to cut from.
int m_eIdx; //!< Edge index to cut.
EdgeCut(int vIdx, int eIdx) : m_vIdx(vIdx), m_eIdx(eIdx) {}
};
struct VertexOccurrence {
int m_count; //!< Number of times a vertex occurs.
int m_adjacentEdgeIdx[2]; //!< Edge indexes of which a vertex is endpoint.
};
//============================================================================
bool buildEdgeCuts(const TMeshImage &mi,
const PlasticTool::MeshSelection &edgesSelection,
int &meshIdx, std::vector<EdgeCut> &edgeCuts) {
typedef PlasticTool::MeshSelection::objects_container edges_container;
typedef PlasticTool::MeshIndex MeshIndex;
typedef std::unordered_map<int, VertexOccurrence> VertexOccurrencesMap;
struct locals {
static bool differentMesh(const MeshIndex &a, const MeshIndex &b) {
return (a.m_meshIdx != b.m_meshIdx);
}
static int testSingleMesh(const edges_container &edges) {
assert(!edges.empty());
return (std::find_if(edges.begin(), edges.end(),
[&edges](const MeshIndex &x) {
return differentMesh(x, edges.front());
}) == edges.end())
? edges.front().m_meshIdx
: -1;
}
static bool testNoBoundaryEdge(const TTextureMesh &mesh,
const edges_container &edges) {
edges_container::const_iterator et, eEnd = edges.end();
for (et = edges.begin(); et != eEnd; ++et)
if (::borderEdge(mesh, et->m_idx)) return false;
return true;
}
static bool buildVertexOccurrences(
const TTextureMesh &mesh, const edges_container &edges,
VertexOccurrencesMap &vertexOccurrences) {
// Calculate vertex occurrences as edge endpoints
edges_container::const_iterator et, eEnd = edges.end();
for (et = edges.begin(); et != eEnd; ++et) {
const edge_type &ed = mesh.edge(et->m_idx);
int v0 = ed.vertex(0), v1 = ed.vertex(1);
VertexOccurrence &vo0 = vertexOccurrences[v0],
&vo1 = vertexOccurrences[v1];
if (vo0.m_count > 1 || vo1.m_count > 1) return false;
vo0.m_adjacentEdgeIdx[vo0.m_count++] =
vo1.m_adjacentEdgeIdx[vo1.m_count++] = et->m_idx;
}
return true;
}
static bool buildEdgeCuts(const TTextureMesh &mesh,
const edges_container &edges,
std::vector<EdgeCut> &edgeCuts) {
VertexOccurrencesMap vertexOccurrences;
if (!buildVertexOccurrences(mesh, edges, vertexOccurrences)) return false;
// Build endpoints (exactly 2)
int endPoints[2];
int epCount = 0;
VertexOccurrencesMap::iterator ot, oEnd = vertexOccurrences.end();
for (ot = vertexOccurrences.begin(); ot != oEnd; ++ot) {
if (ot->second.m_count == 1) {
if (epCount > 1) return false;
endPoints[epCount++] = ot->first;
}
}
if (epCount != 2) return false;
// Pick the first endpoint on the boundary, if any (otherwise, just pick
// one)
int *ept, *epEnd = endPoints + 2;
ept = std::find_if(endPoints, epEnd,
[&mesh](int v) { return borderVertex(mesh, v); });
if (ept == epEnd) {
// There is no boundary endpoint
if (edges.size() < 2) // We should not cut the mesh on a
return false; // single edge - no vertex to duplicate!
ept = endPoints;
}
// Build the edge cuts list, expanding the edges selection from
// the chosen endpoint
edgeCuts.push_back(EdgeCut( // Build the first EdgeCut separately
*ept, vertexOccurrences[*ept].m_adjacentEdgeIdx[0]));
int e, eCount = int(edges.size()); // Build the remaining ones
for (e = 1; e != eCount; ++e) {
const EdgeCut &lastCut = edgeCuts.back();
int vIdx = mesh.edge(lastCut.m_eIdx).otherVertex(lastCut.m_vIdx);
const int(&adjEdges)[2] = vertexOccurrences[vIdx].m_adjacentEdgeIdx;
int eIdx = (adjEdges[0] == lastCut.m_eIdx) ? adjEdges[1] : adjEdges[0];
edgeCuts.push_back(EdgeCut(vIdx, eIdx));
}
return true;
}
};
const edges_container &edges = edgesSelection.objects();
// Trivial early bailouts
if (edges.empty()) return false;
// Selected edges must lie on the same mesh
meshIdx = locals::testSingleMesh(edges);
if (meshIdx < 0) return false;
const TTextureMesh &mesh = *mi.meshes()[meshIdx];
// No selected edge must be on the boundary
return (locals::testNoBoundaryEdge(mesh, edges) &&
locals::buildEdgeCuts(mesh, edges, edgeCuts));
}
//------------------------------------------------------------------------
inline bool testCutMesh(const TMeshImage &mi,
const PlasticTool::MeshSelection &edgesSelection) {
std::vector<EdgeCut> edgeCuts;
int meshIdx;
return buildEdgeCuts(mi, edgesSelection, meshIdx, edgeCuts);
}
//------------------------------------------------------------------------
void slitMesh(TTextureMesh &mesh,
int e) //! Opens a slit along the specified edge index.
{
TTextureMesh::edge_type &ed = mesh.edge(e);
assert(ed.facesCount() == 2);
// Duplicate the edge and pass one face to the duplicate
TTextureMesh::edge_type edDup(ed.vertex(0), ed.vertex(1));
int f = ed.face(1);
edDup.addFace(f);
ed.eraseFace(ed.facesBegin() + 1);
int eDup = mesh.addEdge(edDup);
// Alter the face to host the duplicate
TTextureMesh::face_type &fc = mesh.face(f);
(fc.edge(0) == e)
? fc.setEdge(0, eDup)
: (fc.edge(1) == e) ? fc.setEdge(1, eDup) : fc.setEdge(2, eDup);
}
//------------------------------------------------------------------------
/*!
\brief Duplicates a mesh edge-vertex pair (the 'cut') and separates their
connections to adjacent mesh primitives.
\remark The starting vertex is supposed to be on the mesh boundary.
\remark Edges with a single neighbouring face can be duplicated, too.
*/
void cutEdge(TTextureMesh &mesh, const EdgeCut &edgeCut) {
struct locals {
static void transferEdge(TTextureMesh &mesh, int e, int vFrom, int vTo) {
edge_type &ed = mesh.edge(e);
vertex_type &vxFrom = mesh.vertex(vFrom), &vxTo = mesh.vertex(vTo);
(ed.vertex(0) == vFrom) ? ed.setVertex(0, vTo) : ed.setVertex(1, vTo);
vxTo.addEdge(e);
vxFrom.eraseEdge(
std::find(vxFrom.edges().begin(), vxFrom.edges().end(), e));
}
static void transferFace(TTextureMesh &mesh, int eFrom, int eTo) {
edge_type &edFrom = mesh.edge(eFrom), &edTo = mesh.edge(eTo);
int f = mesh.edge(eFrom).face(1);
{
face_type &fc = mesh.face(f);
(fc.edge(0) == eFrom)
? fc.setEdge(0, eTo)
: (fc.edge(1) == eFrom) ? fc.setEdge(1, eTo) : fc.setEdge(2, eTo);
edTo.addFace(f);
edFrom.eraseFace(edFrom.facesBegin() + 1);
}
}
}; // locals
int vOrig = edgeCut.m_vIdx, eOrig = edgeCut.m_eIdx;
// Create a new vertex at the same position of the original
int vDup = mesh.addVertex(vertex_type(mesh.vertex(vOrig).P()));
int e = eOrig;
if (mesh.edge(e).facesCount() == 2) {
// Duplicate the cut edge
e = mesh.addEdge(edge_type(vDup, mesh.edge(eOrig).otherVertex(vOrig)));
// Transfer one face from the original to the duplicate
locals::transferFace(mesh, eOrig, e);
} else {
// Transfer the original edge to the duplicate vertex
locals::transferEdge(mesh, eOrig, vOrig, vDup);
}
// Edges adjacent to the original vertex that are also adjacent
// to the transferred face above must be transferred too
int f = mesh.edge(e).face(0);
while (f >= 0) {
// Retrieve the next edge to transfer
int otherE = mesh.otherFaceEdge(f, mesh.edge(e).otherVertex(vDup));
// NOTE: Not "mesh.edgeInciding(vOrig, mesh.otherFaceVertex(f, e))" in the
// calculation
// of otherE. This is required since by transferring each edge at a
// time,
// we're 'breaking' faces up - f is adjacent to both vOrig AND vDup!
//
// The chosen calculation, instead, just asks for the one edge which
// does
// not have a specific vertex in common to the 2 other edges in the
// face.
locals::transferEdge(mesh, otherE, vOrig, vDup);
// Update e and f
e = otherE;
f = mesh.edge(otherE).otherFace(f);
}
}
//------------------------------------------------------------------------
}
namespace locals_ { // Need to use a named namespace due to
// a known gcc 4.2 bug with compiler-generated
struct VertexesRecorder // copy constructors.
{
std::unordered_set<int> &m_examinedVertexes;
public:
typedef boost::on_examine_vertex event_filter;
public:
VertexesRecorder(std::unordered_set<int> &examinedVertexes)
: m_examinedVertexes(examinedVertexes) {}
void operator()(int v, const TTextureMesh &) { m_examinedVertexes.insert(v); }
};
}
namespace { //
void splitUnconnectedMesh(TMeshImage &mi, int meshIdx) {
struct locals {
static void buildConnectedComponent(const TTextureMesh &mesh,
std::unordered_set<int> &vertexes) {
// Prepare BFS algorithm
std::unique_ptr<UCHAR[]> colorMapP(new UCHAR[mesh.vertices().nodesCount()]());
locals_::VertexesRecorder vertexesRecorder(vertexes);
std::stack<int> verticesQueue;
// Launch it
boost::breadth_first_visit(
mesh, int(mesh.vertices().begin().index()), verticesQueue,
boost::make_bfs_visitor(vertexesRecorder), colorMapP.get());
}
}; // locals
// Retrieve the list of vertexes in the first connected component
TTextureMesh &origMesh = *mi.meshes()[meshIdx];
std::unordered_set<int> firstComponent;
locals::buildConnectedComponent(origMesh, firstComponent);
if (firstComponent.size() == origMesh.verticesCount()) return;
// There are (exactly) 2 connected components. Just duplicate the mesh
// and keep/delete found vertexes.
TTextureMeshP dupMeshPtr(new TTextureMesh(origMesh));
TTextureMesh &dupMesh = *dupMeshPtr;
TTextureMesh::vertices_container &vertices = origMesh.vertices();
TTextureMesh::vertices_container::iterator vt, vEnd = vertices.end();
for (vt = vertices.begin(); vt != vEnd;) {
int v = int(vt.index());
++vt;
if (firstComponent.count(v))
dupMesh.removeVertex(v);
else
origMesh.removeVertex(v);
}
dupMesh.squeeze();
origMesh.squeeze();
mi.meshes().push_back(dupMeshPtr);
}
//------------------------------------------------------------------------
void splitMesh(TMeshImage &mi, int meshIdx, int lastBoundaryVertex) {
// Retrieve a cutting edge with a single adjacent face - cutting that
// will just duplicate the vertex and separate the mesh in 2 connected
// components
TTextureMesh &mesh = *mi.meshes()[meshIdx];
int e;
{
const vertex_type &lbVx = mesh.vertex(lastBoundaryVertex);
vertex_type::edges_const_iterator et =
std::find_if(lbVx.edgesBegin(), lbVx.edgesEnd(),
[&mesh](int e) { return borderEdge(mesh, e); });
assert(et != lbVx.edgesEnd());
e = *et;
}
cutEdge(mesh, EdgeCut(lastBoundaryVertex, e));
// At this point, separate the 2 resulting connected components
// in 2 separate meshes (if necessary)
splitUnconnectedMesh(mi, meshIdx);
}
//------------------------------------------------------------------------
bool cutMesh(TMeshImage &mi, const PlasticTool::MeshSelection &edgesSelection) {
struct locals {
static int lastVertex(const TTextureMesh &mesh,
const std::vector<EdgeCut> &edgeCuts) {
return mesh.edge(edgeCuts.back().m_eIdx)
.otherVertex(edgeCuts.back().m_vIdx);
}
static int lastBoundaryVertex(const TTextureMesh &mesh,
const std::vector<EdgeCut> &edgeCuts) {
int v = lastVertex(mesh, edgeCuts);
return ::borderVertex(mesh, v) ? v : -1;
}
}; // locals
std::vector<EdgeCut> edgeCuts;
int meshIdx;
if (!::buildEdgeCuts(mi, edgesSelection, meshIdx, edgeCuts)) return false;
TTextureMesh &mesh = *mi.meshes()[meshIdx];
int lastBoundaryVertex = locals::lastBoundaryVertex(mesh, edgeCuts);
// Slit the mesh on the first edge, in case the cuts do not start
// on the mesh boundary
std::vector<EdgeCut>::iterator ecBegin = edgeCuts.begin();
if (!::borderVertex(mesh, ecBegin->m_vIdx)) {
::slitMesh(mesh, ecBegin->m_eIdx);
++ecBegin;
}
// Cut edges, in the order specified by edgeCuts
std::for_each(ecBegin, edgeCuts.end(), [&mesh](const EdgeCut &edgeCut) {
return cutEdge(mesh, edgeCut);
});
// Finally, the mesh could have been split in 2 - we need to separate
// the pieces if needed
if (lastBoundaryVertex >= 0) splitMesh(mi, meshIdx, lastBoundaryVertex);
return true;
}
} // namespace
//****************************************************************************************
// Undo definitions
//****************************************************************************************
namespace {
class MoveVertexUndo_Mesh final : public TUndo {
int m_row, m_col; //!< Xsheet coordinates
std::vector<MeshIndex> m_vIdxs; //!< Moved vertices
std::vector<TPointD> m_origVxsPos; //!< Original vertex positions
TPointD m_posShift; //!< Vertex positions shift
public:
MoveVertexUndo_Mesh(const std::vector<MeshIndex> &vIdxs,
const std::vector<TPointD> &origVxsPos,
const TPointD &posShift)
: m_row(::row())
, m_col(::column())
, m_vIdxs(vIdxs)
, m_origVxsPos(origVxsPos)
, m_posShift(posShift) {
assert(m_vIdxs.size() == m_origVxsPos.size());
}
int getSize() const override {
return int(sizeof(*this) +
m_vIdxs.size() * (sizeof(int) + 2 * sizeof(TPointD)));
}
void redo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
l_plasticTool.setMeshVertexesSelection(m_vIdxs);
l_plasticTool.moveVertex_mesh(m_origVxsPos, m_posShift);
l_plasticTool.invalidate();
l_plasticTool
.notifyImageChanged(); // IMPORTANT: In particular, sets the level's
} // dirty flag, so Toonz knows it has
// to be saved!
void undo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
l_plasticTool.setMeshVertexesSelection(m_vIdxs);
l_plasticTool.moveVertex_mesh(m_origVxsPos, TPointD());
l_plasticTool.invalidate();
l_plasticTool.notifyImageChanged();
}
};
//==============================================================================
class SwapEdgeUndo final : public TUndo {
int m_row, m_col; //!< Xsheet coordinates
mutable MeshIndex m_edgeIdx; //!< Edge index
public:
SwapEdgeUndo(const MeshIndex &edgeIdx)
: m_row(::row()), m_col(::column()), m_edgeIdx(edgeIdx) {}
int getSize() const override { return sizeof(*this); }
void redo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
const TMeshImageP &mi = TMeshImageP(TTool::getImage(true));
assert(mi);
// Perform swap
TTextureMesh &mesh = *mi->meshes()[m_edgeIdx.m_meshIdx];
m_edgeIdx.m_idx = mesh.swapEdge(m_edgeIdx.m_idx);
assert(m_edgeIdx.m_idx >= 0);
// Invalidate any deformer associated with mi
PlasticDeformerStorage::instance()->releaseMeshData(mi.getPointer());
// Update tool selection
l_plasticTool.setMeshEdgesSelection(m_edgeIdx);
l_plasticTool.invalidate();
l_plasticTool.notifyImageChanged();
}
void undo() const override { redo(); } // Operation is idempotent (indices
// are perfectly restored, too)
};
//==============================================================================
class TTextureMeshUndo : public TUndo {
protected:
int m_row, m_col; //!< Xsheet coordinates
int m_meshIdx; //!< Mesh index in the image at stored xsheet coords
mutable TTextureMesh m_origMesh; //!< Copy of the original mesh
public:
TTextureMeshUndo(int meshIdx)
: m_row(::row()), m_col(::column()), m_meshIdx(meshIdx) {}
// Let's say 1MB each - storing the mesh is costly
int getSize() const override { return 1 << 20; }
TMeshImageP getMeshImage() const {
const TMeshImageP &mi = TMeshImageP(TTool::getImage(true));
assert(mi);
return mi;
}
};
//==============================================================================
class CollapseEdgeUndo final : public TTextureMeshUndo {
int m_eIdx; //!< Collapsed edge index
public:
CollapseEdgeUndo(const MeshIndex &edgeIdx)
: TTextureMeshUndo(edgeIdx.m_meshIdx), m_eIdx(edgeIdx.m_idx) {}
void redo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
const TMeshImageP &mi = getMeshImage();
// Store the original mesh
TTextureMesh &mesh = *mi->meshes()[m_meshIdx];
m_origMesh = mesh;
// Collapse
mesh.collapseEdge(m_eIdx);
mesh.squeeze();
// Invalidate any cached deformer associated with the modified mesh image
PlasticDeformerStorage::instance()->releaseMeshData(mi.getPointer());
// Refresh the tool
l_plasticTool.clearMeshSelections();
l_plasticTool.invalidate();
l_plasticTool.notifyImageChanged();
}
void undo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
const TMeshImageP &mi = getMeshImage();
// Restore the original mesh
TTextureMesh &mesh = *mi->meshes()[m_meshIdx];
mesh = m_origMesh;
PlasticDeformerStorage::instance()->releaseMeshData(mi.getPointer());
// Restore selection
l_plasticTool.setMeshEdgesSelection(MeshIndex(m_meshIdx, m_eIdx));
l_plasticTool.invalidate();
l_plasticTool.notifyImageChanged();
}
};
//==============================================================================
class SplitEdgeUndo final : public TTextureMeshUndo {
int m_eIdx; //!< Split edge index
public:
SplitEdgeUndo(const MeshIndex &edgeIdx)
: TTextureMeshUndo(edgeIdx.m_meshIdx), m_eIdx(edgeIdx.m_idx) {}
void redo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
const TMeshImageP &mi = getMeshImage();
// Store the original mesh
TTextureMesh &mesh = *mi->meshes()[m_meshIdx];
m_origMesh = mesh;
// Split
mesh.splitEdge(m_eIdx);
// mesh.squeeze(); //
// There should be no need to squeeze
assert(mesh.vertices().size() == mesh.vertices().nodesCount()); //
assert(mesh.edges().size() == mesh.edges().nodesCount()); //
assert(mesh.faces().size() == mesh.faces().nodesCount()); //
PlasticDeformerStorage::instance()->releaseMeshData(mi.getPointer());
l_plasticTool.clearMeshSelections();
l_plasticTool.invalidate();
l_plasticTool.notifyImageChanged();
}
void undo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
const TMeshImageP &mi = getMeshImage();
// Restore the original mesh
TTextureMesh &mesh = *mi->meshes()[m_meshIdx];
mesh = m_origMesh;
PlasticDeformerStorage::instance()->releaseMeshData(mi.getPointer());
// Restore selection
l_plasticTool.setMeshEdgesSelection(MeshIndex(m_meshIdx, m_eIdx));
l_plasticTool.invalidate();
l_plasticTool.notifyImageChanged();
}
};
//==============================================================================
class CutEdgesUndo final : public TUndo {
int m_row, m_col; //!< Xsheet coordinates
TMeshImageP m_origImage; //!< Clone of the original image
PlasticTool::MeshSelection m_edgesSelection; //!< Selection to operate on
public:
CutEdgesUndo(const PlasticTool::MeshSelection &edgesSelection)
: m_row(::row())
, m_col(::column())
, m_origImage(TTool::getImage(false)->cloneImage())
, m_edgesSelection(edgesSelection) {}
int getSize() const override { return 1 << 20; }
bool do_() const {
TMeshImageP mi = TTool::getImage(true);
if (::cutMesh(*mi, m_edgesSelection)) {
PlasticDeformerStorage::instance()->releaseMeshData(mi.getPointer());
l_plasticTool.clearMeshSelections();
l_plasticTool.invalidate();
l_plasticTool.notifyImageChanged();
return true;
}
return false;
}
void redo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
bool ret = do_();
(void)ret;
assert(ret);
}
void undo() const override {
PlasticTool::TemporaryActivation tempActivate(m_row, m_col);
TMeshImageP mi = TTool::getImage(true);
// Restore the original image
*mi = *m_origImage;
PlasticDeformerStorage::instance()->releaseMeshData(mi.getPointer());
// Restore selection
l_plasticTool.setMeshEdgesSelection(m_edgesSelection);
l_plasticTool.invalidate();
l_plasticTool.notifyImageChanged();
}
};
} // namespace
//****************************************************************************************
// PlasticTool functions
//****************************************************************************************
void PlasticTool::storeMeshImage() {
TMeshImageP mi = getImage(false);
if (mi != m_mi) {
m_mi = mi;
clearMeshSelections();
}
}
//------------------------------------------------------------------------
void PlasticTool::setMeshSelection(MeshSelection &target,
const MeshSelection &newSel) {
if (newSel.isEmpty()) {
target.selectNone();
target.makeNotCurrent();
return;
}
target.setObjects(newSel.objects());
target.notifyView();
target.makeCurrent();
}
//------------------------------------------------------------------------
void PlasticTool::toggleMeshSelection(MeshSelection &target,
const MeshSelection &addition) {
typedef MeshSelection::objects_container objects_container;
const objects_container &storedIdxs = target.objects();
const objects_container &addedIdxs = addition.objects();
// Build new selection
objects_container selectedIdxs;
if (target.contains(addition)) {
std::set_difference(storedIdxs.begin(), storedIdxs.end(), addedIdxs.begin(),
addedIdxs.end(), std::back_inserter(selectedIdxs));
} else {
std::set_union(storedIdxs.begin(), storedIdxs.end(), addedIdxs.begin(),
addedIdxs.end(), std::back_inserter(selectedIdxs));
}
setMeshSelection(target, selectedIdxs);
}
//------------------------------------------------------------------------
void PlasticTool::clearMeshSelections() {
m_mvHigh = m_meHigh = MeshIndex();
m_mvSel.selectNone();
m_mvSel.makeNotCurrent();
m_meSel.selectNone();
m_meSel.makeNotCurrent();
}
//------------------------------------------------------------------------
void PlasticTool::setMeshVertexesSelection(const MeshSelection &vSel) {
setMeshSelection(m_meSel, MeshSelection()), setMeshSelection(m_mvSel, vSel);
}
//------------------------------------------------------------------------
void PlasticTool::toggleMeshVertexesSelection(const MeshSelection &vSel) {
setMeshSelection(m_meSel, MeshSelection()),
toggleMeshSelection(m_mvSel, vSel);
}
//------------------------------------------------------------------------
void PlasticTool::setMeshEdgesSelection(const MeshSelection &eSel) {
setMeshSelection(m_meSel, eSel), setMeshSelection(m_mvSel, MeshSelection());
}
//------------------------------------------------------------------------
void PlasticTool::toggleMeshEdgesSelection(const MeshSelection &eSel) {
toggleMeshSelection(m_meSel, eSel),
setMeshSelection(m_mvSel, MeshSelection());
}
//------------------------------------------------------------------------
void PlasticTool::mouseMove_mesh(const TPointD &pos, const TMouseEvent &me) {
// Track mouse position
m_pos = pos; // Needs to be done now - ensures m_pos is valid
m_mvHigh = MeshIndex(); // Reset highlighted primitives
if (m_mi) {
// Look for nearest primitive
std::pair<double, MeshIndex> closestVertex = ::closestVertex(*m_mi, pos),
closestEdge = ::closestEdge(*m_mi, pos);
// Discriminate on fixed metric
const double hDistSq = sq(getPixelSize() * MESH_HIGHLIGHT_DISTANCE);
m_mvHigh = m_meHigh = MeshIndex();
if (closestEdge.first < hDistSq) m_meHigh = closestEdge.second;
if (closestVertex.first < hDistSq)
m_mvHigh = closestVertex.second, m_meHigh = MeshIndex();
}
assert(!(m_mvHigh &&
m_meHigh)); // Vertex and edge highlights are mutually exclusive
invalidate();
}
//------------------------------------------------------------------------
void PlasticTool::leftButtonDown_mesh(const TPointD &pos,
const TMouseEvent &me) {
struct Locals {
PlasticTool *m_this;
void updateSelection(MeshSelection &sel, const MeshIndex &idx,
const TMouseEvent &me) {
if (idx) {
MeshSelection newSel(idx);
if (me.isCtrlPressed())
m_this->toggleMeshSelection(sel, newSel);
else if (!sel.contains(newSel))
m_this->setMeshSelection(sel, newSel);
} else
m_this->setMeshSelection(sel, MeshSelection());
}
} locals = {this};
// Track mouse position
m_pressedPos = m_pos = pos;
// Update selection
locals.updateSelection(m_mvSel, m_mvHigh, me);
locals.updateSelection(m_meSel, m_meHigh, me);
// Store original vertex positions
if (!m_mvSel.isEmpty()) {
std::vector<TPointD> v;
for (auto const &e : m_mvSel.objects()) {
v.push_back(m_mi->meshes()[e.m_meshIdx]->vertex(e.m_idx).P());
}
m_pressedVxsPos = std::move(v);
}
// Redraw selections
invalidate();
}
//------------------------------------------------------------------------
void PlasticTool::leftButtonDrag_mesh(const TPointD &pos,
const TMouseEvent &me) {
// Track mouse position
m_pos = pos;
if (!m_mvSel.isEmpty()) {
moveVertex_mesh(m_pressedVxsPos, pos - m_pressedPos);
invalidate();
}
}
//------------------------------------------------------------------------
void PlasticTool::leftButtonUp_mesh(const TPointD &pos, const TMouseEvent &me) {
// Track mouse position
m_pos = pos;
if (m_dragged && !m_mvSel.isEmpty()) {
TUndoManager::manager()->add(new MoveVertexUndo_Mesh(
m_mvSel.objects(), m_pressedVxsPos, pos - m_pressedPos));
invalidate();
notifyImageChanged(); // Sets the level's dirty flag -.-'
}
}
//------------------------------------------------------------------------
void PlasticTool::addContextMenuActions_mesh(QMenu *menu) {
bool ret = true;
if (!m_meSel.isEmpty()) {
if (m_meSel.hasSingleObject()) {
const MeshIndex &mIdx = m_meSel.objects().front();
const TTextureMesh &mesh = *m_mi->meshes()[mIdx.m_meshIdx];
if (::testSwapEdge(mesh, mIdx.m_idx)) {
QAction *swapEdge = menu->addAction(tr("Swap Edge"));
ret = ret && connect(swapEdge, SIGNAL(triggered()), &l_plasticTool,
SLOT(swapEdge_mesh_undo()));
}
if (::testCollapseEdge(mesh, mIdx.m_idx)) {
QAction *collapseEdge = menu->addAction(tr("Collapse Edge"));
ret = ret && connect(collapseEdge, SIGNAL(triggered()), &l_plasticTool,
SLOT(collapseEdge_mesh_undo()));
}
QAction *splitEdge = menu->addAction(tr("Split Edge"));
ret = ret && connect(splitEdge, SIGNAL(triggered()), &l_plasticTool,
SLOT(splitEdge_mesh_undo()));
}
if (::testCutMesh(*m_mi, m_meSel)) {
QAction *cutEdges = menu->addAction(tr("Cut Mesh"));
ret = ret && connect(cutEdges, SIGNAL(triggered()), &l_plasticTool,
SLOT(cutEdges_mesh_undo()));
}
menu->addSeparator();
}
assert(ret);
}
//------------------------------------------------------------------------
void PlasticTool::moveVertex_mesh(const std::vector<TPointD> &origVxsPos,
const TPointD &posShift) {
if (m_mvSel.isEmpty() || !m_mi) return;
assert(origVxsPos.size() == m_mvSel.objects().size());
// Move selected vertices
TMeshImageP mi = getImage(true);
assert(m_mi == mi);
int v, vCount = int(m_mvSel.objects().size());
for (v = 0; v != vCount; ++v) {
const MeshIndex &meshIndex = m_mvSel.objects()[v];
TTextureMesh &mesh = *mi->meshes()[meshIndex.m_meshIdx];
mesh.vertex(meshIndex.m_idx).P() = origVxsPos[v] + posShift;
}
// Mesh must be recompiled
PlasticDeformerStorage::instance()->invalidateMeshImage(
mi.getPointer(), PlasticDeformerStorage::MESH);
}
//------------------------------------------------------------------------
void PlasticTool::swapEdge_mesh_undo() {
if (!(m_mi && m_meSel.hasSingleObject())) return;
// Test current edge swapability
{
const MeshIndex &eIdx = m_meSel.objects().front();
const TTextureMesh &mesh = *m_mi->meshes()[eIdx.m_meshIdx];
if (!::testSwapEdge(mesh, eIdx.m_idx)) return;
}
// Perform operation
std::unique_ptr<TUndo> undo(new SwapEdgeUndo(m_meSel.objects().front()));
undo->redo();
TUndoManager::manager()->add(undo.release());
}
//------------------------------------------------------------------------
void PlasticTool::collapseEdge_mesh_undo() {
if (!(m_mi && m_meSel.hasSingleObject())) return;
// Test collapsibility of current edge
{
const MeshIndex &eIdx = m_meSel.objects().front();
const TTextureMesh &mesh = *m_mi->meshes()[eIdx.m_meshIdx];
if (!::testCollapseEdge(mesh, eIdx.m_idx)) return;
}
// Perform operation
std::unique_ptr<TUndo> undo(new CollapseEdgeUndo(m_meSel.objects().front()));
undo->redo();
TUndoManager::manager()->add(undo.release());
}
//------------------------------------------------------------------------
void PlasticTool::splitEdge_mesh_undo() {
if (!(m_mi && m_meSel.hasSingleObject())) return;
std::unique_ptr<TUndo> undo(new SplitEdgeUndo(m_meSel.objects().front()));
undo->redo();
TUndoManager::manager()->add(undo.release());
}
//------------------------------------------------------------------------
void PlasticTool::cutEdges_mesh_undo() {
if (!m_mi) return;
std::unique_ptr<CutEdgesUndo> undo(new CutEdgesUndo(m_meSel.objects()));
if (undo->do_()) TUndoManager::manager()->add(undo.release());
}
//------------------------------------------------------------------------
void PlasticTool::draw_mesh() {
struct Locals {
PlasticTool *m_this;
double m_pixelSize;
void drawLine(const TPointD &a, const TPointD &b) {
glVertex2d(a.x, a.y);
glVertex2d(b.x, b.y);
}
void drawVertexSelections() {
typedef MeshSelection::objects_container objects_container;
const objects_container &objects = m_this->m_mvSel.objects();
glColor3ub(255, 0, 0); // Red
glLineWidth(1.0f);
const double hSize = MESH_SELECTED_HANDLE_SIZE * m_pixelSize;
objects_container::const_iterator vt, vEnd = objects.end();
for (vt = objects.begin(); vt != vEnd; ++vt) {
const TTextureVertex &vx =
m_this->m_mi->meshes()[vt->m_meshIdx]->vertex(vt->m_idx);
::drawFullSquare(vx.P(), hSize);
}
}
void drawEdgeSelections() {
typedef MeshSelection::objects_container objects_container;
const objects_container &objects = m_this->m_meSel.objects();
glColor3ub(0, 0, 255); // Blue
glLineWidth(2.0f);
glBegin(GL_LINES);
objects_container::const_iterator et, eEnd = objects.end();
for (et = objects.begin(); et != eEnd; ++et) {
const TTextureVertex
&vx0 =
m_this->m_mi->meshes()[et->m_meshIdx]->edgeVertex(et->m_idx, 0),
&vx1 =
m_this->m_mi->meshes()[et->m_meshIdx]->edgeVertex(et->m_idx, 1);
drawLine(vx0.P(), vx1.P());
}
glEnd();
}
void drawVertexHighlights() {
if (m_this->m_mvHigh) {
const MeshIndex &vHigh = m_this->m_mvHigh;
const TTextureMesh::vertex_type &vx =
m_this->m_mi->meshes()[vHigh.m_meshIdx]->vertex(vHigh.m_idx);
glColor3ub(255, 0, 0); // Red
glLineWidth(1.0f);
const double hSize = MESH_HIGHLIGHTED_HANDLE_SIZE * m_pixelSize;
::drawSquare(vx.P(), hSize);
}
}
void drawEdgeHighlights() {
if (m_this->m_meHigh) {
const MeshIndex &eHigh = m_this->m_meHigh;
const TTextureMesh::vertex_type
&vx0 = m_this->m_mi->meshes()[eHigh.m_meshIdx]->edgeVertex(
eHigh.m_idx, 0),
&vx1 = m_this->m_mi->meshes()[eHigh.m_meshIdx]->edgeVertex(
eHigh.m_idx, 1);
{
glPushAttrib(GL_LINE_BIT);
glEnable(GL_LINE_STIPPLE);
glLineStipple(1, 0xCCCC);
glColor3ub(0, 0, 255); // Blue
glLineWidth(1.0f);
glBegin(GL_LINES);
drawLine(vx0.P(), vx1.P());
glEnd();
glPopAttrib();
}
}
}
} locals = {this, getPixelSize()};
// The selected mesh image is already drawn by the stage
// Draw additional overlays
if (m_mi) {
locals.drawVertexSelections();
locals.drawEdgeSelections();
locals.drawVertexHighlights();
locals.drawEdgeHighlights();
}
}
| 30.479136
| 90
| 0.580202
|
wofogen
|
a7f814f7ebc4bed353133b5972952fb54527b965
| 886
|
cpp
|
C++
|
test/tests/SimpleHashTesterOneI1.cpp
|
asidorov95/momo
|
ebede4ba210ac1fa614bb2571a526e7591a92b56
|
[
"MIT"
] | null | null | null |
test/tests/SimpleHashTesterOneI1.cpp
|
asidorov95/momo
|
ebede4ba210ac1fa614bb2571a526e7591a92b56
|
[
"MIT"
] | null | null | null |
test/tests/SimpleHashTesterOneI1.cpp
|
asidorov95/momo
|
ebede4ba210ac1fa614bb2571a526e7591a92b56
|
[
"MIT"
] | null | null | null |
/**********************************************************\
This file is distributed under the MIT License.
See https://github.com/morzhovets/momo/blob/master/LICENSE
for details.
tests/SimpleHashTesterOneI1.cpp
\**********************************************************/
#include "pch.h"
#include "TestSettings.h"
#ifdef TEST_SIMPLE_HASH
#ifdef TEST_OLD_HASH_BUCKETS
#undef NDEBUG
#include "SimpleHashTester.h"
#include "../../momo/details/HashBucketOneI1.h"
static int testSimpleHash = []
{
SimpleHashTester::TestStrHash<momo::HashBucketOneI1>("momo::HashBucketOneI1");
SimpleHashTester::TestTemplHashSet<momo::HashBucketOneI1, 1, 1>("momo::HashBucketOneI1");
SimpleHashTester::TestTemplHashSet<momo::HashBucketOneI1, 4, 2>("momo::HashBucketOneI1");
return 0;
}();
#endif // TEST_OLD_HASH_BUCKETS
#endif // TEST_SIMPLE_HASH
| 25.314286
| 91
| 0.630926
|
asidorov95
|
a7f965c884f9128c82b4a7ae6c6cb4f2e574a753
| 819
|
hpp
|
C++
|
fileid/document/excel/structures/formulas/PtgRange.hpp
|
DBHeise/fileid
|
3e3bacf859445020999d0fc30301ac86973c3737
|
[
"MIT"
] | 13
|
2016-03-13T17:57:46.000Z
|
2021-12-21T12:11:41.000Z
|
fileid/document/excel/structures/formulas/PtgRange.hpp
|
DBHeise/fileid
|
3e3bacf859445020999d0fc30301ac86973c3737
|
[
"MIT"
] | 9
|
2016-04-07T13:07:58.000Z
|
2020-05-30T13:31:59.000Z
|
fileid/document/excel/structures/formulas/PtgRange.hpp
|
DBHeise/fileid
|
3e3bacf859445020999d0fc30301ac86973c3737
|
[
"MIT"
] | 5
|
2017-04-20T14:47:55.000Z
|
2021-03-08T03:27:17.000Z
|
#pragma once
#include "../../../../common.hpp"
#include "../../MSExcel.common.hpp"
#include "../../IParsable.hpp"
#include "Ptg.hpp"
namespace oless {
namespace excel {
namespace structures {
namespace formulas {
// see: https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/f5ef334a-bc47-41ce-ba5d-096373423fab
// ptg=0x11
// The PtgRange structure specifies the range operation, where the minimum bounding rectangle of the first expression and the second expression is generated.
class PtgRange : public PtgBasic {
private:
public:
PtgRange(unsigned char* buffer, size_t max, unsigned int offset):PtgBasic() { this->Parse(buffer, max, offset); }
std::string to_string() const override {
return "PtgRange";
}
};
}
}
}
}
| 25.59375
| 161
| 0.665446
|
DBHeise
|
a7f98fccc20b4653c7ece5a6a83abcc8f605d9b6
| 1,173
|
cpp
|
C++
|
procrender/src/GeneticAlgoScene.cpp
|
crest01/ShapeGenetics
|
7321f6484be668317ad763c0ca5e4d6cbfef8cd1
|
[
"MIT"
] | 18
|
2017-04-26T13:53:43.000Z
|
2021-05-29T03:55:27.000Z
|
procrender/src/GeneticAlgoScene.cpp
|
crest01/ShapeGenetics
|
7321f6484be668317ad763c0ca5e4d6cbfef8cd1
|
[
"MIT"
] | null | null | null |
procrender/src/GeneticAlgoScene.cpp
|
crest01/ShapeGenetics
|
7321f6484be668317ad763c0ca5e4d6cbfef8cd1
|
[
"MIT"
] | 2
|
2017-10-17T10:32:01.000Z
|
2019-11-11T07:23:54.000Z
|
/*
* GeneticAlgoScene.cpp
*
* Created on: Nov 2, 2015
* Author: Karl Haubenwallner
*/
#include "GeneticAlgoScene.h"
GeneticAlgoScene::GeneticAlgoScene(const std::string& filename):
seed(217197128u),
genetic_algo(PGA::ProceduralAlgorithm_impl::createFromConfig(filename)),
_current_generation(0)
{
}
double GeneticAlgoScene::recombine(bool restart)
{
//genetic_algo->reset();
//genetic_algo->doOneGeneration();
genetic_algo->run();
_current_generation ++;
return 0.0f;
}
double GeneticAlgoScene::generate()
{
auto t0 = std::chrono::high_resolution_clock::now();
genetic_algo->generateGeometry();
auto t1 = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t1 - t0);
return time_span.count();
}
void GeneticAlgoScene::getVoxels(std::vector<math::float4>& centers)
{
genetic_algo->getVoxels(centers);
}
void GeneticAlgoScene::getGeometry(std::vector<PGA::GeneratedVertex>& geometry, std::vector<unsigned>& indices)
{
}
PGA::GeometryBufferInstanced& GeneticAlgoScene::getGeometryBuffer()
{
return genetic_algo->getGeometryBufferInstanced();
}
| 20.946429
| 111
| 0.746803
|
crest01
|
a7fcbc13f768c0c5354f6726fd7981b1a478f5b7
| 3,691
|
cpp
|
C++
|
src/projects/base/sequential/test_BASE_assembly.cpp
|
rserban/chrono
|
bee5e30b2ce3b4ac62324799d1366b6db295830e
|
[
"BSD-3-Clause"
] | 1
|
2020-03-05T13:00:41.000Z
|
2020-03-05T13:00:41.000Z
|
src/projects/base/sequential/test_BASE_assembly.cpp
|
rserban/chrono
|
bee5e30b2ce3b4ac62324799d1366b6db295830e
|
[
"BSD-3-Clause"
] | null | null | null |
src/projects/base/sequential/test_BASE_assembly.cpp
|
rserban/chrono
|
bee5e30b2ce3b4ac62324799d1366b6db295830e
|
[
"BSD-3-Clause"
] | 1
|
2022-03-27T15:12:24.000Z
|
2022-03-27T15:12:24.000Z
|
/// shaft, connected to the bround by revolute joint at the point <100, 0, 0>
/// initial linear speed is (0, 0, 300.);
/// initial angular speed angularVelAbs = (0, 3., 0);
#include <cmath>
#include "chrono/physics/ChSystemNSC.h"
#include "chrono/solver/ChIterativeSolverLS.h"
#include "chrono/solver/ChDirectSolverLS.h"
#include "chrono_irrlicht/ChIrrApp.h"
using namespace chrono;
using namespace chrono::irrlicht;
using namespace irr;
ChVector<> getLinearAccelAbs(std::shared_ptr<ChBody> body) {
auto& bodyFrame = body->GetFrame_REF_to_abs();
ChVector<> linearAccAbs = body->GetFrame_REF_to_abs().GetPos_dtdt();
return linearAccAbs;
}
int main(int argc, char* argv[]) {
ChSystemNSC m_System;
m_System.Set_G_acc(ChVector<>(0, 0, 0));
// Create the ground (fixed) body
// ------------------------------
auto ground = chrono_types::make_shared<ChBody>();
m_System.AddBody(ground);
ground->SetIdentifier(-1);
ground->SetBodyFixed(true);
ground->SetCollide(false);
auto m_Body = chrono_types::make_shared<ChBody>();
m_System.AddBody(m_Body);
m_Body->SetIdentifier(1);
m_Body->SetBodyFixed(false);
m_Body->SetCollide(false);
m_Body->SetMass(1);
m_Body->SetInertiaXX(ChVector<>(1, 1, 1));
m_Body->SetPos(ChVector<>(0, 0, 0));
m_Body->SetRot(ChQuaternion<>(1, 0, 0, 0));
auto cyl = chrono_types::make_shared<ChCylinderShape>();
cyl->GetCylinderGeometry().p1 = ChVector<>(-100, 0, 0);
cyl->GetCylinderGeometry().p2 = ChVector<>(100, 0, 0);
cyl->GetCylinderGeometry().rad = 2;
m_Body->AddAsset(cyl);
auto col = chrono_types::make_shared<ChColorAsset>(0.6f, 0.0f, 0.0f);
m_Body->AddAsset(col);
ChVector<> linearVelAbs(0, 0, 300.);
m_Body->SetPos_dt(linearVelAbs);
ChVector<> angularVelAbs(0, 3, 0); //// RADU: changed this!!!
m_Body->SetWvel_par(angularVelAbs);
m_Body->SetPos_dt(linearVelAbs);
ChVector<> translation(100, 0, 0);
ChVector<> orientationRad = CH_C_DEG_TO_RAD * 90.;
ChQuaternion<> quat;
quat.Q_from_AngX(orientationRad[0]);
Coordsys absCoor{translation, quat};
auto markerBodyLink =
std::make_shared<ChMarker>("MarkerBodyLink", m_Body.get(), ChCoordsys<>(), ChCoordsys<>(), ChCoordsys<>());
m_Body->AddMarker(markerBodyLink);
markerBodyLink->Impose_Abs_Coord(absCoor);
auto markerGroundLink =
std::make_shared<ChMarker>("MarkerGroundLink", ground.get(), ChCoordsys<>(), ChCoordsys<>(), ChCoordsys<>());
ground->AddMarker(markerGroundLink);
markerGroundLink->Impose_Abs_Coord(absCoor);
auto m_Link = std::shared_ptr<chrono::ChLinkMarkers>(new ChLinkLockRevolute());
m_Link->Initialize(markerGroundLink, markerBodyLink);
m_System.AddLink(m_Link);
auto solver = chrono_types::make_shared<ChSolverSparseQR>();
solver->SetVerbose(false);
m_System.SetSolver(solver);
m_System.SetSolverForceTolerance(1e-12);
m_System.SetTimestepperType(ChTimestepper::Type::EULER_IMPLICIT_PROJECTED);
m_System.SetStep(1e-10);
ChIrrApp application(&m_System, L"ChBodyAuxRef demo", core::dimension2d<u32>(800, 600), false, true);
application.AddTypicalLogo();
application.AddTypicalSky();
application.AddTypicalLights();
application.AddTypicalCamera(core::vector3df(0, 20, 150));
application.AssetBindAll();
application.AssetUpdateAll();
while (application.GetDevice()->run()) {
application.BeginScene();
application.DrawAll();
////m_System.DoStepDynamics(1e-4);
application.EndScene();
}
m_System.DoFullAssembly();
auto linearAccelInit = getLinearAccelAbs(m_Body);
}
| 31.016807
| 117
| 0.68518
|
rserban
|
a7fd1450863825a11a3c7bcf2dfbedd72780e8e1
| 2,735
|
cpp
|
C++
|
src/main/cpp/autonomous/AutoRightSideShootSix.cpp
|
frc3512/Robot-2020
|
c6811155900ccffba93ea9ba131192dcb9fcb1bd
|
[
"BSD-3-Clause"
] | 10
|
2020-02-07T04:13:15.000Z
|
2022-02-26T00:13:39.000Z
|
src/main/cpp/autonomous/AutoRightSideShootSix.cpp
|
frc3512/Robot-2020
|
c6811155900ccffba93ea9ba131192dcb9fcb1bd
|
[
"BSD-3-Clause"
] | 82
|
2020-02-12T03:05:15.000Z
|
2022-02-18T02:14:38.000Z
|
src/main/cpp/autonomous/AutoRightSideShootSix.cpp
|
frc3512/Robot-2020
|
c6811155900ccffba93ea9ba131192dcb9fcb1bd
|
[
"BSD-3-Clause"
] | 5
|
2020-02-14T16:24:01.000Z
|
2022-03-31T09:10:01.000Z
|
// Copyright (c) 2020-2021 FRC Team 3512. All Rights Reserved.
#include <frc/trajectory/constraint/MaxVelocityConstraint.h>
#include <frc/trajectory/constraint/RectangularRegionConstraint.h>
#include <wpi/numbers>
#include "Robot.hpp"
namespace frc3512 {
void Robot::AutoRightSideShootSix() {
// Initial Pose - Right in line with the three balls in the Trench Run
const frc::Pose2d kInitialPose{12_m, 1.05_m,
units::radian_t{wpi::numbers::pi}};
// Mid Pose - Drive forward slightly
const frc::Pose2d kMidPose{12_m - 1.5 * Drivetrain::kLength, 1.05_m,
units::radian_t{wpi::numbers::pi}};
// End Pose - Third/Farthest ball in the Trench Run
const frc::Pose2d kEndPose{7.95_m, 1.05_m,
units::radian_t{wpi::numbers::pi}};
drivetrain.Reset(kInitialPose);
// Move back to shoot three comfortably
drivetrain.AddTrajectory(kInitialPose, {}, kMidPose);
intake.Deploy();
if (!m_autonChooser.Suspend([=] { return drivetrain.AtGoal(); })) {
return;
}
if constexpr (IsSimulation()) {
for (int i = 0; i < 3; ++i) {
intakeSim.AddBall();
}
}
Shoot(3);
if (!m_autonChooser.Suspend([=] { return !IsShooting(); })) {
return;
}
// Add a constraint to slow down the drivetrain while it's
// approaching the balls
frc::RectangularRegionConstraint regionConstraint{
frc::Translation2d{kEndPose.X(),
kEndPose.Y() - 0.5 * Drivetrain::kLength},
// X: First/Closest ball in the trench run
frc::Translation2d{9.82_m + 0.5 * Drivetrain::kLength,
kInitialPose.Y() + 0.5 * Drivetrain::kLength},
frc::MaxVelocityConstraint{1.6_mps}};
{
auto config = Drivetrain::MakeTrajectoryConfig();
config.AddConstraint(regionConstraint);
drivetrain.AddTrajectory(kMidPose, {}, kEndPose, config);
}
// Intake Balls x3
intake.Start();
if (!m_autonChooser.Suspend([=] { return drivetrain.AtGoal(); })) {
return;
}
// Drive back
{
auto config = Drivetrain::MakeTrajectoryConfig();
config.SetReversed(true);
drivetrain.AddTrajectory({kEndPose, kMidPose}, config);
}
if (!m_autonChooser.Suspend([=] { return drivetrain.AtGoal(); })) {
return;
}
if constexpr (IsSimulation()) {
for (int i = 0; i < 3; ++i) {
intakeSim.AddBall();
}
}
Shoot(3);
if (!m_autonChooser.Suspend([=] { return !IsShooting(); })) {
return;
}
intake.Stop();
EXPECT_TRUE(turret.AtGoal());
}
} // namespace frc3512
| 28.789474
| 74
| 0.590859
|
frc3512
|
c501489c7a798216d51283dbb79d1fb6e7d56421
| 524
|
cpp
|
C++
|
code/misc/knapsack_bounded_cost.cpp
|
VerasThiago/icpc-notebook
|
e09e4f1cb34a21ae52a246c463f2130ee83c87d6
|
[
"MIT"
] | 13
|
2019-04-28T14:18:10.000Z
|
2021-08-19T12:13:26.000Z
|
code/misc/knapsack_bounded_cost.cpp
|
raphasramos/competitive-programming
|
749b6726bd9d517d9143af7e9236d3e5e8cef49b
|
[
"MIT"
] | null | null | null |
code/misc/knapsack_bounded_cost.cpp
|
raphasramos/competitive-programming
|
749b6726bd9d517d9143af7e9236d3e5e8cef49b
|
[
"MIT"
] | 6
|
2019-07-31T02:47:36.000Z
|
2020-10-12T01:46:23.000Z
|
// menor custo para conseguir peso ate M usando N tipos diferentes de elementos, sendo que o i-esimo elemento pode ser usado b[i] vezes, tem peso w[i] e custo c[i]
// O(N * M)
int b[N], w[N], c[N];
MinQueue Q[M]
int d[M] //d[i] = custo minimo para conseguir peso i
for(int i = 0; i <= M; i++) d[i] = i ? oo : 0;
for(int i = 0; i < N; i++){
for(int j = 0; j < w[i]; j++)
Q[j].clear();
for(int j = 0; j <= M; j++){
q = Q[j % w[i]];
if(q.size() >= q) q.pop();
q.add(c[i]);
q.push(d[j]);
d[j] = q.getmin();
}
}
| 26.2
| 163
| 0.530534
|
VerasThiago
|
c502952e8ad6370cd472f841ccb12d33af00855b
| 2,093
|
cpp
|
C++
|
exec/brownian/advance.cpp
|
ckim103/FHDeX
|
9182d7589db7e7ee318ca2a0f343c378d9c120a0
|
[
"BSD-3-Clause-LBNL"
] | null | null | null |
exec/brownian/advance.cpp
|
ckim103/FHDeX
|
9182d7589db7e7ee318ca2a0f343c378d9c120a0
|
[
"BSD-3-Clause-LBNL"
] | null | null | null |
exec/brownian/advance.cpp
|
ckim103/FHDeX
|
9182d7589db7e7ee318ca2a0f343c378d9c120a0
|
[
"BSD-3-Clause-LBNL"
] | null | null | null |
#include "hydro_functions.H"
#include "hydro_functions_F.H"
#include "common_functions.H"
#include "common_functions_F.H"
#include "common_namespace.H"
#include "gmres_functions.H"
#include "gmres_functions_F.H"
#include "gmres_namespace.H"
#include <AMReX_ParallelDescriptor.H>
#include <AMReX_MultiFabUtil.H>
using namespace amrex;
using namespace common;
using namespace gmres;
// argv contains the name of the inputs file entered at the command line
void advance( std::array< MultiFab, AMREX_SPACEDIM >& umac,
MultiFab& pres,
const std::array< MultiFab, AMREX_SPACEDIM >& stochMfluxdiv,
const std::array< MultiFab, AMREX_SPACEDIM >& sourceTerms,
std::array< MultiFab, AMREX_SPACEDIM >& alpha_fc,
MultiFab& beta,
MultiFab& gamma,
std::array< MultiFab, NUM_EDGE >& beta_ed,
const Geometry geom, const Real& dt)
{
BL_PROFILE_VAR("advance()",advance);
Real theta_alpha = 0.;
Real norm_pre_rhs;
const BoxArray& ba = beta.boxArray();
const DistributionMapping& dmap = beta.DistributionMap();
// rhs_p GMRES solve
MultiFab gmres_rhs_p(ba, dmap, 1, 0);
gmres_rhs_p.setVal(0.);
// rhs_u GMRES solve
std::array< MultiFab, AMREX_SPACEDIM > gmres_rhs_u;
for (int d=0; d<AMREX_SPACEDIM; ++d) {
gmres_rhs_u[d].define(convert(ba,nodal_flag_dir[d]), dmap, 1, 0);
gmres_rhs_u[d].setVal(0.);
}
//////////////////////////////////////////////////
// ADVANCE velocity field
//////////////////////////////////////////////////
// add stochastic forcing to gmres_rhs_u
for (int d=0; d<AMREX_SPACEDIM; ++d) {
MultiFab::Add(gmres_rhs_u[d], stochMfluxdiv[d], 0, 0, 1, 0);
MultiFab::Add(gmres_rhs_u[d], sourceTerms[d], 0, 0, 1, 0);
}
// HERE is where you would add the particle forcing to gmres_rhs_u
//
//
//
// call GMRES
GMRES(gmres_rhs_u,gmres_rhs_p,umac,pres,alpha_fc,beta,beta_ed,gamma,theta_alpha,geom,norm_pre_rhs);
// fill periodic ghost cells
for (int d=0; d<AMREX_SPACEDIM; ++d) {
umac[d].FillBoundary(geom.periodicity());
}
}
| 27.539474
| 101
| 0.651218
|
ckim103
|
c50fa8b7268b2dfdf292e46b1237323b9eade999
| 317
|
hpp
|
C++
|
src/shell/command/world/add_state_object_SG_command.hpp
|
MarkieMark/fastrl
|
e4f0b9b60a7ecb6f13bbb79936ea82acb8adae0e
|
[
"Apache-2.0"
] | 4
|
2019-04-19T00:11:36.000Z
|
2020-04-08T09:50:37.000Z
|
src/shell/command/world/add_state_object_SG_command.hpp
|
MarkieMark/fastrl
|
e4f0b9b60a7ecb6f13bbb79936ea82acb8adae0e
|
[
"Apache-2.0"
] | null | null | null |
src/shell/command/world/add_state_object_SG_command.hpp
|
MarkieMark/fastrl
|
e4f0b9b60a7ecb6f13bbb79936ea82acb8adae0e
|
[
"Apache-2.0"
] | null | null | null |
/*
* Mark Benjamin 6th March 2019
* Copyright (c) 2019 Mark Benjamin
*/
#ifndef FASTRL_SHELL_COMMAND_WORLD_ADD_STATE_OBJECT_SG_COMMAND_HPP
#define FASTRL_SHELL_COMMAND_WORLD_ADD_STATE_OBJECT_SG_COMMAND_HPP
class AddStateObjectSGCommand {
};
#endif //FASTRL_SHELL_COMMAND_WORLD_ADD_STATE_OBJECT_SG_COMMAND_HPP
| 21.133333
| 67
| 0.84858
|
MarkieMark
|
c51092f9095edf8eae106ce1cffbc5758265a410
| 4,661
|
cpp
|
C++
|
Source/Shared/dependencies/d3dxaffinity/CD3DX12AffinityDescriptorHeap.cpp
|
JJoosten/IndirectOcclusionCulling
|
0376da0f9bdb14e67238a5b54e928e50ee33aef6
|
[
"MIT"
] | 19
|
2016-08-16T10:19:07.000Z
|
2018-12-04T01:00:00.000Z
|
Source/Shared/dependencies/d3dxaffinity/CD3DX12AffinityDescriptorHeap.cpp
|
JJoosten/IndirectOcclusionCulling
|
0376da0f9bdb14e67238a5b54e928e50ee33aef6
|
[
"MIT"
] | 1
|
2016-08-18T04:23:19.000Z
|
2017-01-26T22:46:44.000Z
|
Source/Shared/dependencies/d3dxaffinity/CD3DX12AffinityDescriptorHeap.cpp
|
JJoosten/IndirectOcclusionCulling
|
0376da0f9bdb14e67238a5b54e928e50ee33aef6
|
[
"MIT"
] | 1
|
2019-09-23T10:49:36.000Z
|
2019-09-23T10:49:36.000Z
|
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "d3dx12affinity.h"
#include "CD3DX12Utils.h"
D3D12_DESCRIPTOR_HEAP_DESC STDMETHODCALLTYPE CD3DX12AffinityDescriptorHeap::GetDesc(UINT AffinityIndex)
{
return mDescriptorHeaps[AffinityIndex]->GetDesc();
}
D3D12_CPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE CD3DX12AffinityDescriptorHeap::GetCPUDescriptorHandleForHeapStart(void)
{
if (GetNodeCount() == 1)
{
return mDescriptorHeaps[0]->GetCPUDescriptorHandleForHeapStart();
}
D3D12_CPU_DESCRIPTOR_HANDLE handle;
handle.ptr = (SIZE_T)mCPUHeapStart;
return handle;
}
D3D12_GPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE CD3DX12AffinityDescriptorHeap::GetGPUDescriptorHandleForHeapStart(void)
{
if (GetNodeCount() == 1)
{
return mDescriptorHeaps[0]->GetGPUDescriptorHandleForHeapStart();
}
D3D12_GPU_DESCRIPTOR_HANDLE handle;
handle.ptr = (SIZE_T)mGPUHeapStart;
return handle;
}
D3D12_CPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE CD3DX12AffinityDescriptorHeap::GetActiveCPUDescriptorHandleForHeapStart(UINT AffinityIndex)
{
return mDescriptorHeaps[AffinityIndex]->GetCPUDescriptorHandleForHeapStart();
}
D3D12_GPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE CD3DX12AffinityDescriptorHeap::GetActiveGPUDescriptorHandleForHeapStart(UINT AffinityIndex)
{
return mDescriptorHeaps[AffinityIndex]->GetGPUDescriptorHandleForHeapStart();
}
void CD3DX12AffinityDescriptorHeap::InitDescriptorHandles(D3D12_DESCRIPTOR_HEAP_TYPE type)
{
UINT const NodeCount = GetNodeCount();
UINT maxindex = 0;
for (UINT i = 0; i < NodeCount; ++i)
{
D3D12_CPU_DESCRIPTOR_HANDLE const CPUBase = mDescriptorHeaps[i]->GetCPUDescriptorHandleForHeapStart();
D3D12_GPU_DESCRIPTOR_HANDLE const GPUBase = mDescriptorHeaps[i]->GetGPUDescriptorHandleForHeapStart();
UINT HandleIncrement = 0;
if (GetParentDevice()->GetAffinityMode() == EAffinityMode::LDA)
{
HandleIncrement = GetParentDevice()->GetChildObject(0)->GetDescriptorHandleIncrementSize(type);
}
for (UINT j = 0; j < mNumDescriptors; ++j)
{
mCPUHeapStart[j * NodeCount + i] = CPUBase.ptr + HandleIncrement * j;
mGPUHeapStart[j * NodeCount + i] = GPUBase.ptr + HandleIncrement * j;
maxindex = max(maxindex, j * NodeCount + i);
}
}
DebugLog("Used up to index %u in heap array\n", maxindex);
DebugLog("Created a descriptor heap with CPU start at 0x%IX and GPU start a 0x%IX\n", mCPUHeapStart, mGPUHeapStart);
for (UINT i = 0; i < NodeCount; ++i)
{
DebugLog(" Device %u CPU starts at 0x%IX and GPU starts at 0x%IX\n",
i, mDescriptorHeaps[i]->GetCPUDescriptorHandleForHeapStart().ptr, mDescriptorHeaps[i]->GetGPUDescriptorHandleForHeapStart().ptr);
}
#ifdef D3DX_AFFINITY_ENABLE_HEAP_POINTER_VALIDATION
// Validation
{
std::lock_guard<std::mutex> lock(GetParentDevice()->MutexPointerRanges);
GetParentDevice()->CPUHeapPointerRanges.push_back(std::make_pair((SIZE_T)mCPUHeapStart, (SIZE_T)(mCPUHeapStart + mNumDescriptors * NodeCount)));
GetParentDevice()->GPUHeapPointerRanges.push_back(std::make_pair((SIZE_T)mGPUHeapStart, (SIZE_T)(mGPUHeapStart + mNumDescriptors * NodeCount)));
}
#endif
}
CD3DX12AffinityDescriptorHeap::CD3DX12AffinityDescriptorHeap(CD3DX12AffinityDevice* device, ID3D12DescriptorHeap** descriptorHeaps, UINT Count)
: CD3DX12AffinityPageable(device, reinterpret_cast<ID3D12Pageable**>(descriptorHeaps), Count)
, mCPUHeapStart(nullptr)
, mGPUHeapStart(nullptr)
{
for (UINT i = 0; i < D3DX12_MAX_ACTIVE_NODES; i++)
{
if (i < Count)
{
mDescriptorHeaps[i] = descriptorHeaps[i];
}
else
{
mDescriptorHeaps[i] = nullptr;
}
}
#ifdef DEBUG_OBJECT_NAME
mObjectTypeName = L"DescriptorHeap";
#endif
}
CD3DX12AffinityDescriptorHeap::~CD3DX12AffinityDescriptorHeap()
{
if (mCPUHeapStart != nullptr)
{
delete[] mCPUHeapStart;
}
if (mGPUHeapStart != nullptr)
{
delete[] mGPUHeapStart;
}
}
ID3D12DescriptorHeap* CD3DX12AffinityDescriptorHeap::GetChildObject(UINT AffinityIndex)
{
return mDescriptorHeaps[AffinityIndex];
}
| 35.310606
| 152
| 0.705428
|
JJoosten
|
78a506c0257b7eab139f53474adf266a447cc617
| 64,498
|
cpp
|
C++
|
Engine/source/afx/afxConstraint.cpp
|
John3/faustlogic_Torque3D-plus-AFX
|
45ea3c81707c944792cd785f87e86bc8085f654a
|
[
"Unlicense"
] | 13
|
2015-04-13T21:46:01.000Z
|
2017-11-20T22:12:04.000Z
|
Engine/source/afx/afxConstraint.cpp
|
John3/faustlogic_Torque3D-plus-AFX
|
45ea3c81707c944792cd785f87e86bc8085f654a
|
[
"Unlicense"
] | 1
|
2015-11-16T23:57:12.000Z
|
2015-12-01T03:24:08.000Z
|
Engine/source/afx/afxConstraint.cpp
|
John3/faustlogic_Torque3D-plus-AFX
|
45ea3c81707c944792cd785f87e86bc8085f654a
|
[
"Unlicense"
] | 7
|
2015-04-14T23:27:16.000Z
|
2022-03-29T00:45:37.000Z
|
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
// Copyright (C) 2015 Faust Logic, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "arcaneFX.h"
#include "T3D/aiPlayer.h"
#include "T3D/tsStatic.h"
#include "sim/netConnection.h"
#include "ts/tsShapeInstance.h"
#include "afxConstraint.h"
#include "afxChoreographer.h"
#include "afxEffectWrapper.h"
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxConstraintDef
// static
StringTableEntry afxConstraintDef::SCENE_CONS_KEY;
StringTableEntry afxConstraintDef::EFFECT_CONS_KEY;
StringTableEntry afxConstraintDef::GHOST_CONS_KEY;
afxConstraintDef::afxConstraintDef()
{
if (SCENE_CONS_KEY == 0)
{
SCENE_CONS_KEY = StringTable->insert("#scene");
EFFECT_CONS_KEY = StringTable->insert("#effect");
GHOST_CONS_KEY = StringTable->insert("#ghost");
}
reset();
}
bool afxConstraintDef::isDefined()
{
return (def_type != CONS_UNDEFINED);
}
bool afxConstraintDef::isArbitraryObject()
{
return ((cons_src_name != ST_NULLSTRING) && (def_type == CONS_SCENE));
}
void afxConstraintDef::reset()
{
cons_src_name = ST_NULLSTRING;
cons_node_name = ST_NULLSTRING;
def_type = CONS_UNDEFINED;
history_time = 0;
sample_rate = 30;
runs_on_server = false;
runs_on_client = false;
pos_at_box_center = false;
treat_as_camera = false;
}
bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server,
bool runs_on_client)
{
reset();
if (spec == 0 || spec[0] == '\0')
return false;
history_time = 0.0f;
sample_rate = 30;
this->runs_on_server = runs_on_server;
this->runs_on_client = runs_on_client;
// spec should be in one of these forms:
// CONSTRAINT_NAME (only)
// CONSTRAINT_NAME.NODE (shapeBase objects only)
// CONSTRAINT_NAME.#center
// object.OBJECT_NAME
// object.OBJECT_NAME.NODE (shapeBase objects only)
// object.OBJECT_NAME.#center
// effect.EFFECT_NAME
// effect.EFFECT_NAME.NODE
// effect.EFFECT_NAME.#center
// #ghost.EFFECT_NAME
// #ghost.EFFECT_NAME.NODE
// #ghost.EFFECT_NAME.#center
//
// create scratch buffer by duplicating spec.
char special = '\b';
char* buffer = dStrdup(spec);
// substitute a dots not inside parens with special character
S32 n_nested = 0;
for (char* b = buffer; (*b) != '\0'; b++)
{
if ((*b) == '(')
n_nested++;
else if ((*b) == ')')
n_nested--;
else if ((*b) == '.' && n_nested == 0)
(*b) = special;
}
// divide name into '.' separated tokens (up to 8)
char* words[8] = {0, 0, 0, 0, 0, 0, 0, 0};
char* dot = buffer;
int wdx = 0;
while (wdx < 8)
{
words[wdx] = dot;
dot = dStrchr(words[wdx++], special);
if (!dot)
break;
*(dot++) = '\0';
if ((*dot) == '\0')
break;
}
int n_words = wdx;
// at this point the spec has been split into words.
// n_words indicates how many words we have.
// no words found (must have been all whitespace)
if (n_words < 1)
{
dFree(buffer);
return false;
}
char* hist_spec = 0;
char* words2[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int n_words2 = 0;
// move words to words2 while extracting #center and #history
for (S32 i = 0; i < n_words; i++)
{
if (dStrcmp(words[i], "#center") == 0)
pos_at_box_center = true;
else if (dStrncmp(words[i], "#history(", 9) == 0)
hist_spec = words[i];
else
words2[n_words2++] = words[i];
}
// words2[] now contains just the constraint part
// no words found (must have been all #center and #history)
if (n_words2 < 1)
{
dFree(buffer);
return false;
}
if (hist_spec)
{
char* open_paren = dStrchr(hist_spec, '(');
if (open_paren)
{
hist_spec = open_paren+1;
if ((*hist_spec) != '\0')
{
char* close_paren = dStrchr(hist_spec, ')');
if (close_paren)
(*close_paren) = '\0';
char* slash = dStrchr(hist_spec, '/');
if (slash)
(*slash) = ' ';
F32 hist_age = 0.0;
U32 hist_rate = 30;
S32 args = dSscanf(hist_spec,"%g %d", &hist_age, &hist_rate);
if (args > 0)
history_time = hist_age;
if (args > 1)
sample_rate = hist_rate;
}
}
}
StringTableEntry cons_name_key = StringTable->insert(words2[0]);
// must be in CONSTRAINT_NAME (only) form
if (n_words2 == 1)
{
// arbitrary object/effect constraints must have a name
if (cons_name_key == SCENE_CONS_KEY || cons_name_key == EFFECT_CONS_KEY)
{
dFree(buffer);
return false;
}
cons_src_name = cons_name_key;
def_type = CONS_PREDEFINED;
dFree(buffer);
return true;
}
// "#scene.NAME" or "#scene.NAME.NODE""
if (cons_name_key == SCENE_CONS_KEY)
{
cons_src_name = StringTable->insert(words2[1]);
if (n_words2 > 2)
cons_node_name = StringTable->insert(words2[2]);
def_type = CONS_SCENE;
dFree(buffer);
return true;
}
// "#effect.NAME" or "#effect.NAME.NODE"
if (cons_name_key == EFFECT_CONS_KEY)
{
cons_src_name = StringTable->insert(words2[1]);
if (n_words2 > 2)
cons_node_name = StringTable->insert(words2[2]);
def_type = CONS_EFFECT;
dFree(buffer);
return true;
}
// "#ghost.NAME" or "#ghost.NAME.NODE"
if (cons_name_key == GHOST_CONS_KEY)
{
if (runs_on_server)
{
dFree(buffer);
return false;
}
cons_src_name = StringTable->insert(words2[1]);
if (n_words2 > 2)
cons_node_name = StringTable->insert(words2[2]);
def_type = CONS_GHOST;
dFree(buffer);
return true;
}
// "CONSTRAINT_NAME.NODE"
if (n_words2 == 2)
{
cons_src_name = cons_name_key;
cons_node_name = StringTable->insert(words2[1]);
def_type = CONS_PREDEFINED;
dFree(buffer);
return true;
}
// must be in unsupported form
dFree(buffer);
return false;
}
void afxConstraintDef::gather_cons_defs(Vector<afxConstraintDef>& defs, afxEffectList& fx)
{
for (S32 i = 0; i < fx.size(); i++)
{
if (fx[i])
fx[i]->gather_cons_defs(defs);
}
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxConstraint
afxConstraint::afxConstraint(afxConstraintMgr* mgr)
{
this->mgr = mgr;
is_defined = false;
is_valid = false;
last_pos.zero();
last_xfm.identity();
history_time = 0.0f;
is_alive = true;
gone_missing = false;
change_code = 0;
}
afxConstraint::~afxConstraint()
{
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
inline afxPointConstraint* newPointCons(afxConstraintMgr* mgr, bool hist)
{
return (hist) ? new afxPointHistConstraint(mgr) : new afxPointConstraint(mgr);
}
inline afxTransformConstraint* newTransformCons(afxConstraintMgr* mgr, bool hist)
{
return (hist) ? new afxTransformHistConstraint(mgr) : new afxTransformConstraint(mgr);
}
inline afxShapeConstraint* newShapeCons(afxConstraintMgr* mgr, bool hist)
{
return (hist) ? new afxShapeHistConstraint(mgr) : new afxShapeConstraint(mgr);
}
inline afxShapeConstraint* newShapeCons(afxConstraintMgr* mgr, StringTableEntry name, bool hist)
{
return (hist) ? new afxShapeHistConstraint(mgr, name) : new afxShapeConstraint(mgr, name);
}
inline afxShapeNodeConstraint* newShapeNodeCons(afxConstraintMgr* mgr, StringTableEntry name, StringTableEntry node, bool hist)
{
return (hist) ? new afxShapeNodeHistConstraint(mgr, name, node) : new afxShapeNodeConstraint(mgr, name, node);
}
inline afxObjectConstraint* newObjectCons(afxConstraintMgr* mgr, bool hist)
{
return (hist) ? new afxObjectHistConstraint(mgr) : new afxObjectConstraint(mgr);
}
inline afxObjectConstraint* newObjectCons(afxConstraintMgr* mgr, StringTableEntry name, bool hist)
{
return (hist) ? new afxObjectHistConstraint(mgr, name) : new afxObjectConstraint(mgr, name);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxConstraintMgr
#define CONS_BY_ID(id) ((*constraints_v[(id).index])[(id).sub_index])
#define CONS_BY_IJ(i,j) ((*constraints_v[(i)])[(j)])
afxConstraintMgr::afxConstraintMgr()
{
starttime = 0;
on_server = false;
initialized = false;
scoping_dist_sq = 1000.0f*1000.0f;
missing_objs = &missing_objs_a;
missing_objs2 = &missing_objs_b;
}
afxConstraintMgr::~afxConstraintMgr()
{
for (S32 i = 0; i < constraints_v.size(); i++)
{
for (S32 j = 0; j < (*constraints_v[i]).size(); j++)
delete CONS_BY_IJ(i,j);
delete constraints_v[i];
}
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//
S32 afxConstraintMgr::find_cons_idx_from_name(StringTableEntry which)
{
for (S32 i = 0; i < constraints_v.size(); i++)
{
afxConstraint* cons = CONS_BY_IJ(i,0);
if (cons && afxConstraintDef::CONS_EFFECT != cons->cons_def.def_type &&
which == cons->cons_def.cons_src_name)
{
return i;
}
}
return -1;
}
S32 afxConstraintMgr::find_effect_cons_idx_from_name(StringTableEntry which)
{
for (S32 i = 0; i < constraints_v.size(); i++)
{
afxConstraint* cons = CONS_BY_IJ(i,0);
if (cons && afxConstraintDef::CONS_EFFECT == cons->cons_def.def_type &&
which == cons->cons_def.cons_src_name)
{
return i;
}
}
return -1;
}
// Defines a predefined constraint with given name and type
void afxConstraintMgr::defineConstraint(U32 type, StringTableEntry name)
{
preDef predef = { name, type };
predefs.push_back(predef);
}
afxConstraintID afxConstraintMgr::setReferencePoint(StringTableEntry which, Point3F point,
Point3F vector)
{
S32 idx = find_cons_idx_from_name(which);
if (idx < 0)
return afxConstraintID();
afxConstraintID id = afxConstraintID(idx);
setReferencePoint(id, point, vector);
return id;
}
afxConstraintID afxConstraintMgr::setReferenceTransform(StringTableEntry which, MatrixF& xfm)
{
S32 idx = find_cons_idx_from_name(which);
if (idx < 0)
return afxConstraintID();
afxConstraintID id = afxConstraintID(idx);
setReferenceTransform(id, xfm);
return id;
}
// Assigns an existing scene-object to the named constraint
afxConstraintID afxConstraintMgr::setReferenceObject(StringTableEntry which, SceneObject* obj)
{
S32 idx = find_cons_idx_from_name(which);
if (idx < 0)
return afxConstraintID();
afxConstraintID id = afxConstraintID(idx);
setReferenceObject(id, obj);
return id;
}
// Assigns an un-scoped scene-object by scope_id to the named constraint
afxConstraintID afxConstraintMgr::setReferenceObjectByScopeId(StringTableEntry which, U16 scope_id, bool is_shape)
{
S32 idx = find_cons_idx_from_name(which);
if (idx < 0)
return afxConstraintID();
afxConstraintID id = afxConstraintID(idx);
setReferenceObjectByScopeId(id, scope_id, is_shape);
return id;
}
afxConstraintID afxConstraintMgr::setReferenceEffect(StringTableEntry which, afxEffectWrapper* ew)
{
S32 idx = find_effect_cons_idx_from_name(which);
if (idx < 0)
return afxConstraintID();
afxConstraintID id = afxConstraintID(idx);
setReferenceEffect(id, ew);
return id;
}
afxConstraintID afxConstraintMgr::createReferenceEffect(StringTableEntry which, afxEffectWrapper* ew)
{
afxEffectConstraint* cons = new afxEffectConstraint(this, which);
//cons->cons_def = def;
cons->cons_def.def_type = afxConstraintDef::CONS_EFFECT;
cons->cons_def.cons_src_name = which;
afxConstraintList* list = new afxConstraintList();
list->push_back(cons);
constraints_v.push_back(list);
return setReferenceEffect(which, ew);
}
void afxConstraintMgr::setReferencePoint(afxConstraintID id, Point3F point, Point3F vector)
{
afxPointConstraint* pt_cons = dynamic_cast<afxPointConstraint*>(CONS_BY_ID(id));
// need to change type
if (!pt_cons)
{
afxConstraint* cons = CONS_BY_ID(id);
pt_cons = newPointCons(this, cons->cons_def.history_time > 0.0f);
pt_cons->cons_def = cons->cons_def;
CONS_BY_ID(id) = pt_cons;
delete cons;
}
pt_cons->set(point, vector);
// nullify all subnodes
for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++)
{
afxConstraint* cons = CONS_BY_IJ(id.index,j);
if (cons)
cons->unset();
}
}
void afxConstraintMgr::setReferenceTransform(afxConstraintID id, MatrixF& xfm)
{
afxTransformConstraint* xfm_cons = dynamic_cast<afxTransformConstraint*>(CONS_BY_ID(id));
// need to change type
if (!xfm_cons)
{
afxConstraint* cons = CONS_BY_ID(id);
xfm_cons = newTransformCons(this, cons->cons_def.history_time > 0.0f);
xfm_cons->cons_def = cons->cons_def;
CONS_BY_ID(id) = xfm_cons;
delete cons;
}
xfm_cons->set(xfm);
// nullify all subnodes
for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++)
{
afxConstraint* cons = CONS_BY_IJ(id.index,j);
if (cons)
cons->unset();
}
}
void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape)
{
id.sub_index = 0;
afxShapeConstraint* shape_cons = dynamic_cast<afxShapeConstraint*>(CONS_BY_ID(id));
// need to change type
if (!shape_cons)
{
afxConstraint* cons = CONS_BY_ID(id);
shape_cons = newShapeCons(this, cons->cons_def.history_time > 0.0f);
shape_cons->cons_def = cons->cons_def;
CONS_BY_ID(id) = shape_cons;
delete cons;
}
// set new shape on root
shape_cons->set(shape);
// update all subnodes
for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++)
{
afxConstraint* cons = CONS_BY_IJ(id.index,j);
if (cons)
{
if (dynamic_cast<afxShapeNodeConstraint*>(cons))
((afxShapeNodeConstraint*)cons)->set(shape);
else if (dynamic_cast<afxShapeConstraint*>(cons))
((afxShapeConstraint*)cons)->set(shape);
else if (dynamic_cast<afxObjectConstraint*>(cons))
((afxObjectConstraint*)cons)->set(shape);
else
cons->unset();
}
}
}
void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id)
{
id.sub_index = 0;
afxShapeConstraint* shape_cons = dynamic_cast<afxShapeConstraint*>(CONS_BY_ID(id));
// need to change type
if (!shape_cons)
{
afxConstraint* cons = CONS_BY_ID(id);
shape_cons = newShapeCons(this, cons->cons_def.history_time > 0.0f);
shape_cons->cons_def = cons->cons_def;
CONS_BY_ID(id) = shape_cons;
delete cons;
}
// set new shape on root
shape_cons->set_scope_id(scope_id);
// update all subnodes
for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++)
{
afxConstraint* cons = CONS_BY_IJ(id.index,j);
if (cons)
cons->set_scope_id(scope_id);
}
}
// Assigns an existing scene-object to the constraint matching the given constraint-id.
void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj)
{
if (!initialized)
Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized");
if (!CONS_BY_ID(id)->cons_def.treat_as_camera)
{
ShapeBase* shape = dynamic_cast<ShapeBase*>(obj);
if (shape)
{
set_ref_shape(id, shape);
return;
}
}
afxObjectConstraint* obj_cons = dynamic_cast<afxObjectConstraint*>(CONS_BY_ID(id));
// need to change type
if (!obj_cons)
{
afxConstraint* cons = CONS_BY_ID(id);
obj_cons = newObjectCons(this, cons->cons_def.history_time > 0.0f);
obj_cons->cons_def = cons->cons_def;
CONS_BY_ID(id) = obj_cons;
delete cons;
}
obj_cons->set(obj);
// update all subnodes
for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++)
{
afxConstraint* cons = CONS_BY_IJ(id.index,j);
if (cons)
{
if (dynamic_cast<afxObjectConstraint*>(cons))
((afxObjectConstraint*)cons)->set(obj);
else
cons->unset();
}
}
}
// Assigns an un-scoped scene-object by scope_id to the constraint matching the
// given constraint-id.
void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope_id, bool is_shape)
{
if (!initialized)
Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized");
if (is_shape)
{
set_ref_shape(id, scope_id);
return;
}
afxObjectConstraint* obj_cons = dynamic_cast<afxObjectConstraint*>(CONS_BY_ID(id));
// need to change type
if (!obj_cons)
{
afxConstraint* cons = CONS_BY_ID(id);
obj_cons = newObjectCons(this, cons->cons_def.history_time > 0.0f);
obj_cons->cons_def = cons->cons_def;
CONS_BY_ID(id) = obj_cons;
delete cons;
}
obj_cons->set_scope_id(scope_id);
// update all subnodes
for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++)
{
afxConstraint* cons = CONS_BY_IJ(id.index,j);
if (cons)
cons->set_scope_id(scope_id);
}
}
void afxConstraintMgr::setReferenceEffect(afxConstraintID id, afxEffectWrapper* ew)
{
afxEffectConstraint* eff_cons = dynamic_cast<afxEffectConstraint*>(CONS_BY_ID(id));
if (!eff_cons)
return;
eff_cons->set(ew);
// update all subnodes
for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++)
{
afxConstraint* cons = CONS_BY_IJ(id.index,j);
if (cons)
{
if (dynamic_cast<afxEffectNodeConstraint*>(cons))
((afxEffectNodeConstraint*)cons)->set(ew);
else if (dynamic_cast<afxEffectConstraint*>(cons))
((afxEffectConstraint*)cons)->set(ew);
else
cons->unset();
}
}
}
void afxConstraintMgr::invalidateReference(afxConstraintID id)
{
afxConstraint* cons = CONS_BY_ID(id);
if (cons)
cons->is_valid = false;
}
void afxConstraintMgr::create_constraint(const afxConstraintDef& def)
{
if (def.def_type == afxConstraintDef::CONS_UNDEFINED)
return;
//Con::printf("CON - %s [%s] [%s] h=%g", def.cons_type_name, def.cons_src_name, def.cons_node_name, def.history_time);
bool want_history = (def.history_time > 0.0f);
// constraint is an arbitrary named scene object
//
if (def.def_type == afxConstraintDef::CONS_SCENE)
{
if (def.cons_src_name == ST_NULLSTRING)
return;
// find the arbitrary object by name
SceneObject* arb_obj;
if (on_server)
{
arb_obj = dynamic_cast<SceneObject*>(Sim::findObject(def.cons_src_name));
if (!arb_obj)
Con::errorf("afxConstraintMgr -- failed to find scene constraint source, \"%s\" on server.",
def.cons_src_name);
}
else
{
arb_obj = find_object_from_name(def.cons_src_name);
if (!arb_obj)
Con::errorf("afxConstraintMgr -- failed to find scene constraint source, \"%s\" on client.",
def.cons_src_name);
}
// if it's a shapeBase object, create a Shape or ShapeNode constraint
if (dynamic_cast<ShapeBase*>(arb_obj))
{
if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center)
{
afxShapeConstraint* cons = newShapeCons(this, def.cons_src_name, want_history);
cons->cons_def = def;
cons->set((ShapeBase*)arb_obj);
afxConstraintList* list = new afxConstraintList();
list->push_back(cons);
constraints_v.push_back(list);
}
else if (def.pos_at_box_center)
{
afxShapeConstraint* cons = newShapeCons(this, def.cons_src_name, want_history);
cons->cons_def = def;
cons->set((ShapeBase*)arb_obj);
afxConstraintList* list = constraints_v[constraints_v.size()-1]; // SHAPE-NODE CONS-LIST (#scene)(#center)
if (list && (*list)[0])
list->push_back(cons);
}
else
{
afxShapeNodeConstraint* sub = newShapeNodeCons(this, def.cons_src_name, def.cons_node_name, want_history);
sub->cons_def = def;
sub->set((ShapeBase*)arb_obj);
afxConstraintList* list = constraints_v[constraints_v.size()-1];
if (list && (*list)[0])
list->push_back(sub);
}
}
// if it's not a shapeBase object, create an Object constraint
else if (arb_obj)
{
if (!def.pos_at_box_center)
{
afxObjectConstraint* cons = newObjectCons(this, def.cons_src_name, want_history);
cons->cons_def = def;
cons->set(arb_obj);
afxConstraintList* list = new afxConstraintList(); // OBJECT CONS-LIST (#scene)
list->push_back(cons);
constraints_v.push_back(list);
}
else // if (def.pos_at_box_center)
{
afxObjectConstraint* cons = newObjectCons(this, def.cons_src_name, want_history);
cons->cons_def = def;
cons->set(arb_obj);
afxConstraintList* list = constraints_v[constraints_v.size()-1]; // OBJECT CONS-LIST (#scene)(#center)
if (list && (*list)[0])
list->push_back(cons);
}
}
}
// constraint is an arbitrary named effect
//
else if (def.def_type == afxConstraintDef::CONS_EFFECT)
{
if (def.cons_src_name == ST_NULLSTRING)
return;
// create an Effect constraint
if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center)
{
afxEffectConstraint* cons = new afxEffectConstraint(this, def.cons_src_name);
cons->cons_def = def;
afxConstraintList* list = new afxConstraintList();
list->push_back(cons);
constraints_v.push_back(list);
}
// create an Effect #center constraint
else if (def.pos_at_box_center)
{
afxEffectConstraint* cons = new afxEffectConstraint(this, def.cons_src_name);
cons->cons_def = def;
afxConstraintList* list = constraints_v[constraints_v.size()-1]; // EFFECT-NODE CONS-LIST (#effect)
if (list && (*list)[0])
list->push_back(cons);
}
// create an EffectNode constraint
else
{
afxEffectNodeConstraint* sub = new afxEffectNodeConstraint(this, def.cons_src_name, def.cons_node_name);
sub->cons_def = def;
afxConstraintList* list = constraints_v[constraints_v.size()-1];
if (list && (*list)[0])
list->push_back(sub);
}
}
// constraint is a predefined constraint
//
else
{
afxConstraint* cons = 0;
afxConstraint* cons_ctr = 0;
afxConstraint* sub = 0;
if (def.def_type == afxConstraintDef::CONS_GHOST)
{
for (S32 i = 0; i < predefs.size(); i++)
{
if (predefs[i].name == def.cons_src_name)
{
if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center)
{
cons = newShapeCons(this, want_history);
cons->cons_def = def;
}
else if (def.pos_at_box_center)
{
cons_ctr = newShapeCons(this, want_history);
cons_ctr->cons_def = def;
}
else
{
sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history);
sub->cons_def = def;
}
break;
}
}
}
else
{
for (S32 i = 0; i < predefs.size(); i++)
{
if (predefs[i].name == def.cons_src_name)
{
switch (predefs[i].type)
{
case POINT_CONSTRAINT:
cons = newPointCons(this, want_history);
cons->cons_def = def;
break;
case TRANSFORM_CONSTRAINT:
cons = newTransformCons(this, want_history);
cons->cons_def = def;
break;
case OBJECT_CONSTRAINT:
if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center)
{
cons = newShapeCons(this, want_history);
cons->cons_def = def;
}
else if (def.pos_at_box_center)
{
cons_ctr = newShapeCons(this, want_history);
cons_ctr->cons_def = def;
}
else
{
sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history);
sub->cons_def = def;
}
break;
case CAMERA_CONSTRAINT:
cons = newObjectCons(this, want_history);
cons->cons_def = def;
cons->cons_def.treat_as_camera = true;
break;
}
break;
}
}
}
if (cons)
{
afxConstraintList* list = new afxConstraintList();
list->push_back(cons);
constraints_v.push_back(list);
}
else if (cons_ctr && constraints_v.size() > 0)
{
afxConstraintList* list = constraints_v[constraints_v.size()-1]; // PREDEF-NODE CONS-LIST
if (list && (*list)[0])
list->push_back(cons_ctr);
}
else if (sub && constraints_v.size() > 0)
{
afxConstraintList* list = constraints_v[constraints_v.size()-1];
if (list && (*list)[0])
list->push_back(sub);
}
else
Con::printf("predef not found %s", def.cons_src_name);
}
}
afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def)
{
if (def.def_type == afxConstraintDef::CONS_UNDEFINED)
return afxConstraintID();
if (def.cons_src_name != ST_NULLSTRING)
{
for (S32 i = 0; i < constraints_v.size(); i++)
{
afxConstraintList* list = constraints_v[i];
afxConstraint* cons = (*list)[0];
if (def.cons_src_name == cons->cons_def.cons_src_name)
{
for (S32 j = 0; j < list->size(); j++)
{
afxConstraint* sub = (*list)[j];
if (def.cons_node_name == sub->cons_def.cons_node_name &&
def.pos_at_box_center == sub->cons_def.pos_at_box_center &&
def.cons_src_name == sub->cons_def.cons_src_name)
{
return afxConstraintID(i, j);
}
}
// if we're here, it means the root object name matched but the node name
// did not.
if (def.def_type == afxConstraintDef::CONS_PREDEFINED && !def.pos_at_box_center)
{
afxShapeConstraint* shape_cons = dynamic_cast<afxShapeConstraint*>(cons);
if (shape_cons)
{
//Con::errorf("Append a Node constraint [%s.%s] [%d,%d]", def.cons_src_name, def.cons_node_name, i, list->size());
bool want_history = (def.history_time > 0.0f);
afxConstraint* sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history);
sub->cons_def = def;
((afxShapeConstraint*)sub)->set(shape_cons->shape);
list->push_back(sub);
return afxConstraintID(i, list->size()-1);
}
}
break;
}
}
}
return afxConstraintID();
}
afxConstraint* afxConstraintMgr::getConstraint(afxConstraintID id)
{
if (id.undefined())
return 0;
afxConstraint* cons = CONS_BY_IJ(id.index,id.sub_index);
if (cons && !cons->isDefined())
return NULL;
return cons;
}
void afxConstraintMgr::sample(F32 dt, U32 now, const Point3F* cam_pos)
{
U32 elapsed = now - starttime;
for (S32 i = 0; i < constraints_v.size(); i++)
{
afxConstraintList* list = constraints_v[i];
for (S32 j = 0; j < list->size(); j++)
(*list)[j]->sample(dt, elapsed, cam_pos);
}
}
S32 QSORT_CALLBACK cmp_cons_defs(const void* a, const void* b)
{
afxConstraintDef* def_a = (afxConstraintDef*) a;
afxConstraintDef* def_b = (afxConstraintDef*) b;
if (def_a->def_type == def_b->def_type)
{
if (def_a->cons_src_name == def_b->cons_src_name)
{
if (def_a->pos_at_box_center == def_b->pos_at_box_center)
return (def_a->cons_node_name - def_b->cons_node_name);
else
return (def_a->pos_at_box_center) ? 1 : -1;
}
return (def_a->cons_src_name - def_b->cons_src_name);
}
return (def_a->def_type - def_b->def_type);
}
void afxConstraintMgr::initConstraintDefs(Vector<afxConstraintDef>& all_defs, bool on_server, F32 scoping_dist)
{
initialized = true;
this->on_server = on_server;
if (scoping_dist > 0.0)
scoping_dist_sq = scoping_dist*scoping_dist;
else
{
SceneManager* sg = (on_server) ? gServerSceneGraph : gClientSceneGraph;
F32 vis_dist = (sg) ? sg->getVisibleDistance() : 1000.0f;
scoping_dist_sq = vis_dist*vis_dist;
}
if (all_defs.size() < 1)
return;
// find effect ghost constraints
if (!on_server)
{
Vector<afxConstraintDef> ghost_defs;
for (S32 i = 0; i < all_defs.size(); i++)
if (all_defs[i].def_type == afxConstraintDef::CONS_GHOST && all_defs[i].cons_src_name != ST_NULLSTRING)
ghost_defs.push_back(all_defs[i]);
if (ghost_defs.size() > 0)
{
// sort the defs
if (ghost_defs.size() > 1)
dQsort(ghost_defs.address(), ghost_defs.size(), sizeof(afxConstraintDef), cmp_cons_defs);
S32 last = 0;
defineConstraint(OBJECT_CONSTRAINT, ghost_defs[0].cons_src_name);
for (S32 i = 1; i < ghost_defs.size(); i++)
{
if (ghost_defs[last].cons_src_name != ghost_defs[i].cons_src_name)
{
defineConstraint(OBJECT_CONSTRAINT, ghost_defs[i].cons_src_name);
last++;
}
}
}
}
Vector<afxConstraintDef> defs;
// collect defs that run here (server or client)
if (on_server)
{
for (S32 i = 0; i < all_defs.size(); i++)
if (all_defs[i].runs_on_server)
defs.push_back(all_defs[i]);
}
else
{
for (S32 i = 0; i < all_defs.size(); i++)
if (all_defs[i].runs_on_client)
defs.push_back(all_defs[i]);
}
// create unique set of constraints.
//
if (defs.size() > 0)
{
// sort the defs
if (defs.size() > 1)
dQsort(defs.address(), defs.size(), sizeof(afxConstraintDef), cmp_cons_defs);
Vector<afxConstraintDef> unique_defs;
S32 last = 0;
// manufacture root-object def if absent
if (defs[0].cons_node_name != ST_NULLSTRING)
{
afxConstraintDef root_def = defs[0];
root_def.cons_node_name = ST_NULLSTRING;
unique_defs.push_back(root_def);
last++;
}
else if (defs[0].pos_at_box_center)
{
afxConstraintDef root_def = defs[0];
root_def.pos_at_box_center = false;
unique_defs.push_back(root_def);
last++;
}
unique_defs.push_back(defs[0]);
for (S32 i = 1; i < defs.size(); i++)
{
if (unique_defs[last].cons_node_name != defs[i].cons_node_name ||
unique_defs[last].cons_src_name != defs[i].cons_src_name ||
unique_defs[last].pos_at_box_center != defs[i].pos_at_box_center ||
unique_defs[last].def_type != defs[i].def_type)
{
// manufacture root-object def if absent
if (defs[i].cons_src_name != ST_NULLSTRING && unique_defs[last].cons_src_name != defs[i].cons_src_name)
{
if (defs[i].cons_node_name != ST_NULLSTRING || defs[i].pos_at_box_center)
{
afxConstraintDef root_def = defs[i];
root_def.cons_node_name = ST_NULLSTRING;
root_def.pos_at_box_center = false;
unique_defs.push_back(root_def);
last++;
}
}
unique_defs.push_back(defs[i]);
last++;
}
else
{
if (defs[i].history_time > unique_defs[last].history_time)
unique_defs[last].history_time = defs[i].history_time;
if (defs[i].sample_rate > unique_defs[last].sample_rate)
unique_defs[last].sample_rate = defs[i].sample_rate;
}
}
//Con::printf("\nConstraints on %s", (on_server) ? "server" : "client");
for (S32 i = 0; i < unique_defs.size(); i++)
create_constraint(unique_defs[i]);
}
// collect the names of all the arbitrary object constraints
// that run on clients and store in names_on_server array.
//
if (on_server)
{
names_on_server.clear();
defs.clear();
for (S32 i = 0; i < all_defs.size(); i++)
if (all_defs[i].runs_on_client && all_defs[i].isArbitraryObject())
defs.push_back(all_defs[i]);
if (defs.size() < 1)
return;
// sort the defs
if (defs.size() > 1)
dQsort(defs.address(), defs.size(), sizeof(afxConstraintDef), cmp_cons_defs);
S32 last = 0;
names_on_server.push_back(defs[0].cons_src_name);
for (S32 i = 1; i < defs.size(); i++)
{
if (names_on_server[last] != defs[i].cons_src_name)
{
names_on_server.push_back(defs[i].cons_src_name);
last++;
}
}
}
}
void afxConstraintMgr::packConstraintNames(NetConnection* conn, BitStream* stream)
{
// pack any named constraint names and ghost indices
if (stream->writeFlag(names_on_server.size() > 0)) //-- ANY NAMED CONS_BY_ID?
{
stream->write(names_on_server.size());
for (S32 i = 0; i < names_on_server.size(); i++)
{
stream->writeString(names_on_server[i]);
NetObject* obj = dynamic_cast<NetObject*>(Sim::findObject(names_on_server[i]));
if (!obj)
{
//Con::printf("CONSTRAINT-OBJECT %s does not exist.", names_on_server[i]);
stream->write((S32)-1);
}
else
{
S32 ghost_id = conn->getGhostIndex(obj);
/*
if (ghost_id == -1)
Con::printf("CONSTRAINT-OBJECT %s does not have a ghost.", names_on_server[i]);
else
Con::printf("CONSTRAINT-OBJECT %s name to server.", names_on_server[i]);
*/
stream->write(ghost_id);
}
}
}
}
void afxConstraintMgr::unpackConstraintNames(BitStream* stream)
{
if (stream->readFlag()) //-- ANY NAMED CONS_BY_ID?
{
names_on_server.clear();
S32 sz; stream->read(&sz);
for (S32 i = 0; i < sz; i++)
{
names_on_server.push_back(stream->readSTString());
S32 ghost_id; stream->read(&ghost_id);
ghost_ids.push_back(ghost_id);
}
}
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//
SceneObject* afxConstraintMgr::find_object_from_name(StringTableEntry name)
{
if (names_on_server.size() > 0)
{
for (S32 i = 0; i < names_on_server.size(); i++)
if (names_on_server[i] == name)
{
if (ghost_ids[i] == -1)
return 0;
NetConnection* conn = NetConnection::getConnectionToServer();
if (!conn)
return 0;
return dynamic_cast<SceneObject*>(conn->resolveGhost(ghost_ids[i]));
}
}
return dynamic_cast<SceneObject*>(Sim::findObject(name));
}
void afxConstraintMgr::addScopeableObject(SceneObject* object)
{
for (S32 i = 0; i < scopeable_objs.size(); i++)
{
if (scopeable_objs[i] == object)
return;
}
object->addScopeRef();
scopeable_objs.push_back(object);
}
void afxConstraintMgr::removeScopeableObject(SceneObject* object)
{
for (S32 i = 0; i < scopeable_objs.size(); i++)
if (scopeable_objs[i] == object)
{
object->removeScopeRef();
scopeable_objs.erase_fast(i);
return;
}
}
void afxConstraintMgr::clearAllScopeableObjs()
{
for (S32 i = 0; i < scopeable_objs.size(); i++)
scopeable_objs[i]->removeScopeRef();
scopeable_objs.clear();
}
void afxConstraintMgr::postMissingConstraintObject(afxConstraint* cons, bool is_deleting)
{
if (cons->gone_missing)
return;
if (!is_deleting)
{
SceneObject* obj = arcaneFX::findScopedObject(cons->getScopeId());
if (obj)
{
cons->restoreObject(obj);
return;
}
}
cons->gone_missing = true;
missing_objs->push_back(cons);
}
void afxConstraintMgr::restoreScopedObject(SceneObject* obj, afxChoreographer* ch)
{
for (S32 i = 0; i < missing_objs->size(); i++)
{
if ((*missing_objs)[i]->getScopeId() == obj->getScopeId())
{
(*missing_objs)[i]->gone_missing = false;
(*missing_objs)[i]->restoreObject(obj);
if (ch)
ch->restoreObject(obj);
}
else
missing_objs2->push_back((*missing_objs)[i]);
}
Vector<afxConstraint*>* tmp = missing_objs;
missing_objs = missing_objs2;
missing_objs2 = tmp;
missing_objs2->clear();
}
void afxConstraintMgr::adjustProcessOrdering(afxChoreographer* ch)
{
Vector<ProcessObject*> cons_sources;
// add choreographer to the list
cons_sources.push_back(ch);
// collect all the ProcessObject related constraint sources
for (S32 i = 0; i < constraints_v.size(); i++)
{
afxConstraintList* list = constraints_v[i];
afxConstraint* cons = (*list)[0];
if (cons)
{
ProcessObject* pobj = dynamic_cast<ProcessObject*>(cons->getSceneObject());
if (pobj)
cons_sources.push_back(pobj);
}
}
ProcessList* proc_list;
if (ch->isServerObject())
proc_list = ServerProcessList::get();
else
proc_list = ClientProcessList::get();
if (!proc_list)
return;
GameBase* nearest_to_end = dynamic_cast<GameBase*>(proc_list->findNearestToEnd(cons_sources));
GameBase* chor = (GameBase*) ch;
// choreographer needs to be processed after the latest process object
if (chor != nearest_to_end && nearest_to_end != 0)
{
//Con::printf("Choreographer processing BEFORE some of its constraints... fixing. [%s] -- %s",
// (ch->isServerObject()) ? "S" : "C", nearest_to_end->getClassName());
if (chor->isProperlyAdded())
ch->processAfter(nearest_to_end);
else
ch->postProcessAfterObject(nearest_to_end);
}
else
{
//Con::printf("Choreographer processing AFTER its constraints... fine. [%s]",
// (ch->isServerObject()) ? "S" : "C");
}
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxPointConstraint
afxPointConstraint::afxPointConstraint(afxConstraintMgr* mgr)
: afxConstraint(mgr)
{
point.zero();
vector.set(0,0,1);
}
afxPointConstraint::~afxPointConstraint()
{
}
void afxPointConstraint::set(Point3F point, Point3F vector)
{
this->point = point;
this->vector = vector;
is_defined = true;
is_valid = true;
change_code++;
sample(0.0f, 0, 0);
}
void afxPointConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
if (cam_pos)
{
Point3F dir = (*cam_pos) - point;
F32 dist_sq = dir.lenSquared();
if (dist_sq > mgr->getScopingDistanceSquared())
{
is_valid = false;
return;
}
is_valid = true;
}
last_pos = point;
last_xfm.identity();
last_xfm.setPosition(point);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxTransformConstraint
afxTransformConstraint::afxTransformConstraint(afxConstraintMgr* mgr)
: afxConstraint(mgr)
{
xfm.identity();
}
afxTransformConstraint::~afxTransformConstraint()
{
}
void afxTransformConstraint::set(const MatrixF& xfm)
{
this->xfm = xfm;
is_defined = true;
is_valid = true;
change_code++;
sample(0.0f, 0, 0);
}
void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
if (cam_pos)
{
Point3F dir = (*cam_pos) - xfm.getPosition();
F32 dist_sq = dir.lenSquared();
if (dist_sq > mgr->getScopingDistanceSquared())
{
is_valid = false;
return;
}
is_valid = true;
}
last_xfm = xfm;
last_pos = xfm.getPosition();
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxShapeConstraint
afxShapeConstraint::afxShapeConstraint(afxConstraintMgr* mgr)
: afxConstraint(mgr)
{
arb_name = ST_NULLSTRING;
shape = 0;
scope_id = 0;
clip_tag = 0;
lock_tag = 0;
}
afxShapeConstraint::afxShapeConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name)
: afxConstraint(mgr)
{
this->arb_name = arb_name;
shape = 0;
scope_id = 0;
clip_tag = 0;
lock_tag = 0;
}
afxShapeConstraint::~afxShapeConstraint()
{
if (shape)
clearNotify(shape);
}
void afxShapeConstraint::set(ShapeBase* shape)
{
if (this->shape)
{
scope_id = 0;
clearNotify(this->shape);
if (clip_tag > 0)
remapAnimation(clip_tag, shape);
if (lock_tag > 0)
unlockAnimation(lock_tag);
}
this->shape = shape;
if (this->shape)
{
deleteNotify(this->shape);
scope_id = this->shape->getScopeId();
}
if (this->shape != NULL)
{
is_defined = true;
is_valid = true;
change_code++;
sample(0.0f, 0, 0);
}
else
is_valid = false;
}
void afxShapeConstraint::set_scope_id(U16 scope_id)
{
if (shape)
clearNotify(shape);
shape = 0;
this->scope_id = scope_id;
is_defined = (this->scope_id > 0);
is_valid = false;
mgr->postMissingConstraintObject(this);
}
void afxShapeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
if (gone_missing)
return;
if (shape)
{
last_xfm = shape->getRenderTransform();
if (cons_def.pos_at_box_center)
last_pos = shape->getBoxCenter();
else
last_pos = shape->getRenderPosition();
}
}
void afxShapeConstraint::restoreObject(SceneObject* obj)
{
if (this->shape)
{
scope_id = 0;
clearNotify(this->shape);
}
this->shape = (ShapeBase* )obj;
if (this->shape)
{
deleteNotify(this->shape);
scope_id = this->shape->getScopeId();
}
is_valid = (this->shape != NULL);
}
void afxShapeConstraint::onDeleteNotify(SimObject* obj)
{
if (shape == dynamic_cast<ShapeBase*>(obj))
{
shape = 0;
is_valid = false;
if (scope_id > 0)
mgr->postMissingConstraintObject(this, true);
}
Parent::onDeleteNotify(obj);
}
U32 afxShapeConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim)
{
if (!shape)
return 0;
if (shape->isServerObject())
{
AIPlayer* ai_player = dynamic_cast<AIPlayer*>(shape);
if (ai_player && !ai_player->isBlendAnimation(clip))
{
ai_player->saveMoveState();
ai_player->stopMove();
}
}
clip_tag = shape->playAnimation(clip, pos, rate, trans, false/*hold*/, true/*wait*/, is_death_anim);
return clip_tag;
}
void afxShapeConstraint::remapAnimation(U32 tag, ShapeBase* other_shape)
{
if (clip_tag == 0)
return;
if (!shape)
return;
if (!other_shape)
{
resetAnimation(tag);
return;
}
Con::errorf("remapAnimation -- Clip name, %s.", shape->getLastClipName(tag));
if (shape->isClientObject())
{
shape->restoreAnimation(tag);
}
else
{
AIPlayer* ai_player = dynamic_cast<AIPlayer*>(shape);
if (ai_player)
ai_player->restartMove(tag);
else
shape->restoreAnimation(tag);
}
clip_tag = 0;
}
void afxShapeConstraint::resetAnimation(U32 tag)
{
if (clip_tag == 0)
return;
if (!shape)
return;
if (shape->isClientObject())
{
shape->restoreAnimation(tag);
}
else
{
AIPlayer* ai_player = dynamic_cast<AIPlayer*>(shape);
if (ai_player)
ai_player->restartMove(tag);
else
shape->restoreAnimation(tag);
}
if ((tag & 0x80000000) == 0 && tag == clip_tag)
clip_tag = 0;
}
U32 afxShapeConstraint::lockAnimation()
{
if (!shape)
return 0;
lock_tag = shape->lockAnimation();
return lock_tag;
}
void afxShapeConstraint::unlockAnimation(U32 tag)
{
if (lock_tag == 0)
return;
if (!shape)
return;
shape->unlockAnimation(tag);
lock_tag = 0;
}
F32 afxShapeConstraint::getAnimClipDuration(const char* clip)
{
return (shape) ? shape->getAnimationDuration(clip) : 0.0f;
}
S32 afxShapeConstraint::getDamageState()
{
return (shape) ? shape->getDamageState() : -1;
}
U32 afxShapeConstraint::getTriggers()
{
return (shape) ? shape->getShapeInstance()->getTriggerStateMask() : 0;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxShapeNodeConstraint
afxShapeNodeConstraint::afxShapeNodeConstraint(afxConstraintMgr* mgr)
: afxShapeConstraint(mgr)
{
arb_node = ST_NULLSTRING;
shape_node_ID = -1;
}
afxShapeNodeConstraint::afxShapeNodeConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name, StringTableEntry arb_node)
: afxShapeConstraint(mgr, arb_name)
{
this->arb_node = arb_node;
shape_node_ID = -1;
}
void afxShapeNodeConstraint::set(ShapeBase* shape)
{
if (shape)
{
shape_node_ID = shape->getShape()->findNode(arb_node);
if (shape_node_ID == -1)
Con::errorf("Failed to find node [%s]", arb_node);
}
else
shape_node_ID = -1;
Parent::set(shape);
}
void afxShapeNodeConstraint::set_scope_id(U16 scope_id)
{
shape_node_ID = -1;
Parent::set_scope_id(scope_id);
}
void afxShapeNodeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
if (shape && shape_node_ID != -1)
{
last_xfm = shape->getRenderTransform();
last_xfm.scale(shape->getScale());
last_xfm.mul(shape->getShapeInstance()->mNodeTransforms[shape_node_ID]);
last_pos = last_xfm.getPosition();
}
}
void afxShapeNodeConstraint::restoreObject(SceneObject* obj)
{
ShapeBase* shape = dynamic_cast<ShapeBase*>(obj);
if (shape)
{
shape_node_ID = shape->getShape()->findNode(arb_node);
if (shape_node_ID == -1)
Con::errorf("Failed to find node [%s]", arb_node);
}
else
shape_node_ID = -1;
Parent::restoreObject(obj);
}
void afxShapeNodeConstraint::onDeleteNotify(SimObject* obj)
{
Parent::onDeleteNotify(obj);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxObjectConstraint
afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr)
: afxConstraint(mgr)
{
arb_name = ST_NULLSTRING;
obj = 0;
scope_id = 0;
is_camera = false;
}
afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name)
: afxConstraint(mgr)
{
this->arb_name = arb_name;
obj = 0;
scope_id = 0;
is_camera = false;
}
afxObjectConstraint::~afxObjectConstraint()
{
if (obj)
clearNotify(obj);
}
void afxObjectConstraint::set(SceneObject* obj)
{
if (this->obj)
{
scope_id = 0;
clearNotify(this->obj);
}
this->obj = obj;
if (this->obj)
{
deleteNotify(this->obj);
scope_id = this->obj->getScopeId();
}
if (this->obj != NULL)
{
is_camera = this->obj->isCamera();
is_defined = true;
is_valid = true;
change_code++;
sample(0.0f, 0, 0);
}
else
is_valid = false;
}
void afxObjectConstraint::set_scope_id(U16 scope_id)
{
if (obj)
clearNotify(obj);
obj = 0;
this->scope_id = scope_id;
is_defined = (scope_id > 0);
is_valid = false;
mgr->postMissingConstraintObject(this);
}
void afxObjectConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
if (gone_missing)
return;
if (obj)
{
if (!is_camera && cons_def.treat_as_camera && dynamic_cast<ShapeBase*>(obj))
{
ShapeBase* cam_obj = (ShapeBase*) obj;
F32 pov = 1.0f;
cam_obj->getCameraTransform(&pov, &last_xfm);
last_xfm.getColumn(3, &last_pos);
}
else
{
last_xfm = obj->getRenderTransform();
if (cons_def.pos_at_box_center)
last_pos = obj->getBoxCenter();
else
last_pos = obj->getRenderPosition();
}
}
}
void afxObjectConstraint::restoreObject(SceneObject* obj)
{
if (this->obj)
{
scope_id = 0;
clearNotify(this->obj);
}
this->obj = obj;
if (this->obj)
{
deleteNotify(this->obj);
scope_id = this->obj->getScopeId();
}
is_valid = (this->obj != NULL);
}
void afxObjectConstraint::onDeleteNotify(SimObject* obj)
{
if (this->obj == dynamic_cast<SceneObject*>(obj))
{
this->obj = 0;
is_valid = false;
if (scope_id > 0)
mgr->postMissingConstraintObject(this, true);
}
Parent::onDeleteNotify(obj);
}
U32 afxObjectConstraint::getTriggers()
{
TSStatic* ts_static = dynamic_cast<TSStatic*>(obj);
if (ts_static)
{
TSShapeInstance* obj_inst = ts_static->getShapeInstance();
return (obj_inst) ? obj_inst->getTriggerStateMask() : 0;
}
ShapeBase* shape_base = dynamic_cast<ShapeBase*>(obj);
if (shape_base)
{
TSShapeInstance* obj_inst = shape_base->getShapeInstance();
return (obj_inst) ? obj_inst->getTriggerStateMask() : 0;
}
return 0;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxEffectConstraint
afxEffectConstraint::afxEffectConstraint(afxConstraintMgr* mgr)
: afxConstraint(mgr)
{
effect_name = ST_NULLSTRING;
effect = 0;
}
afxEffectConstraint::afxEffectConstraint(afxConstraintMgr* mgr, StringTableEntry effect_name)
: afxConstraint(mgr)
{
this->effect_name = effect_name;
effect = 0;
}
afxEffectConstraint::~afxEffectConstraint()
{
}
bool afxEffectConstraint::getPosition(Point3F& pos, F32 hist)
{
if (!effect || !effect->inScope())
return false;
if (cons_def.pos_at_box_center)
effect->getUpdatedBoxCenter(pos);
else
effect->getUpdatedPosition(pos);
return true;
}
bool afxEffectConstraint::getTransform(MatrixF& xfm, F32 hist)
{
if (!effect || !effect->inScope())
return false;
effect->getUpdatedTransform(xfm);
return true;
}
bool afxEffectConstraint::getAltitudes(F32& terrain_alt, F32& interior_alt)
{
if (!effect)
return false;
effect->getAltitudes(terrain_alt, interior_alt);
return true;
}
void afxEffectConstraint::set(afxEffectWrapper* effect)
{
this->effect = effect;
if (this->effect != NULL)
{
is_defined = true;
is_valid = true;
change_code++;
}
else
is_valid = false;
}
U32 afxEffectConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim)
{
return (effect) ? effect->setAnimClip(clip, pos, rate, trans) : 0;
}
void afxEffectConstraint::resetAnimation(U32 tag)
{
if (effect)
effect->resetAnimation(tag);
}
F32 afxEffectConstraint::getAnimClipDuration(const char* clip)
{
return (effect) ? getAnimClipDuration(clip) : 0;
}
U32 afxEffectConstraint::getTriggers()
{
return (effect) ? effect->getTriggers() : 0;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxEffectNodeConstraint
afxEffectNodeConstraint::afxEffectNodeConstraint(afxConstraintMgr* mgr)
: afxEffectConstraint(mgr)
{
effect_node = ST_NULLSTRING;
effect_node_ID = -1;
}
afxEffectNodeConstraint::afxEffectNodeConstraint(afxConstraintMgr* mgr, StringTableEntry name, StringTableEntry node)
: afxEffectConstraint(mgr, name)
{
this->effect_node = node;
effect_node_ID = -1;
}
bool afxEffectNodeConstraint::getPosition(Point3F& pos, F32 hist)
{
if (!effect || !effect->inScope())
return false;
TSShapeInstance* ts_shape_inst = effect->getTSShapeInstance();
if (!ts_shape_inst)
return false;
if (effect_node_ID == -1)
{
TSShape* ts_shape = effect->getTSShape();
effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1;
}
if (effect_node_ID == -1)
return false;
effect->getUpdatedTransform(last_xfm);
Point3F scale;
effect->getUpdatedScale(scale);
MatrixF gag = ts_shape_inst->mNodeTransforms[effect_node_ID];
gag.setPosition( gag.getPosition()*scale );
MatrixF xfm;
xfm.mul(last_xfm, gag);
//
pos = xfm.getPosition();
return true;
}
bool afxEffectNodeConstraint::getTransform(MatrixF& xfm, F32 hist)
{
if (!effect || !effect->inScope())
return false;
TSShapeInstance* ts_shape_inst = effect->getTSShapeInstance();
if (!ts_shape_inst)
return false;
if (effect_node_ID == -1)
{
TSShape* ts_shape = effect->getTSShape();
effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1;
}
if (effect_node_ID == -1)
return false;
effect->getUpdatedTransform(last_xfm);
Point3F scale;
effect->getUpdatedScale(scale);
MatrixF gag = ts_shape_inst->mNodeTransforms[effect_node_ID];
gag.setPosition( gag.getPosition()*scale );
xfm.mul(last_xfm, gag);
return true;
}
void afxEffectNodeConstraint::set(afxEffectWrapper* effect)
{
if (effect)
{
TSShape* ts_shape = effect->getTSShape();
effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1;
}
else
effect_node_ID = -1;
Parent::set(effect);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxSampleBuffer
afxSampleBuffer::afxSampleBuffer()
{
buffer_sz = 0;
buffer_ms = 0;
ms_per_sample = 33;
elapsed_ms = 0;
last_sample_ms = 0;
next_sample_num = 0;
n_samples = 0;
}
afxSampleBuffer::~afxSampleBuffer()
{
}
void afxSampleBuffer::configHistory(F32 hist_len, U8 sample_rate)
{
buffer_sz = mCeil(hist_len*sample_rate) + 1;
ms_per_sample = mCeil(1000.0f/sample_rate);
buffer_ms = buffer_sz*ms_per_sample;
}
void afxSampleBuffer::recordSample(F32 dt, U32 elapsed_ms, void* data)
{
this->elapsed_ms = elapsed_ms;
if (!data)
return;
U32 now_sample_num = elapsed_ms/ms_per_sample;
if (next_sample_num <= now_sample_num)
{
last_sample_ms = elapsed_ms;
while (next_sample_num <= now_sample_num)
{
recSample(next_sample_num % buffer_sz, data);
next_sample_num++;
n_samples++;
}
}
}
inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx)
{
bool in_bounds = true;
U32 lag_ms = lag*1000.0f;
U32 rec_ms = (elapsed_ms < buffer_ms) ? elapsed_ms : buffer_ms;
if (lag_ms > rec_ms)
{
// hasn't produced enough history
lag_ms = rec_ms;
in_bounds = false;
}
U32 latest_sample_num = last_sample_ms/ms_per_sample;
U32 then_sample_num = (elapsed_ms - lag_ms)/ms_per_sample;
if (then_sample_num > latest_sample_num)
{
// latest sample is older than lag
then_sample_num = latest_sample_num;
in_bounds = false;
}
idx = then_sample_num % buffer_sz;
return in_bounds;
}
inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, F32& t)
{
bool in_bounds = true;
F32 lag_ms = lag*1000.0f;
F32 rec_ms = (elapsed_ms < buffer_ms) ? elapsed_ms : buffer_ms;
if (lag_ms > rec_ms)
{
// hasn't produced enough history
lag_ms = rec_ms;
in_bounds = false;
}
F32 per_samp = ms_per_sample;
F32 latest_sample_num = last_sample_ms/per_samp;
F32 then_sample_num = (elapsed_ms - lag_ms)/per_samp;
U32 latest_sample_num_i = latest_sample_num;
U32 then_sample_num_i = then_sample_num;
if (then_sample_num_i >= latest_sample_num_i)
{
if (latest_sample_num_i < then_sample_num_i)
in_bounds = false;
t = 0.0;
idx1 = then_sample_num_i % buffer_sz;
idx2 = idx1;
}
else
{
t = then_sample_num - then_sample_num_i;
idx1 = then_sample_num_i % buffer_sz;
idx2 = (then_sample_num_i+1) % buffer_sz;
}
return in_bounds;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxSampleXfmBuffer
afxSampleXfmBuffer::afxSampleXfmBuffer()
{
xfm_buffer = 0;
}
afxSampleXfmBuffer::~afxSampleXfmBuffer()
{
delete [] xfm_buffer;
}
void afxSampleXfmBuffer::configHistory(F32 hist_len, U8 sample_rate)
{
if (!xfm_buffer)
{
afxSampleBuffer::configHistory(hist_len, sample_rate);
if (buffer_sz > 0)
xfm_buffer = new MatrixF[buffer_sz];
}
}
void afxSampleXfmBuffer::recSample(U32 idx, void* data)
{
xfm_buffer[idx] = *((MatrixF*)data);
}
void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds)
{
U32 idx1, idx2;
F32 t;
in_bounds = compute_idx_from_lag(lag, idx1, idx2, t);
if (idx1 == idx2)
{
MatrixF* m1 = &xfm_buffer[idx1];
*((MatrixF*)data) = *m1;
}
else
{
MatrixF* m1 = &xfm_buffer[idx1];
MatrixF* m2 = &xfm_buffer[idx2];
Point3F p1 = m1->getPosition();
Point3F p2 = m2->getPosition();
Point3F p; p.interpolate(p1, p2, t);
if (t < 0.5f)
*((MatrixF*)data) = *m1;
else
*((MatrixF*)data) = *m2;
((MatrixF*)data)->setPosition(p);
}
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxPointHistConstraint
afxPointHistConstraint::afxPointHistConstraint(afxConstraintMgr* mgr)
: afxPointConstraint(mgr)
{
samples = 0;
}
afxPointHistConstraint::~afxPointHistConstraint()
{
delete samples;
}
void afxPointHistConstraint::set(Point3F point, Point3F vector)
{
if (!samples)
{
samples = new afxSampleXfmBuffer;
samples->configHistory(cons_def.history_time, cons_def.sample_rate);
}
Parent::set(point, vector);
}
void afxPointHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
Parent::sample(dt, elapsed_ms, cam_pos);
if (isDefined())
{
if (isValid())
samples->recordSample(dt, elapsed_ms, &last_xfm);
else
samples->recordSample(dt, elapsed_ms, 0);
}
}
bool afxPointHistConstraint::getPosition(Point3F& pos, F32 hist)
{
bool in_bounds;
MatrixF xfm;
samples->getSample(hist, &xfm, in_bounds);
pos = xfm.getPosition();
return in_bounds;
}
bool afxPointHistConstraint::getTransform(MatrixF& xfm, F32 hist)
{
bool in_bounds;
samples->getSample(hist, &xfm, in_bounds);
return in_bounds;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxPointHistConstraint
afxTransformHistConstraint::afxTransformHistConstraint(afxConstraintMgr* mgr)
: afxTransformConstraint(mgr)
{
samples = 0;
}
afxTransformHistConstraint::~afxTransformHistConstraint()
{
delete samples;
}
void afxTransformHistConstraint::set(const MatrixF& xfm)
{
if (!samples)
{
samples = new afxSampleXfmBuffer;
samples->configHistory(cons_def.history_time, cons_def.sample_rate);
}
Parent::set(xfm);
}
void afxTransformHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
Parent::sample(dt, elapsed_ms, cam_pos);
if (isDefined())
{
if (isValid())
samples->recordSample(dt, elapsed_ms, &last_xfm);
else
samples->recordSample(dt, elapsed_ms, 0);
}
}
bool afxTransformHistConstraint::getPosition(Point3F& pos, F32 hist)
{
bool in_bounds;
MatrixF xfm;
samples->getSample(hist, &xfm, in_bounds);
pos = xfm.getPosition();
return in_bounds;
}
bool afxTransformHistConstraint::getTransform(MatrixF& xfm, F32 hist)
{
bool in_bounds;
samples->getSample(hist, &xfm, in_bounds);
return in_bounds;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxShapeHistConstraint
afxShapeHistConstraint::afxShapeHistConstraint(afxConstraintMgr* mgr)
: afxShapeConstraint(mgr)
{
samples = 0;
}
afxShapeHistConstraint::afxShapeHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name)
: afxShapeConstraint(mgr, arb_name)
{
samples = 0;
}
afxShapeHistConstraint::~afxShapeHistConstraint()
{
delete samples;
}
void afxShapeHistConstraint::set(ShapeBase* shape)
{
if (shape && !samples)
{
samples = new afxSampleXfmBuffer;
samples->configHistory(cons_def.history_time, cons_def.sample_rate);
}
Parent::set(shape);
}
void afxShapeHistConstraint::set_scope_id(U16 scope_id)
{
if (scope_id > 0 && !samples)
{
samples = new afxSampleXfmBuffer;
samples->configHistory(cons_def.history_time, cons_def.sample_rate);
}
Parent::set_scope_id(scope_id);
}
void afxShapeHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
Parent::sample(dt, elapsed_ms, cam_pos);
if (isDefined())
{
if (isValid())
samples->recordSample(dt, elapsed_ms, &last_xfm);
else
samples->recordSample(dt, elapsed_ms, 0);
}
}
bool afxShapeHistConstraint::getPosition(Point3F& pos, F32 hist)
{
bool in_bounds;
MatrixF xfm;
samples->getSample(hist, &xfm, in_bounds);
pos = xfm.getPosition();
return in_bounds;
}
bool afxShapeHistConstraint::getTransform(MatrixF& xfm, F32 hist)
{
bool in_bounds;
samples->getSample(hist, &xfm, in_bounds);
return in_bounds;
}
void afxShapeHistConstraint::onDeleteNotify(SimObject* obj)
{
Parent::onDeleteNotify(obj);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxShapeNodeHistConstraint
afxShapeNodeHistConstraint::afxShapeNodeHistConstraint(afxConstraintMgr* mgr)
: afxShapeNodeConstraint(mgr)
{
samples = 0;
}
afxShapeNodeHistConstraint::afxShapeNodeHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name,
StringTableEntry arb_node)
: afxShapeNodeConstraint(mgr, arb_name, arb_node)
{
samples = 0;
}
afxShapeNodeHistConstraint::~afxShapeNodeHistConstraint()
{
delete samples;
}
void afxShapeNodeHistConstraint::set(ShapeBase* shape)
{
if (shape && !samples)
{
samples = new afxSampleXfmBuffer;
samples->configHistory(cons_def.history_time, cons_def.sample_rate);
}
Parent::set(shape);
}
void afxShapeNodeHistConstraint::set_scope_id(U16 scope_id)
{
if (scope_id > 0 && !samples)
{
samples = new afxSampleXfmBuffer;
samples->configHistory(cons_def.history_time, cons_def.sample_rate);
}
Parent::set_scope_id(scope_id);
}
void afxShapeNodeHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
Parent::sample(dt, elapsed_ms, cam_pos);
if (isDefined())
{
if (isValid())
samples->recordSample(dt, elapsed_ms, &last_xfm);
else
samples->recordSample(dt, elapsed_ms, 0);
}
}
bool afxShapeNodeHistConstraint::getPosition(Point3F& pos, F32 hist)
{
bool in_bounds;
MatrixF xfm;
samples->getSample(hist, &xfm, in_bounds);
pos = xfm.getPosition();
return in_bounds;
}
bool afxShapeNodeHistConstraint::getTransform(MatrixF& xfm, F32 hist)
{
bool in_bounds;
samples->getSample(hist, &xfm, in_bounds);
return in_bounds;
}
void afxShapeNodeHistConstraint::onDeleteNotify(SimObject* obj)
{
Parent::onDeleteNotify(obj);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxObjectHistConstraint
afxObjectHistConstraint::afxObjectHistConstraint(afxConstraintMgr* mgr)
: afxObjectConstraint(mgr)
{
samples = 0;
}
afxObjectHistConstraint::afxObjectHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name)
: afxObjectConstraint(mgr, arb_name)
{
samples = 0;
}
afxObjectHistConstraint::~afxObjectHistConstraint()
{
delete samples;
}
void afxObjectHistConstraint::set(SceneObject* obj)
{
if (obj && !samples)
{
samples = new afxSampleXfmBuffer;
samples->configHistory(cons_def.history_time, cons_def.sample_rate);
}
Parent::set(obj);
}
void afxObjectHistConstraint::set_scope_id(U16 scope_id)
{
if (scope_id > 0 && !samples)
{
samples = new afxSampleXfmBuffer;
samples->configHistory(cons_def.history_time, cons_def.sample_rate);
}
Parent::set_scope_id(scope_id);
}
void afxObjectHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)
{
Parent::sample(dt, elapsed_ms, cam_pos);
if (isDefined())
{
if (isValid())
samples->recordSample(dt, elapsed_ms, &last_xfm);
else
samples->recordSample(dt, elapsed_ms, 0);
}
}
bool afxObjectHistConstraint::getPosition(Point3F& pos, F32 hist)
{
bool in_bounds;
MatrixF xfm;
samples->getSample(hist, &xfm, in_bounds);
pos = xfm.getPosition();
return in_bounds;
}
bool afxObjectHistConstraint::getTransform(MatrixF& xfm, F32 hist)
{
bool in_bounds;
samples->getSample(hist, &xfm, in_bounds);
return in_bounds;
}
void afxObjectHistConstraint::onDeleteNotify(SimObject* obj)
{
Parent::onDeleteNotify(obj);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
| 24.674063
| 127
| 0.63771
|
John3
|
78a81ca3d1a317cf93b23974abb97ea9f8cf617a
| 4,105
|
hpp
|
C++
|
Box2D/Common/BlockAllocator.hpp
|
louis-langholtz/Box2D
|
7c74792bf177cf36640d735de2bba0225bf7f852
|
[
"Zlib"
] | 32
|
2016-10-20T05:55:04.000Z
|
2021-11-25T16:34:41.000Z
|
Box2D/Common/BlockAllocator.hpp
|
louis-langholtz/Box2D
|
7c74792bf177cf36640d735de2bba0225bf7f852
|
[
"Zlib"
] | 50
|
2017-01-07T21:40:16.000Z
|
2018-01-31T10:04:05.000Z
|
Box2D/Common/BlockAllocator.hpp
|
louis-langholtz/Box2D
|
7c74792bf177cf36640d735de2bba0225bf7f852
|
[
"Zlib"
] | 7
|
2017-02-09T10:02:02.000Z
|
2020-07-23T22:49:04.000Z
|
/*
* Original work Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
* Modified work Copyright (c) 2017 Louis Langholtz https://github.com/louis-langholtz/Box2D
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef B2_BLOCK_ALLOCATOR_H
#define B2_BLOCK_ALLOCATOR_H
#include <Box2D/Common/Settings.hpp>
namespace box2d {
/// Block allocator.
///
/// This is a small object allocator used for allocating small
/// objects that persist for more than one time step.
/// @note This data structure is 136-bytes large (on at least one 64-bit platform).
/// @sa http://www.codeproject.com/useritems/Small_Block_Allocator.asp
///
class BlockAllocator
{
public:
using size_type = std::size_t;
static constexpr auto ChunkSize = size_type{16 * 1024}; ///< Chunk size.
static constexpr auto MaxBlockSize = size_type{640}; ///< Max block size (before using external allocator).
static constexpr auto BlockSizes = size_type{14};
static constexpr auto ChunkArrayIncrement = size_type{128};
BlockAllocator();
~BlockAllocator() noexcept;
/// Allocates memory.
/// @details Allocates uninitialized storage.
/// Uses <code>Alloc</code> if the size is larger than <code>MaxBlockSize</code>.
/// Otherwise looks for an appropriately sized block from the free list.
/// Failing that, <code>Alloc</code> is used to grow the free list from which
/// memory is returned.
/// @sa Alloc.
void* Allocate(size_type n);
template <typename T>
T* AllocateArray(size_type n)
{
return static_cast<T*>(Allocate(n * sizeof(T)));
}
/// Free memory.
/// @details This will use free if the size is larger than <code>MaxBlockSize</code>.
void Free(void* p, size_type n);
/// Clears this allocator.
/// @note This resets the chunk-count back to zero.
void Clear();
auto GetChunkCount() const noexcept
{
return m_chunkCount;
}
private:
struct Chunk;
struct Block;
size_type m_chunkCount = 0;
size_type m_chunkSpace = ChunkArrayIncrement;
Chunk* m_chunks;
Block* m_freeLists[BlockSizes];
};
template <typename T>
inline void Delete(const T* p, BlockAllocator& allocator)
{
p->~T();
allocator.Free(const_cast<T*>(p), sizeof(T));
}
/// Blockl Deallocator.
struct BlockDeallocator
{
using size_type = BlockAllocator::size_type;
BlockDeallocator() = default;
constexpr BlockDeallocator(BlockAllocator* a, size_type n) noexcept: allocator{a}, nelem{n} {}
void operator()(void *p) noexcept
{
allocator->Free(p, nelem);
}
BlockAllocator* allocator;
size_type nelem;
};
inline bool operator==(const BlockAllocator& a, const BlockAllocator& b)
{
return &a == &b;
}
inline bool operator!=(const BlockAllocator& a, const BlockAllocator& b)
{
return &a != &b;
}
} // namespace box2d
#endif
| 33.373984
| 115
| 0.629963
|
louis-langholtz
|
78abb23a44370079bef4f9395a04f4df1b52bac4
| 8,070
|
cpp
|
C++
|
APPENDIX_A_EXAMPLES/LINUX_VERSIONS/append_example8/append_example_a8.cpp
|
cp-shen/interactive_computer_graphics
|
786f53d752f7b213b60a5508917e7c7f6e188c6e
|
[
"MIT"
] | 36
|
2015-12-10T03:33:56.000Z
|
2022-02-02T04:50:51.000Z
|
APPENDIX_A_EXAMPLES/LINUX_VERSIONS/append_example8/append_example_a8.cpp
|
cp-shen/interactive_computer_graphics
|
786f53d752f7b213b60a5508917e7c7f6e188c6e
|
[
"MIT"
] | 2
|
2016-01-21T16:51:22.000Z
|
2018-12-04T16:02:01.000Z
|
APPENDIX_A_EXAMPLES/LINUX_VERSIONS/append_example8/append_example_a8.cpp
|
cp-shen/interactive_computer_graphics
|
786f53d752f7b213b60a5508917e7c7f6e188c6e
|
[
"MIT"
] | 14
|
2015-12-14T01:10:01.000Z
|
2022-01-25T22:19:55.000Z
|
// rotating cube with texture object
#include "Angel.h"
const int NumTriangles = 12; // (6 faces)(2 triangles/face)
const int NumVertices = 3 * NumTriangles;
const int TextureSize = 64;
typedef Angel::vec4 point4;
typedef Angel::vec4 color4;
// Texture objects and storage for texture image
GLuint textures[2];
GLubyte image[TextureSize][TextureSize][3];
GLubyte image2[TextureSize][TextureSize][3];
// Vertex data arrays
point4 points[NumVertices];
color4 quad_colors[NumVertices];
vec2 tex_coords[NumVertices];
// Array of rotation angles (in degrees) for each coordinate axis
enum { Xaxis = 0, Yaxis = 1, Zaxis = 2, NumAxes = 3 };
int Axis = Xaxis;
GLfloat Theta[NumAxes] = { 0.0, 0.0, 0.0 };
GLuint theta;
//----------------------------------------------------------------------------
int Index = 0;
void
quad( int a, int b, int c, int d )
{
point4 vertices[8] = {
point4( -0.5, -0.5, 0.5, 1.0 ),
point4( -0.5, 0.5, 0.5, 1.0 ),
point4( 0.5, 0.5, 0.5, 1.0 ),
point4( 0.5, -0.5, 0.5, 1.0 ),
point4( -0.5, -0.5, -0.5, 1.0 ),
point4( -0.5, 0.5, -0.5, 1.0 ),
point4( 0.5, 0.5, -0.5, 1.0 ),
point4( 0.5, -0.5, -0.5, 1.0 )
};
color4 colors[8] = {
color4( 0.0, 0.0, 0.0, 1.0 ), // black
color4( 1.0, 0.0, 0.0, 1.0 ), // red
color4( 1.0, 1.0, 0.0, 1.0 ), // yellow
color4( 0.0, 1.0, 0.0, 1.0 ), // green
color4( 0.0, 0.0, 1.0, 1.0 ), // blue
color4( 1.0, 0.0, 1.0, 1.0 ), // magenta
color4( 1.0, 1.0, 1.0, 1.0 ), // white
color4( 1.0, 1.0, 1.0, 1.0 ) // cyan
};
quad_colors[Index] = colors[a];
points[Index] = vertices[a];
tex_coords[Index] = vec2( 0.0, 0.0 );
Index++;
quad_colors[Index] = colors[a];
points[Index] = vertices[b];
tex_coords[Index] = vec2( 0.0, 1.0 );
Index++;
quad_colors[Index] = colors[a];
points[Index] = vertices[c];
tex_coords[Index] = vec2( 1.0, 1.0 );
Index++;
quad_colors[Index] = colors[a];
points[Index] = vertices[a];
tex_coords[Index] = vec2( 0.0, 0.0 );
Index++;
quad_colors[Index] = colors[a];
points[Index] = vertices[c];
tex_coords[Index] = vec2( 1.0, 1.0 );
Index++;
quad_colors[Index] = colors[a];
points[Index] = vertices[d];
tex_coords[Index] = vec2( 1.0, 0.0 );
Index++;
}
//----------------------------------------------------------------------------
void
colorcube()
{
quad( 1, 0, 3, 2 );
quad( 2, 3, 7, 6 );
quad( 3, 0, 4, 7 );
quad( 6, 5, 1, 2 );
quad( 4, 5, 6, 7 );
quad( 5, 4, 0, 1 );
}
//----------------------------------------------------------------------------
void
init()
{
colorcube();
// Create a checkerboard pattern
for ( int i = 0; i < 64; i++ ) {
for ( int j = 0; j < 64; j++ ) {
GLubyte c = (((i & 0x8) == 0) ^ ((j & 0x8) == 0)) * 255;
image[i][j][0] = c;
image[i][j][1] = c;
image[i][j][2] = c;
image2[i][j][0] = c;
image2[i][j][1] = 0;
image2[i][j][2] = c;
}
}
// Initialize texture objects
glGenTextures( 2, textures );
glBindTexture( GL_TEXTURE_2D, textures[0] );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, TextureSize, TextureSize, 0,
GL_RGB, GL_UNSIGNED_BYTE, image );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glBindTexture( GL_TEXTURE_2D, textures[1] );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, TextureSize, TextureSize, 0,
GL_RGB, GL_UNSIGNED_BYTE, image2 );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, textures[0] );
// Create a vertex array object
GLuint vao;
glGenVertexArraysAPPLE( 1, &vao );
glBindVertexArrayAPPLE( vao );
// Create and initialize a buffer object
GLuint buffer;
glGenBuffers( 1, &buffer );
glBindBuffer( GL_ARRAY_BUFFER, buffer );
glBufferData( GL_ARRAY_BUFFER,
sizeof(points) + sizeof(quad_colors) + sizeof(tex_coords),
NULL, GL_STATIC_DRAW );
// Specify an offset to keep track of where we're placing data in our
// vertex array buffer. We'll use the same technique when we
// associate the offsets with vertex attribute pointers.
GLintptr offset = 0;
glBufferSubData( GL_ARRAY_BUFFER, offset, sizeof(points), points );
offset += sizeof(points);
glBufferSubData( GL_ARRAY_BUFFER, offset,
sizeof(quad_colors), quad_colors );
offset += sizeof(quad_colors);
glBufferSubData( GL_ARRAY_BUFFER, offset, sizeof(tex_coords), tex_coords );
// Load shaders and use the resulting shader program
GLuint program = InitShader( "vshader_a8.glsl", "fshader_a8.glsl" );
glUseProgram( program );
// set up vertex arrays
offset = 0;
GLuint vPosition = glGetAttribLocation( program, "vPosition" );
glEnableVertexAttribArray( vPosition );
glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(offset) );
offset += sizeof(points);
GLuint vColor = glGetAttribLocation( program, "vColor" );
glEnableVertexAttribArray( vColor );
glVertexAttribPointer( vColor, 4, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(offset) );
offset += sizeof(quad_colors);
GLuint vTexCoord = glGetAttribLocation( program, "vTexCoord" );
glEnableVertexAttribArray( vTexCoord );
glVertexAttribPointer( vTexCoord, 2, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(offset) );
// Set the value of the fragment shader texture sampler variable
// ("texture") to the the appropriate texture unit. In this case,
// zero, for GL_TEXTURE0 which was previously set by calling
// glActiveTexture().
glUniform1i( glGetUniformLocation(program, "texture"), 0 );
theta = glGetUniformLocation( program, "theta" );
glEnable( GL_DEPTH_TEST );
glClearColor( 1.0, 1.0, 1.0, 1.0 );
}
void
display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glUniform3fv( theta, 1, Theta );
glDrawArrays( GL_TRIANGLES, 0, NumVertices );
glutSwapBuffers();
}
//----------------------------------------------------------------------------
void
mouse( int button, int state, int x, int y )
{
if ( state == GLUT_DOWN ) {
switch( button ) {
case GLUT_LEFT_BUTTON: Axis = Xaxis; break;
case GLUT_MIDDLE_BUTTON: Axis = Yaxis; break;
case GLUT_RIGHT_BUTTON: Axis = Zaxis; break;
}
}
}
//----------------------------------------------------------------------------
void
idle( void )
{
Theta[Axis] += 0.01;
if ( Theta[Axis] > 360.0 ) {
Theta[Axis] -= 360.0;
}
glutPostRedisplay();
}
//----------------------------------------------------------------------------
void
keyboard( unsigned char key, int mousex, int mousey )
{
switch( key ) {
case 033: // Escape Key
case 'q': case 'Q':
exit( EXIT_SUCCESS );
break;
case '1':
glBindTexture( GL_TEXTURE_2D, textures[0] );
break;
case '2':
glBindTexture( GL_TEXTURE_2D, textures[1] );
break;
}
glutPostRedisplay();
}
//----------------------------------------------------------------------------
int
main( int argc, char **argv )
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );
glutInitWindowSize( 512, 512 );
glutCreateWindow( "Color Cube" );
init();
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
glutMouseFunc( mouse );
glutIdleFunc( idle );
glutMainLoop();
return 0;
}
| 28.118467
| 79
| 0.576084
|
cp-shen
|
78ba49fb5527bde70419b9a25b5327acf2c9bff9
| 2,296
|
cpp
|
C++
|
src/Geno/C++/GUI/Modals/DiscordRPCSettingsModal.cpp
|
Starkshat/Geno
|
64e52e802eda97c48d90080b774bd51b4d873321
|
[
"Zlib"
] | 33
|
2021-06-14T15:40:38.000Z
|
2022-03-16T01:23:40.000Z
|
src/Geno/C++/GUI/Modals/DiscordRPCSettingsModal.cpp
|
Starkshat/Geno
|
64e52e802eda97c48d90080b774bd51b4d873321
|
[
"Zlib"
] | 9
|
2021-06-18T13:15:05.000Z
|
2022-01-05T11:48:28.000Z
|
src/Geno/C++/GUI/Modals/DiscordRPCSettingsModal.cpp
|
Starkshat/Geno
|
64e52e802eda97c48d90080b774bd51b4d873321
|
[
"Zlib"
] | 11
|
2021-06-14T17:01:00.000Z
|
2022-03-16T01:44:42.000Z
|
/*
* Copyright (c) 2021 Sebastian Kylander https://gaztin.com/
*
* This software is provided 'as-is', without any express or implied warranty. In no event will
* the authors be held liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose, including commercial
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not claim that you wrote the
* original software. If you use this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
* being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include "DiscordRPCSettingsModal.h"
#include "Discord/DiscordRPC.h"
//////////////////////////////////////////////////////////////////////////
std::string DiscordRPCSettingsModal::PopupID( void )
{
return "EXT_DISCORD_RPC_MODAL";
} // PopupID
//////////////////////////////////////////////////////////////////////////
std::string DiscordRPCSettingsModal::Title( void )
{
return "Discord RPC Settings";
} // Title
//////////////////////////////////////////////////////////////////////////
void DiscordRPCSettingsModal::UpdateDerived( void )
{
ImGui::Text( "Show File Name" ); ImGui::SameLine(); ImGui::Checkbox( "##gd-ext-file", &DiscordRPC::Instance().m_Settings.ShowFilename );
ImGui::Text( "Show Workspace Name" ); ImGui::SameLine(); ImGui::Checkbox( "##gd-ext-wks", &DiscordRPC::Instance().m_Settings.ShowWrksName );
ImGui::Text( "Show Time" ); ImGui::SameLine(); ImGui::Checkbox( "##gd-ext-time", &DiscordRPC::Instance().m_Settings.ShowTime );
ImGui::Text( "Show" ); ImGui::SameLine(); ImGui::Checkbox( "##gd-ext-show", &DiscordRPC::Instance().m_Settings.Show );
if( ImGui::Button( "Close" ) )
Close();
} // UpdateDerived
//////////////////////////////////////////////////////////////////////////
void DiscordRPCSettingsModal::Show( void )
{
if( Open() )
ImGui::SetWindowSize( ImVec2( 365, 189 ) );
} // Show
| 38.266667
| 143
| 0.618031
|
Starkshat
|
78bb3a501f7728c1ffc728dc987ac5a91a28865f
| 261
|
cpp
|
C++
|
ABC/ABC051/A.cpp
|
rajyan/AtCoder
|
2c1187994016d4c19b95489d2f2d2c0eab43dd8e
|
[
"MIT"
] | 1
|
2021-06-01T17:13:44.000Z
|
2021-06-01T17:13:44.000Z
|
ABC/ABC051/A.cpp
|
rajyan/AtCoder
|
2c1187994016d4c19b95489d2f2d2c0eab43dd8e
|
[
"MIT"
] | null | null | null |
ABC/ABC051/A.cpp
|
rajyan/AtCoder
|
2c1187994016d4c19b95489d2f2d2c0eab43dd8e
|
[
"MIT"
] | null | null | null |
//#include <iostream>
//#include <sstream>
//#include <vector>
//
//using namespace std;
//
//int main() {
//
// stringstream ss;
// string tmp;
//
// cin >> tmp;
//
// ss.str(tmp);
//
// while (getline(ss, tmp, ',')) cout << tmp << " ";
//
// return 0;
//
//}
| 13.05
| 52
| 0.51341
|
rajyan
|
78be2e2a5497984a90ff54d16a9d800c0b12bb50
| 5,165
|
cpp
|
C++
|
Real-Time Corruptor/BizHawk_RTC/psx/octoshock/cdrom/recover-raw.cpp
|
redscientistlabs/Bizhawk50X-Vanguard
|
96e0f5f87671a1230784c8faf935fe70baadfe48
|
[
"MIT"
] | 1,414
|
2015-06-28T09:57:51.000Z
|
2021-10-14T03:51:10.000Z
|
Real-Time Corruptor/BizHawk_RTC/psx/octoshock/cdrom/recover-raw.cpp
|
redscientistlabs/Bizhawk50X-Vanguard
|
96e0f5f87671a1230784c8faf935fe70baadfe48
|
[
"MIT"
] | 2,369
|
2015-06-25T01:45:44.000Z
|
2021-10-16T08:44:18.000Z
|
Real-Time Corruptor/BizHawk_RTC/psx/octoshock/cdrom/recover-raw.cpp
|
redscientistlabs/Bizhawk50X-Vanguard
|
96e0f5f87671a1230784c8faf935fe70baadfe48
|
[
"MIT"
] | 430
|
2015-06-29T04:28:58.000Z
|
2021-10-05T18:24:17.000Z
|
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2007 Carsten Gnoerlich.
* Project home page: http://www.dvdisaster.com
* Email: carsten@dvdisaster.com -or- cgnoerlich@fsfe.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,
* or direct your browser at http://www.gnu.org.
*/
#include "dvdisaster.h"
static GaloisTables *gt = NULL; /* for L-EC Reed-Solomon */
static ReedSolomonTables *rt = NULL;
bool Init_LEC_Correct(void)
{
gt = CreateGaloisTables(0x11d);
rt = CreateReedSolomonTables(gt, 0, 1, 10);
return(1);
}
void Kill_LEC_Correct(void)
{
FreeGaloisTables(gt);
FreeReedSolomonTables(rt);
}
/***
*** CD level CRC calculation
***/
/*
* Test raw sector against its 32bit CRC.
* Returns TRUE if frame is good.
*/
int CheckEDC(const unsigned char *cd_frame, bool xa_mode)
{
unsigned int expected_crc, real_crc;
unsigned int crc_base = xa_mode ? 2072 : 2064;
expected_crc = cd_frame[crc_base + 0] << 0;
expected_crc |= cd_frame[crc_base + 1] << 8;
expected_crc |= cd_frame[crc_base + 2] << 16;
expected_crc |= cd_frame[crc_base + 3] << 24;
if(xa_mode)
real_crc = EDCCrc32(cd_frame+16, 2056);
else
real_crc = EDCCrc32(cd_frame, 2064);
if(expected_crc == real_crc)
return(1);
else
{
//printf("Bad EDC CRC: Calculated: %08x, Recorded: %08x\n", real_crc, expected_crc);
return(0);
}
}
/***
*** A very simple L-EC error correction.
***
* Perform just one pass over the Q and P vectors to see if everything
* is okay respectively correct minor errors. This is pretty much the
* same stuff the drive is supposed to do in the final L-EC stage.
*/
static int simple_lec(unsigned char *frame)
{
unsigned char byte_state[2352];
unsigned char p_vector[P_VECTOR_SIZE];
unsigned char q_vector[Q_VECTOR_SIZE];
unsigned char p_state[P_VECTOR_SIZE];
int erasures[Q_VECTOR_SIZE], erasure_count;
int ignore[2];
int p_failures, q_failures;
int p_corrected, q_corrected;
int p,q;
/* Setup */
memset(byte_state, 0, 2352);
p_failures = q_failures = 0;
p_corrected = q_corrected = 0;
/* Perform Q-Parity error correction */
for(q=0; q<N_Q_VECTORS; q++)
{ int err;
/* We have no erasure information for Q vectors */
GetQVector(frame, q_vector, q);
err = DecodePQ(rt, q_vector, Q_PADDING, ignore, 0);
/* See what we've got */
if(err < 0) /* Uncorrectable. Mark bytes are erasure. */
{ q_failures++;
FillQVector(byte_state, 1, q);
}
else /* Correctable */
{ if(err == 1 || err == 2) /* Store back corrected vector */
{ SetQVector(frame, q_vector, q);
q_corrected++;
}
}
}
/* Perform P-Parity error correction */
for(p=0; p<N_P_VECTORS; p++)
{ int err,i;
/* Try error correction without erasure information */
GetPVector(frame, p_vector, p);
err = DecodePQ(rt, p_vector, P_PADDING, ignore, 0);
/* If unsuccessful, try again using erasures.
Erasure information is uncertain, so try this last. */
if(err < 0 || err > 2)
{ GetPVector(byte_state, p_state, p);
erasure_count = 0;
for(i=0; i<P_VECTOR_SIZE; i++)
if(p_state[i])
erasures[erasure_count++] = i;
if(erasure_count > 0 && erasure_count <= 2)
{ GetPVector(frame, p_vector, p);
err = DecodePQ(rt, p_vector, P_PADDING, erasures, erasure_count);
}
}
/* See what we've got */
if(err < 0) /* Uncorrectable. */
{ p_failures++;
}
else /* Correctable. */
{ if(err == 1 || err == 2) /* Store back corrected vector */
{ SetPVector(frame, p_vector, p);
p_corrected++;
}
}
}
/* Sum up */
if(q_failures || p_failures || q_corrected || p_corrected)
{
return 1;
}
return 0;
}
/***
*** Validate CD raw sector
***/
int ValidateRawSector(unsigned char *frame, bool xaMode)
{
int lec_did_sth = FALSE_0;
/* Do simple L-EC.
It seems that drives stop their internal L-EC as soon as the
EDC is okay, so we may see uncorrected errors in the parity bytes.
Since we are also interested in the user data only and doing the
L-EC is expensive, we skip our L-EC as well when the EDC is fine. */
if(!CheckEDC(frame, xaMode))
{
lec_did_sth = simple_lec(frame);
}
/* Test internal sector checksum again */
if(!CheckEDC(frame, xaMode))
{
/* EDC failure in RAW sector */
return FALSE_0;
}
return TRUE_1;
}
| 25.318627
| 90
| 0.652469
|
redscientistlabs
|
78be585c4c5873cbcf8cd10f9407e9a837dbb30c
| 5,082
|
cc
|
C++
|
src/compiler/typecheck/capability_predicate.cc
|
lbk2kgithub1/verona
|
5be07d3b71e5a4fa8da1493cf4c6248d75642f85
|
[
"MIT"
] | 1
|
2020-01-21T05:04:26.000Z
|
2020-01-21T05:04:26.000Z
|
src/compiler/typecheck/capability_predicate.cc
|
lbk2kgithub1/verona
|
5be07d3b71e5a4fa8da1493cf4c6248d75642f85
|
[
"MIT"
] | null | null | null |
src/compiler/typecheck/capability_predicate.cc
|
lbk2kgithub1/verona
|
5be07d3b71e5a4fa8da1493cf4c6248d75642f85
|
[
"MIT"
] | null | null | null |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "compiler/typecheck/capability_predicate.h"
#include "compiler/printing.h"
#include <fmt/ostream.h>
namespace verona::compiler
{
PredicateSet::PredicateSet(CapabilityPredicate predicate)
: values_(static_cast<underlying_type>(predicate))
{}
PredicateSet::PredicateSet(underlying_type values) : values_(values) {}
PredicateSet PredicateSet::empty()
{
return PredicateSet(0);
}
PredicateSet PredicateSet::all()
{
return CapabilityPredicate::Readable | CapabilityPredicate::Writable |
CapabilityPredicate::NonWritable | CapabilityPredicate::NonLinear |
CapabilityPredicate::Sendable;
}
bool PredicateSet::contains(CapabilityPredicate predicate) const
{
return (values_ & static_cast<underlying_type>(predicate)) != 0;
}
PredicateSet PredicateSet::operator|(PredicateSet other) const
{
return PredicateSet(values_ | other.values_);
}
PredicateSet PredicateSet::operator&(PredicateSet other) const
{
return PredicateSet(values_ & other.values_);
}
PredicateSet operator|(CapabilityPredicate lhs, CapabilityPredicate rhs)
{
return PredicateSet(lhs) | PredicateSet(rhs);
}
struct CapabilityPredicateVisitor : public TypeVisitor<PredicateSet>
{
PredicateSet visit_base_type(const TypePtr& type) final
{
return PredicateSet::empty();
}
PredicateSet visit_capability(const CapabilityTypePtr& type) final
{
switch (type->kind)
{
case CapabilityKind::Isolated:
if (std::holds_alternative<RegionNone>(type->region))
{
return CapabilityPredicate::Readable |
CapabilityPredicate::Writable | CapabilityPredicate::Sendable;
}
else
{
return CapabilityPredicate::Readable |
CapabilityPredicate::Writable | CapabilityPredicate::NonLinear;
}
case CapabilityKind::Mutable:
return CapabilityPredicate::Readable | CapabilityPredicate::Writable |
CapabilityPredicate::NonLinear;
case CapabilityKind::Subregion:
return CapabilityPredicate::Readable | CapabilityPredicate::Writable |
CapabilityPredicate::NonLinear;
case CapabilityKind::Immutable:
return CapabilityPredicate::Readable |
CapabilityPredicate::NonWritable | CapabilityPredicate::Sendable |
CapabilityPredicate::NonLinear;
EXHAUSTIVE_SWITCH;
}
}
/**
* Visits each member of elements and merges the results using the given
* BinaryOp.
*/
template<typename BinaryOp>
PredicateSet combine_elements(
const TypeSet& elements, PredicateSet initial, BinaryOp combine)
{
// std::transform_reduce isn't available yet in libstdc++7 :(
PredicateSet result = initial;
for (const auto& elem : elements)
{
result = combine(result, visit_type(elem));
}
return result;
}
PredicateSet visit_static_type(const StaticTypePtr& type) final
{
return CapabilityPredicate::Sendable | CapabilityPredicate::NonLinear;
}
PredicateSet visit_string_type(const StringTypePtr& type) final
{
return CapabilityPredicate::Sendable | CapabilityPredicate::NonLinear;
}
PredicateSet visit_union(const UnionTypePtr& type) final
{
return combine_elements(
type->elements, PredicateSet::all(), std::bit_and<PredicateSet>());
}
PredicateSet visit_intersection(const IntersectionTypePtr& type) final
{
return combine_elements(
type->elements, PredicateSet::empty(), std::bit_or<PredicateSet>());
}
PredicateSet
visit_variable_renaming_type(const VariableRenamingTypePtr& type) final
{
return visit_type(type->type);
}
PredicateSet
visit_path_compression_type(const PathCompressionTypePtr& type) final
{
return visit_type(type->type);
}
PredicateSet visit_fixpoint_type(const FixpointTypePtr& type) final
{
return visit_type(type->inner);
}
PredicateSet
visit_fixpoint_variable_type(const FixpointVariableTypePtr& type) final
{
return PredicateSet::all();
}
};
PredicateSet predicates_for_type(TypePtr type)
{
// This is pretty cheap, but it's likely we'll be doing it a lot in the
// future. We might want to cache results.
return CapabilityPredicateVisitor().visit_type(type);
}
std::ostream& operator<<(std::ostream& out, CapabilityPredicate predicate)
{
switch (predicate)
{
case CapabilityPredicate::Readable:
return out << "readable";
case CapabilityPredicate::Writable:
return out << "writable";
case CapabilityPredicate::NonWritable:
return out << "non-writable";
case CapabilityPredicate::Sendable:
return out << "sendable";
case CapabilityPredicate::NonLinear:
return out << "non-linear";
EXHAUSTIVE_SWITCH;
}
}
}
| 29.375723
| 80
| 0.684179
|
lbk2kgithub1
|
78bf20c265bb89e9eeabe2c3147a211d1c6ec48a
| 719
|
hpp
|
C++
|
irohad/ametsuchi/os_persistent_state_factory.hpp
|
coderintherye/iroha
|
68509282851130c9818f21acef1ef28e53622315
|
[
"Apache-2.0"
] | null | null | null |
irohad/ametsuchi/os_persistent_state_factory.hpp
|
coderintherye/iroha
|
68509282851130c9818f21acef1ef28e53622315
|
[
"Apache-2.0"
] | null | null | null |
irohad/ametsuchi/os_persistent_state_factory.hpp
|
coderintherye/iroha
|
68509282851130c9818f21acef1ef28e53622315
|
[
"Apache-2.0"
] | null | null | null |
/**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef IROHA_OS_PERSISTENT_STATE_FACTORY_HPP
#define IROHA_OS_PERSISTENT_STATE_FACTORY_HPP
#include <memory>
#include "ametsuchi/ordering_service_persistent_state.hpp"
namespace iroha {
namespace ametsuchi {
class OsPersistentStateFactory {
public:
/**
* @return ordering service persistent state
*/
virtual boost::optional<std::shared_ptr<OrderingServicePersistentState>>
createOsPersistentState() const = 0;
virtual ~OsPersistentStateFactory() = default;
};
} // namespace ametsuchi
} // namespace iroha
#endif // IROHA_OS_PERSISTENT_STATE_FACTORY_HPP
| 25.678571
| 78
| 0.732962
|
coderintherye
|
78bf5064764a470dd8f59faa4da3faf9f61339b6
| 2,418
|
cpp
|
C++
|
EvtGen1_06_00/src/EvtGenBase/EvtStringParticle.cpp
|
klendathu2k/StarGenerator
|
7dd407c41d4eea059ca96ded80d30bda0bc014a4
|
[
"MIT"
] | 2
|
2018-12-24T19:37:00.000Z
|
2022-02-28T06:57:20.000Z
|
EvtGen1_06_00/src/EvtGenBase/EvtStringParticle.cpp
|
klendathu2k/StarGenerator
|
7dd407c41d4eea059ca96ded80d30bda0bc014a4
|
[
"MIT"
] | null | null | null |
EvtGen1_06_00/src/EvtGenBase/EvtStringParticle.cpp
|
klendathu2k/StarGenerator
|
7dd407c41d4eea059ca96ded80d30bda0bc014a4
|
[
"MIT"
] | null | null | null |
//--------------------------------------------------------------------------
//
// Environment:
// This software is part of the EvtGen package developed jointly
// for the BaBar and CLEO collaborations. If you use all or part
// of it, please give an appropriate acknowledgement.
//
// Copyright Information: See EvtGen/COPYRIGHT
// Copyright (C) 1998 Caltech, UCSB
//
// Module: EvtStringParticle.cc
//
// Description: Class to describe the partons that are produced in JetSet.
//
// Modification history:
//
// RYD Febuary 27,1998 Module created
//
//------------------------------------------------------------------------
//
#include "EvtGenBase/EvtPatches.hh"
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include "EvtGenBase/EvtStringParticle.hh"
#include "EvtGenBase/EvtVector4R.hh"
#include "EvtGenBase/EvtReport.hh"
EvtStringParticle::~EvtStringParticle(){
if (_npartons!=0){
delete [] _p4partons;
delete [] _idpartons;
}
}
EvtStringParticle::EvtStringParticle(){
_p4partons=0;
_idpartons=0;
_npartons=0;
return;
}
void EvtStringParticle::init(EvtId id, const EvtVector4R& p4){
_validP4=true;
setp(p4);
setpart_num(id);
}
void EvtStringParticle::initPartons(int npartons,
EvtVector4R* p4partons,EvtId* idpartons){
_p4partons = new EvtVector4R[npartons];
_idpartons = new EvtId[npartons];
int i;
_npartons=npartons;
for(i=0;i<npartons;i++){
_p4partons[i]=p4partons[i];
_idpartons[i]=idpartons[i];
}
}
int EvtStringParticle::getNPartons(){
return _npartons;
}
EvtId EvtStringParticle::getIdParton(int i){
return _idpartons[i];
}
EvtVector4R EvtStringParticle::getP4Parton(int i){
return _p4partons[i];
}
EvtSpinDensity EvtStringParticle::rotateToHelicityBasis() const{
EvtGenReport(EVTGEN_ERROR,"EvtGen") << "rotateToHelicityBasis not implemented for strin particle.";
EvtGenReport(EVTGEN_ERROR,"EvtGen") << "Will terminate execution.";
::abort();
EvtSpinDensity rho;
return rho;
}
EvtSpinDensity EvtStringParticle::rotateToHelicityBasis(double,
double,
double) const{
EvtGenReport(EVTGEN_ERROR,"EvtGen") << "rotateToHelicityBasis(alpha,beta,gamma) not implemented for string particle.";
EvtGenReport(EVTGEN_ERROR,"EvtGen") << "Will terminate execution.";
::abort();
EvtSpinDensity rho;
return rho;
}
| 19.344
| 121
| 0.658395
|
klendathu2k
|
78c00353f51ac86580d30cf317101e96ae3914bb
| 281
|
cpp
|
C++
|
YorozuyaGSLib/source/_character_disconnect_result_wrac.cpp
|
lemkova/Yorozuya
|
f445d800078d9aba5de28f122cedfa03f26a38e4
|
[
"MIT"
] | 29
|
2017-07-01T23:08:31.000Z
|
2022-02-19T10:22:45.000Z
|
YorozuyaGSLib/source/_character_disconnect_result_wrac.cpp
|
kotopes/Yorozuya
|
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
|
[
"MIT"
] | 90
|
2017-10-18T21:24:51.000Z
|
2019-06-06T02:30:33.000Z
|
YorozuyaGSLib/source/_character_disconnect_result_wrac.cpp
|
kotopes/Yorozuya
|
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
|
[
"MIT"
] | 44
|
2017-12-19T08:02:59.000Z
|
2022-02-24T23:15:01.000Z
|
#include <_character_disconnect_result_wrac.hpp>
START_ATF_NAMESPACE
int _character_disconnect_result_wrac::size()
{
using org_ptr = int (WINAPIV*)(struct _character_disconnect_result_wrac*);
return (org_ptr(0x1401d24e0L))(this);
};
END_ATF_NAMESPACE
| 25.545455
| 82
| 0.743772
|
lemkova
|
78c398cbed79a4a3b5c940505645a9000c83495e
| 464
|
hpp
|
C++
|
native/shared/path_creator.hpp
|
Utsav2/battle-bots
|
d3c35f03d81bc38bdeb850ecb2c999794771e5d9
|
[
"MIT"
] | null | null | null |
native/shared/path_creator.hpp
|
Utsav2/battle-bots
|
d3c35f03d81bc38bdeb850ecb2c999794771e5d9
|
[
"MIT"
] | null | null | null |
native/shared/path_creator.hpp
|
Utsav2/battle-bots
|
d3c35f03d81bc38bdeb850ecb2c999794771e5d9
|
[
"MIT"
] | null | null | null |
#ifndef PATH_H
#define PATH_H
#include <vector>
#include <map>
#include "coordinate.hpp"
class Path
{
private:
std::vector<Coordinate> coords;
public:
Path(std::vector<Coordinate> coords);
Path(int, int);
void add_coords(int x, int y);
void add_coords(Coordinate coord);
size_t size();
bool in(int x, int y);
bool in(Coordinate coord);
Coordinate get_coordinate(int index);
};
#include "path_creator.cpp"
#endif
| 19.333333
| 45
| 0.663793
|
Utsav2
|
78c5f944369980e1bd875d83fb1f0edc137e6204
| 57,177
|
cpp
|
C++
|
media/mm-video/qdsp6/vdec/src/H264_Utils.cpp
|
Zuli/device_sony_lt28
|
216082da1732986ca5218e9ac1c33c758334f64e
|
[
"Apache-2.0"
] | null | null | null |
media/mm-video/qdsp6/vdec/src/H264_Utils.cpp
|
Zuli/device_sony_lt28
|
216082da1732986ca5218e9ac1c33c758334f64e
|
[
"Apache-2.0"
] | null | null | null |
media/mm-video/qdsp6/vdec/src/H264_Utils.cpp
|
Zuli/device_sony_lt28
|
216082da1732986ca5218e9ac1c33c758334f64e
|
[
"Apache-2.0"
] | null | null | null |
/*--------------------------------------------------------------------------
Copyright (c) 2009, Code Aurora Forum. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Code Aurora nor
the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------*/
/*========================================================================
O p e n M M
V i d e o U t i l i t i e s
*//** @file H264_Utils.cpp
This module contains utilities and helper routines.
@par EXTERNALIZED FUNCTIONS
@par INITIALIZATION AND SEQUENCING REQUIREMENTS
(none)
*//*====================================================================== */
/* =======================================================================
INCLUDE FILES FOR MODULE
========================================================================== */
#include "H264_Utils.h"
#include "omx_vdec.h"
#include <string.h>
#include <stdlib.h>
#ifdef _ANDROID_
#include "cutils/properties.h"
#endif
#include "qtv_msg.h"
/* =======================================================================
DEFINITIONS AND DECLARATIONS FOR MODULE
This section contains definitions for constants, macros, types, variables
and other items needed by this module.
========================================================================== */
#define SIZE_NAL_FIELD_MAX 4
#define BASELINE_PROFILE 66
#define MAIN_PROFILE 77
#define HIGH_PROFILE 100
#define MAX_SUPPORTED_LEVEL 32
RbspParser::RbspParser(const uint8 * _begin, const uint8 * _end)
:begin(_begin), end(_end), pos(-1), bit(0),
cursor(0xFFFFFF), advanceNeeded(true)
{
}
// Destructor
/*lint -e{1540} Pointer member neither freed nor zeroed by destructor
* No problem
*/
RbspParser::~RbspParser()
{
}
// Return next RBSP byte as a word
uint32 RbspParser::next()
{
if (advanceNeeded)
advance();
//return static_cast<uint32> (*pos);
return static_cast < uint32 > (begin[pos]);
}
// Advance RBSP decoder to next byte
void RbspParser::advance()
{
++pos;
//if (pos >= stop)
if (begin + pos == end) {
/*lint -e{730} Boolean argument to function
* I don't see a problem here
*/
//throw false;
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->NEED TO THROW THE EXCEPTION...\n");
}
cursor <<= 8;
//cursor |= static_cast<uint32> (*pos);
cursor |= static_cast < uint32 > (begin[pos]);
if ((cursor & 0xFFFFFF) == 0x000003) {
advance();
}
advanceNeeded = false;
}
// Decode unsigned integer
uint32 RbspParser::u(uint32 n)
{
uint32 i, s, x = 0;
for (i = 0; i < n; i += s) {
s = static_cast < uint32 > STD_MIN(static_cast < int >(8 - bit),
static_cast < int >(n - i));
x <<= s;
x |= ((next() >> ((8 - static_cast < uint32 > (bit)) - s)) &
((1 << s) - 1));
bit = (bit + s) % 8;
if (!bit) {
advanceNeeded = true;
}
}
return x;
}
// Decode unsigned integer Exp-Golomb-coded syntax element
uint32 RbspParser::ue()
{
int leadingZeroBits = -1;
for (uint32 b = 0; !b; ++leadingZeroBits) {
b = u(1);
}
return ((1 << leadingZeroBits) - 1) +
u(static_cast < uint32 > (leadingZeroBits));
}
// Decode signed integer Exp-Golomb-coded syntax element
int32 RbspParser::se()
{
const uint32 x = ue();
if (!x)
return 0;
else if (x & 1)
return static_cast < int32 > ((x >> 1) + 1);
else
return -static_cast < int32 > (x >> 1);
}
void H264_Utils::allocate_rbsp_buffer(uint32 inputBufferSize)
{
m_rbspBytes = (byte *) malloc(inputBufferSize);
m_prv_nalu.nal_ref_idc = 0;
m_prv_nalu.nalu_type = NALU_TYPE_UNSPECIFIED;
}
H264_Utils::H264_Utils():m_height(0), m_width(0), m_rbspBytes(NULL),
m_default_profile_chk(true), m_default_level_chk(true)
{
#ifdef _ANDROID_
char property_value[PROPERTY_VALUE_MAX] = {0};
if(0 != property_get("persist.omxvideo.profilecheck", property_value, NULL))
{
if(!strcmp(property_value, "false"))
{
m_default_profile_chk = false;
}
}
else
{
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED, "H264_Utils:: Constr failed in \
getting value for the Android property [persist.omxvideo.profilecheck]");
}
if(0 != property_get("persist.omxvideo.levelcheck", property_value, NULL))
{
if(!strcmp(property_value, "false"))
{
m_default_level_chk = false;
}
}
else
{
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED, "H264_Utils:: Constr failed in \
getting value for the Android property [persist.omxvideo.levelcheck]");
}
#endif
initialize_frame_checking_environment();
}
H264_Utils::~H264_Utils()
{
/* if(m_pbits)
{
delete(m_pbits);
m_pbits = NULL;
}
*/
if (m_rbspBytes) {
free(m_rbspBytes);
m_rbspBytes = NULL;
}
}
/***********************************************************************/
/*
FUNCTION:
H264_Utils::initialize_frame_checking_environment
DESCRIPTION:
Extract RBSP data from a NAL
INPUT/OUTPUT PARAMETERS:
None
RETURN VALUE:
boolean
SIDE EFFECTS:
None.
*/
/***********************************************************************/
void H264_Utils::initialize_frame_checking_environment()
{
m_forceToStichNextNAL = false;
}
/***********************************************************************/
/*
FUNCTION:
H264_Utils::extract_rbsp
DESCRIPTION:
Extract RBSP data from a NAL
INPUT/OUTPUT PARAMETERS:
<In>
buffer : buffer containing start code or nal length + NAL units
buffer_length : the length of the NAL buffer
start_code : If true, start code is detected,
otherwise size nal length is detected
size_of_nal_length_field: size of nal length field
<Out>
rbsp_bistream : extracted RBSP bistream
rbsp_length : the length of the RBSP bitstream
nal_unit : decoded NAL header information
RETURN VALUE:
boolean
SIDE EFFECTS:
None.
*/
/***********************************************************************/
boolean H264_Utils::extract_rbsp(OMX_IN OMX_U8 * buffer,
OMX_IN OMX_U32 buffer_length,
OMX_IN OMX_U32 size_of_nal_length_field,
OMX_OUT OMX_U8 * rbsp_bistream,
OMX_OUT OMX_U32 * rbsp_length,
OMX_OUT NALU * nal_unit)
{
byte coef1, coef2, coef3;
uint32 pos = 0;
uint32 nal_len = buffer_length;
uint32 sizeofNalLengthField = 0;
uint32 zero_count;
boolean eRet = true;
boolean start_code = (size_of_nal_length_field == 0) ? true : false;
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED, "extract_rbsp\n");
if (start_code) {
// Search start_code_prefix_one_3bytes (0x000001)
coef2 = buffer[pos++];
coef3 = buffer[pos++];
do {
if (pos >= buffer_length) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_HIGH,
"Error at extract rbsp line %d",
__LINE__);
return false;
}
coef1 = coef2;
coef2 = coef3;
coef3 = buffer[pos++];
} while (coef1 || coef2 || coef3 != 1);
} else if (size_of_nal_length_field) {
/* This is the case to play multiple NAL units inside each access unit */
/* Extract the NAL length depending on sizeOfNALength field */
sizeofNalLengthField = size_of_nal_length_field;
nal_len = 0;
while (size_of_nal_length_field--) {
nal_len |=
buffer[pos++] << (size_of_nal_length_field << 3);
}
if (nal_len >= buffer_length) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"Error at extract rbsp line %d",
__LINE__);
return false;
}
}
if (nal_len > buffer_length) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"Error at extract rbsp line %d", __LINE__);
return false;
}
if (pos + 1 > (nal_len + sizeofNalLengthField)) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"Error at extract rbsp line %d", __LINE__);
return false;
}
if (nal_unit->forbidden_zero_bit = (buffer[pos] & 0x80)) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"Error at extract rbsp line %d", __LINE__);
}
nal_unit->nal_ref_idc = (buffer[pos] & 0x60) >> 5;
nal_unit->nalu_type = buffer[pos++] & 0x1f;
*rbsp_length = 0;
if (nal_unit->nalu_type == NALU_TYPE_EOSEQ ||
nal_unit->nalu_type == NALU_TYPE_EOSTREAM)
return eRet;
zero_count = 0;
while (pos < (nal_len + sizeofNalLengthField)) //similar to for in p-42
{
if (zero_count == 2) {
if (buffer[pos] == 0x03) {
pos++;
zero_count = 0;
continue;
}
if (buffer[pos] <= 0x01) {
if (start_code) {
*rbsp_length -= 2;
pos -= 2;
break;
}
}
zero_count = 0;
}
zero_count++;
if (buffer[pos] != 0)
zero_count = 0;
rbsp_bistream[(*rbsp_length)++] = buffer[pos++];
}
return eRet;
}
/*===========================================================================
FUNCTION:
H264_Utils::iSNewFrame
DESCRIPTION:
Returns true if NAL parsing successfull otherwise false.
INPUT/OUTPUT PARAMETERS:
<In>
buffer : buffer containing start code or nal length + NAL units
buffer_length : the length of the NAL buffer
start_code : If true, start code is detected,
otherwise size nal length is detected
size_of_nal_length_field: size of nal length field
<out>
isNewFrame: true if the NAL belongs to a differenet frame
false if the NAL belongs to a current frame
RETURN VALUE:
boolean true, if nal parsing is successful
false, if the nal parsing has errors
SIDE EFFECTS:
None.
===========================================================================*/
bool H264_Utils::isNewFrame(OMX_IN OMX_U8 * buffer,
OMX_IN OMX_U32 buffer_length,
OMX_IN OMX_U32 size_of_nal_length_field,
OMX_OUT OMX_BOOL & isNewFrame,
bool & isUpdateTimestamp)
{
NALU nal_unit;
uint16 first_mb_in_slice = 0;
uint32 numBytesInRBSP = 0;
bool eRet = true;
isUpdateTimestamp = false;
QTV_MSG_PRIO3(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"get_h264_nal_type %p nal_length %d nal_length_field %d\n",
buffer, buffer_length, size_of_nal_length_field);
if (false ==
extract_rbsp(buffer, buffer_length, size_of_nal_length_field,
m_rbspBytes, &numBytesInRBSP, &nal_unit)) {
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"get_h264_nal_type - ERROR at extract_rbsp\n");
isNewFrame = OMX_FALSE;
eRet = false;
} else {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"Nalu type: %d",nal_unit.nalu_type);
switch (nal_unit.nalu_type) {
case NALU_TYPE_IDR:
case NALU_TYPE_NON_IDR:
{
RbspParser rbsp_parser(m_rbspBytes,
(m_rbspBytes +
numBytesInRBSP));
first_mb_in_slice = rbsp_parser.ue();
if (m_forceToStichNextNAL) {
isNewFrame = OMX_FALSE;
if(!first_mb_in_slice){
isUpdateTimestamp = true;
}
} else {
if ((!first_mb_in_slice) || /*(slice.prv_frame_num != slice.frame_num ) || */
((m_prv_nalu.nal_ref_idc !=
nal_unit.nal_ref_idc)
&& (nal_unit.nal_ref_idc *
m_prv_nalu.nal_ref_idc == 0))
||
/*( ((m_prv_nalu.nalu_type == NALU_TYPE_IDR) && (nal_unit.nalu_type == NALU_TYPE_IDR)) && (slice.idr_pic_id != slice.prv_idr_pic_id) ) || */
((m_prv_nalu.nalu_type !=
nal_unit.nalu_type)
&&
((m_prv_nalu.nalu_type ==
NALU_TYPE_IDR)
|| (nal_unit.nalu_type ==
NALU_TYPE_IDR)))) {
isNewFrame = OMX_TRUE;
} else {
isNewFrame = OMX_FALSE;
}
}
m_forceToStichNextNAL = false;
break;
}
default:
{
isNewFrame =
(m_forceToStichNextNAL ? OMX_FALSE :
OMX_TRUE);
m_forceToStichNextNAL = true;
break;
}
} // end of switch
} // end of if
m_prv_nalu = nal_unit;
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"get_h264_nal_type - newFrame value %d\n", isNewFrame);
return eRet;
}
/**************************************************************************
** This function parses an H.264 Annex B formatted bitstream, returning the
** next frame in the format required by MP4 (specified in ISO/IEC 14496-15,
** section 5.2.3, "AVC Sample Structure Definition"), and recovering any
** header (sequence and picture parameter set NALUs) information, formatting
** it as a header block suitable for writing to video format services.
**
** IN const uint8 *encodedBytes
** This points to the H.264 Annex B formatted video bitstream, starting
** with the next frame for which to locate frame boundaries.
**
** IN uint32 totalBytes
** This is the total number of bytes left in the H.264 video bitstream,
** from the given starting position.
**
** INOUT H264StreamInfo &streamInfo
** This structure contains state information about the stream as it has
** been so far parsed.
**
** OUT vector<uint8> &frame
** The properly MP4 formatted H.264 frame will be stored here.
**
** OUT uint32 &bytesConsumed
** This is set to the total number of bytes parsed from the bitstream.
**
** OUT uint32 &nalSize
** The true size of the NAL (without padding zeroes)
**
** OUT bool &keyFrame
** Indicator whether this is an I-frame
**
** IN bool stripSeiAud
** If set, any SEI or AU delimiter NALUs are stripped out.
*************************************************************************/
bool H264_Utils::parseHeader(uint8 * encodedBytes,
uint32 totalBytes,
uint32 sizeOfNALLengthField,
unsigned &height,
unsigned &width,
bool & bInterlace,
unsigned &cropx,
unsigned &cropy,
unsigned &cropdx, unsigned &cropdy)
{
bool keyFrame = FALSE;
bool stripSeiAud = FALSE;
bool nalSize = FALSE;
uint64 bytesConsumed = 0;
uint8 frame[64];
struct H264ParamNalu temp = { 0 };
// Scan NALUs until a frame boundary is detected. If this is the first
// frame, scan a second time to find the end of the frame. Otherwise, the
// first boundary found is the end of the current frame. While scanning,
// collect any sequence/parameter set NALUs for use in constructing the
// stream header.
bool inFrame = true;
bool inNalu = false;
bool vclNaluFound = false;
uint8 naluType = 0;
uint32 naluStart = 0, naluSize = 0;
uint32 prevVclFrameNum = 0, vclFrameNum = 0;
bool prevVclFieldPicFlag = false, vclFieldPicFlag = false;
bool prevVclBottomFieldFlag = false, vclBottomFieldFlag = false;
uint8 prevVclNalRefIdc = 0, vclNalRefIdc = 0;
uint32 prevVclPicOrderCntLsb = 0, vclPicOrderCntLsb = 0;
int32 prevVclDeltaPicOrderCntBottom = 0, vclDeltaPicOrderCntBottom = 0;
int32 prevVclDeltaPicOrderCnt0 = 0, vclDeltaPicOrderCnt0 = 0;
int32 prevVclDeltaPicOrderCnt1 = 0, vclDeltaPicOrderCnt1 = 0;
uint8 vclNaluType = 0;
uint32 vclPicOrderCntType = 0;
uint64 pos;
uint64 posNalDetected = 0xFFFFFFFF;
uint32 cursor = 0xFFFFFFFF;
unsigned int profile_id = 0, level_id = 0;
H264ParamNalu *seq = NULL, *pic = NULL;
// used to determin possible infinite loop condition
int loopCnt = 0;
for (pos = 0;; ++pos) {
// return early, found possible infinite loop
if (loopCnt > 100000)
return 0;
// Scan ahead next byte.
cursor <<= 8;
cursor |= static_cast < uint32 > (encodedBytes[pos]);
if (sizeOfNALLengthField != 0) {
inNalu = true;
naluStart = sizeOfNALLengthField;
}
// If in NALU, scan forward until an end of NALU condition is
// detected.
if (inNalu) {
if (sizeOfNALLengthField == 0) {
// Detect end of NALU condition.
if (((cursor & 0xFFFFFF) == 0x000000)
|| ((cursor & 0xFFFFFF) == 0x000001)
|| (pos >= totalBytes)) {
inNalu = false;
if (pos < totalBytes) {
pos -= 3;
}
naluSize =
static_cast < uint32 >
((static_cast < uint32 >
(pos) - naluStart) + 1);
QTV_MSG_PRIO3(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->1.nalusize=%x pos=%x naluStart=%x\n",
naluSize, pos, naluStart);
} else {
++loopCnt;
continue;
}
}
// Determine NALU type.
naluType = (encodedBytes[naluStart] & 0x1F);
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->2.naluType=%x....\n",
naluType);
if (naluType == 5)
keyFrame = true;
// For NALUs in the frame having a slice header, parse additional
// fields.
bool isVclNalu = false;
if ((naluType == 1) || (naluType == 2)
|| (naluType == 5)) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->3.naluType=%x....\n",
naluType);
// Parse additional fields.
RbspParser rbsp(&encodedBytes[naluStart + 1],
&encodedBytes[naluStart +
naluSize]);
vclNaluType = naluType;
vclNalRefIdc =
((encodedBytes[naluStart] >> 5) & 0x03);
(void)rbsp.ue();
(void)rbsp.ue();
const uint32 picSetID = rbsp.ue();
pic = this->pic.find(picSetID);
QTV_MSG_PRIO2(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->4.sizeof %x %x\n",
this->pic.size(),
this->seq.size());
if (!pic) {
if (this->pic.empty()) {
// Found VCL NALU before needed picture parameter set
// -- assume that we started parsing mid-frame, and
// discard the rest of the frame we're in.
inFrame = false;
//frame.clear ();
QTV_MSG_PRIO(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->5.pic empty........\n");
} else {
QTV_MSG_PRIO(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->6.FAILURE to parse..break frm here");
break;
}
}
if (pic) {
QTV_MSG_PRIO2(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->7.sizeof %x %x\n",
this->pic.size(),
this->seq.size());
seq = this->seq.find(pic->seqSetID);
if (!seq) {
if (this->seq.empty()) {
QTV_MSG_PRIO
(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->8.seq empty........\n");
// Found VCL NALU before needed sequence parameter
// set -- assume that we started parsing
// mid-frame, and discard the rest of the frame
// we're in.
inFrame = false;
//frame.clear ();
} else {
QTV_MSG_PRIO
(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->9.FAILURE to parse...break");
break;
}
}
}
QTV_MSG_PRIO2(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->10.sizeof %x %x\n",
this->pic.size(),
this->seq.size());
if (pic && seq) {
QTV_MSG_PRIO2(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->11.pic and seq[%x][%x]........\n",
pic, seq);
isVclNalu = true;
vclFrameNum =
rbsp.u(seq->log2MaxFrameNumMinus4 +
4);
if (!seq->frameMbsOnlyFlag) {
vclFieldPicFlag =
(rbsp.u(1) == 1);
if (vclFieldPicFlag) {
vclBottomFieldFlag =
(rbsp.u(1) == 1);
}
} else {
vclFieldPicFlag = false;
vclBottomFieldFlag = false;
}
if (vclNaluType == 5) {
(void)rbsp.ue();
}
vclPicOrderCntType =
seq->picOrderCntType;
if (seq->picOrderCntType == 0) {
vclPicOrderCntLsb = rbsp.u
(seq->
log2MaxPicOrderCntLsbMinus4
+ 4);
if (pic->picOrderPresentFlag
&& !vclFieldPicFlag) {
vclDeltaPicOrderCntBottom
= rbsp.se();
} else {
vclDeltaPicOrderCntBottom
= 0;
}
} else {
vclPicOrderCntLsb = 0;
vclDeltaPicOrderCntBottom = 0;
}
if ((seq->picOrderCntType == 1)
&& !seq->
deltaPicOrderAlwaysZeroFlag) {
vclDeltaPicOrderCnt0 =
rbsp.se();
if (pic->picOrderPresentFlag
&& !vclFieldPicFlag) {
vclDeltaPicOrderCnt1 =
rbsp.se();
} else {
vclDeltaPicOrderCnt1 =
0;
}
} else {
vclDeltaPicOrderCnt0 = 0;
vclDeltaPicOrderCnt1 = 0;
}
}
}
//////////////////////////////////////////////////////////////////
// Perform frame boundary detection.
//////////////////////////////////////////////////////////////////
// The end of the bitstream is always a boundary.
bool boundary = (pos >= totalBytes);
// The first of these NALU types always mark a boundary, but skip
// any that occur before the first VCL NALU in a new frame.
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->12.naluType[%x].....\n",
naluType);
if ((((naluType >= 6) && (naluType <= 9))
|| ((naluType >= 13) && (naluType <= 18)))
&& (vclNaluFound || !inFrame)) {
boundary = true;
}
// If a VCL NALU is found, compare with the last VCL NALU to
// determine if they belong to different frames.
else if (vclNaluFound && isVclNalu) {
// Clause 7.4.1.2.4 -- detect first VCL NALU through
// parsing of portions of the NALU header and slice
// header.
/*lint -e{731} Boolean argument to equal/not equal
* It's ok
*/
if ((prevVclFrameNum != vclFrameNum)
|| (prevVclFieldPicFlag != vclFieldPicFlag)
|| (prevVclBottomFieldFlag !=
vclBottomFieldFlag)
|| ((prevVclNalRefIdc != vclNalRefIdc)
&& ((prevVclNalRefIdc == 0)
|| (vclNalRefIdc == 0)))
|| ((vclPicOrderCntType == 0)
&&
((prevVclPicOrderCntLsb !=
vclPicOrderCntLsb)
|| (prevVclDeltaPicOrderCntBottom !=
vclDeltaPicOrderCntBottom)))
|| ((vclPicOrderCntType == 1)
&& ((prevVclDeltaPicOrderCnt0
!= vclDeltaPicOrderCnt0)
|| (prevVclDeltaPicOrderCnt1
!= vclDeltaPicOrderCnt1)))) {
boundary = true;
}
}
// If a frame boundary is reached and we were in the frame in
// which at least one VCL NALU was found, we are done processing
// this frame. Remember to back up to NALU start code to make
// sure it is available for when the next frame is parsed.
if (boundary && inFrame && vclNaluFound) {
pos = static_cast < uint64 > (naluStart - 3);
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->13.Break \n");
break;
}
inFrame = (inFrame || boundary);
// Process sequence and parameter set NALUs specially.
if ((naluType == 7) || (naluType == 8)) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->14.naluType[%x].....\n",
naluType);
QTV_MSG_PRIO2(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->15.sizeof %x %x\n",
this->pic.size(),
this->seq.size());
H264ParamNaluSet & naluSet =
((naluType == 7) ? this->seq : this->pic);
// Parse parameter set ID and other stream information.
H264ParamNalu newParam;
RbspParser rbsp(&encodedBytes[naluStart + 1],
&encodedBytes[naluStart +
naluSize]);
uint32 id;
if (naluType == 7) {
unsigned int tmp;
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->16.naluType[%x].....\n",
naluType);
profile_id = rbsp.u(8);
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.prfoile[%d].....\n",
profile_id);
tmp = rbsp.u(8);
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.prfoilebytes[%x].....\n",
tmp);
level_id = rbsp.u(8);
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.level[%d].....\n",
level_id);
id = newParam.seqSetID = rbsp.ue();
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.seqID[%d].....\n",
id);
if (profile_id == 100) {
//Chroma_format_idc
tmp = rbsp.ue();
if (tmp == 3) {
//residual_colour_transform_flag
(void)rbsp.u(1);
}
//bit_depth_luma_minus8
(void)rbsp.ue();
//bit_depth_chroma_minus8
(void)rbsp.ue();
//qpprime_y_zero_transform_bypass_flag
(void)rbsp.u(1);
// seq_scaling_matrix_present_flag
tmp = rbsp.u(1);
if (tmp) {
unsigned int tmp1, t;
//seq_scaling_list_present_flag
for (t = 0; t < 6; t++) {
tmp1 =
rbsp.u(1);
if (tmp1) {
unsigned
int
last_scale
=
8,
next_scale
=
8,
delta_scale;
for (int
j =
0;
j <
16;
j++)
{
if (next_scale) {
delta_scale
=
rbsp.
se
();
next_scale
=
(last_scale
+
delta_scale
+
256)
%
256;
}
last_scale
=
next_scale
?
next_scale
:
last_scale;
}
}
}
for (t = 0; t < 2; t++) {
tmp1 =
rbsp.u(1);
if (tmp1) {
unsigned
int
last_scale
=
8,
next_scale
=
8,
delta_scale;
for (int
j =
0;
j <
64;
j++)
{
if (next_scale) {
delta_scale
=
rbsp.
se
();
next_scale
=
(last_scale
+
delta_scale
+
256)
%
256;
}
last_scale
=
next_scale
?
next_scale
:
last_scale;
}
}
}
}
}
newParam.log2MaxFrameNumMinus4 =
rbsp.ue();
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.log2MaxFrameNumMinu[%d].....\n",
newParam.
log2MaxFrameNumMinus4);
newParam.picOrderCntType = rbsp.ue();
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.picOrderCntType[%d].....\n",
newParam.picOrderCntType);
if (newParam.picOrderCntType == 0) {
newParam.
log2MaxPicOrderCntLsbMinus4
= rbsp.ue();
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.log2MaxPicOrderCntLsbMinus4 [%d].....\n",
newParam.
log2MaxPicOrderCntLsbMinus4);
} else if (newParam.picOrderCntType ==
1) {
newParam.
deltaPicOrderAlwaysZeroFlag
= (rbsp.u(1) == 1);
(void)rbsp.se();
(void)rbsp.se();
const uint32
numRefFramesInPicOrderCntCycle
= rbsp.ue();
for (uint32 i = 0;
i <
numRefFramesInPicOrderCntCycle;
++i) {
(void)rbsp.se();
}
}
tmp = rbsp.ue();
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.numrefFrames[%d].....\n",
tmp);
tmp = rbsp.u(1);
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.gapsflag[%x].....\n",
tmp);
newParam.picWidthInMbsMinus1 =
rbsp.ue();
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.picWidthInMbsMinus1[%d].....\n",
newParam.
picWidthInMbsMinus1);
newParam.picHeightInMapUnitsMinus1 =
rbsp.ue();
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->33.gapsflag[%d].....\n",
newParam.
picHeightInMapUnitsMinus1);
newParam.frameMbsOnlyFlag =
(rbsp.u(1) == 1);
if (!newParam.frameMbsOnlyFlag)
(void)rbsp.u(1);
(void)rbsp.u(1);
tmp = rbsp.u(1);
newParam.crop_left = 0;
newParam.crop_right = 0;
newParam.crop_top = 0;
newParam.crop_bot = 0;
if (tmp) {
newParam.crop_left = rbsp.ue();
newParam.crop_right = rbsp.ue();
newParam.crop_top = rbsp.ue();
newParam.crop_bot = rbsp.ue();
}
QTV_MSG_PRIO4(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser--->34 crop left %d, right %d, top %d, bot %d\n",
newParam.crop_left,
newParam.crop_right,
newParam.crop_top,
newParam.crop_bot);
} else {
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->17.naluType[%x].....\n",
naluType);
id = newParam.picSetID = rbsp.ue();
newParam.seqSetID = rbsp.ue();
(void)rbsp.u(1);
newParam.picOrderPresentFlag =
(rbsp.u(1) == 1);
}
// We currently don't support updating existing parameter
// sets.
//const H264ParamNaluSet::const_iterator it = naluSet.find (id);
H264ParamNalu *it = naluSet.find(id);
if (it) {
const uint32 tempSize = static_cast < uint32 > (it->nalu); // ???
if ((naluSize != tempSize)
|| (0 !=
memcmp(&encodedBytes[naluStart],
&it->nalu,
static_cast <
int >(naluSize)))) {
QTV_MSG_PRIO(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->18.H264 stream contains two or \
more parameter set NALUs having the \
same ID -- this requires either a \
separate parameter set ES or \
multiple sample description atoms, \
neither of which is currently \
supported!");
break;
}
}
// Otherwise, add NALU to appropriate NALU set.
else {
H264ParamNalu *newParamInSet =
naluSet.find(id);
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->19.newParamInset[%x]\n",
newParamInSet);
if (!newParamInSet) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->20.newParamInset[%x]\n",
newParamInSet);
newParamInSet = &temp;
memcpy(newParamInSet, &newParam,
sizeof(struct
H264ParamNalu));
}
QTV_MSG_PRIO4(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->21.encodebytes=%x naluStart=%x\n",
encodedBytes, naluStart,
naluSize, newParamInSet);
QTV_MSG_PRIO2(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->22.naluSize=%x newparaminset=%p\n",
naluSize, newParamInSet);
QTV_MSG_PRIO4(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->23.-->0x%x 0x%x 0x%x 0x%x\n",
(encodedBytes +
naluStart),
(encodedBytes +
naluStart + 1),
(encodedBytes +
naluStart + 2),
(encodedBytes +
naluStart + 3));
memcpy(&newParamInSet->nalu,
(encodedBytes + naluStart),
sizeof(newParamInSet->nalu));
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_MED,
"H264Parser-->24.nalu=0x%x \n",
newParamInSet->nalu);
naluSet.insert(id, newParamInSet);
}
}
// Otherwise, if we are inside the frame, convert the NALU
// and append it to the frame output, if its type is acceptable.
else if (inFrame && (naluType != 0) && (naluType < 12)
&& (!stripSeiAud || (naluType != 9)
&& (naluType != 6))) {
uint8 sizeBuffer[4];
sizeBuffer[0] =
static_cast < uint8 > (naluSize >> 24);
sizeBuffer[1] =
static_cast < uint8 >
((naluSize >> 16) & 0xFF);
sizeBuffer[2] =
static_cast < uint8 >
((naluSize >> 8) & 0xFF);
sizeBuffer[3] =
static_cast < uint8 > (naluSize & 0xFF);
/*lint -e{1025, 1703, 119, 64, 534}
* These are known lint issues
*/
//frame.insert (frame.end (), sizeBuffer,
// sizeBuffer + sizeof (sizeBuffer));
/*lint -e{1025, 1703, 119, 64, 534, 632}
* These are known lint issues
*/
//frame.insert (frame.end (), encodedBytes + naluStart,
// encodedBytes + naluStart + naluSize);
}
// If NALU was a VCL, save VCL NALU parameters
// for use in frame boundary detection.
if (isVclNalu) {
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->25.isvclnalu check passed\n");
vclNaluFound = true;
prevVclFrameNum = vclFrameNum;
prevVclFieldPicFlag = vclFieldPicFlag;
prevVclNalRefIdc = vclNalRefIdc;
prevVclBottomFieldFlag = vclBottomFieldFlag;
prevVclPicOrderCntLsb = vclPicOrderCntLsb;
prevVclDeltaPicOrderCntBottom =
vclDeltaPicOrderCntBottom;
prevVclDeltaPicOrderCnt0 = vclDeltaPicOrderCnt0;
prevVclDeltaPicOrderCnt1 = vclDeltaPicOrderCnt1;
}
}
// If not currently in a NALU, detect next NALU start code.
if ((cursor & 0xFFFFFF) == 0x000001) {
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->26..here\n");
inNalu = true;
naluStart = static_cast < uint32 > (pos + 1);
if (0xFFFFFFFF == posNalDetected)
posNalDetected = pos - 2;
} else if (pos >= totalBytes) {
QTV_MSG_PRIO2(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->27.pos[%x] totalBytes[%x]\n",
pos, totalBytes);
break;
}
}
uint64 tmpPos = 0;
// find the first non-zero byte
if (pos > 0) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->28.last loop[%x]\n", pos);
tmpPos = pos - 1;
while (tmpPos != 0 && encodedBytes[tmpPos] == 0)
--tmpPos;
// add 1 to get the beginning of the start code
++tmpPos;
}
QTV_MSG_PRIO3(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->29.tmppos=%ld bytesConsumed=%x %x\n",
tmpPos, bytesConsumed, posNalDetected);
bytesConsumed = tmpPos;
nalSize = static_cast < uint32 > (bytesConsumed - posNalDetected);
// Fill in the height and width
QTV_MSG_PRIO2(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->30.seq[%x] pic[%x]\n", this->seq.size(),
this->pic.size());
if (this->seq.size()) {
m_height =
(unsigned)(16 *
(2 -
(this->seq.begin()->frameMbsOnlyFlag)) *
(this->seq.begin()->picHeightInMapUnitsMinus1 +
1));
m_width =
(unsigned)(16 *
(this->seq.begin()->picWidthInMbsMinus1 + 1));
if ((m_height % 16) != 0) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"\n Height %d is not a multiple of 16",
m_height);
m_height = (m_height / 16 + 1) * 16;
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"\n Height adjusted to %d \n", m_height);
}
if ((m_width % 16) != 0) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"\n Width %d is not a multiple of 16",
m_width);
m_width = (m_width / 16 + 1) * 16;
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"\n Width adjusted to %d \n", m_width);
}
height = m_height;
width = m_width;
bInterlace = (!this->seq.begin()->frameMbsOnlyFlag);
cropx = this->seq.begin()->crop_left << 1;
cropy = this->seq.begin()->crop_top << 1;
cropdx =
width -
((this->seq.begin()->crop_left +
this->seq.begin()->crop_right) << 1);
cropdy =
height -
((this->seq.begin()->crop_top +
this->seq.begin()->crop_bot) << 1);
QTV_MSG_PRIO2(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->31.cropdy [%x] cropdx[%x]\n",
cropdy, cropdx);
QTV_MSG_PRIO2(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264Parser-->31.Height [%x] Width[%x]\n", height,
width);
}
this->seq.eraseall();
this->pic.eraseall();
return validate_profile_and_level(profile_id, level_id);;
}
/* ======================================================================
FUNCTION
H264_Utils::parse_first_h264_input_buffer
DESCRIPTION
parse first h264 input buffer
PARAMETERS
OMX_IN OMX_BUFFERHEADERTYPE* buffer.
RETURN VALUE
true if success
false otherwise
========================================================================== */
OMX_U32 H264_Utils::parse_first_h264_input_buffer(OMX_IN OMX_BUFFERHEADERTYPE *
buffer,
OMX_U32
size_of_nal_length_field)
{
OMX_U32 c1, c2, c3, curr_ptr = 0;
OMX_U32 i, j, aSize[4], size = 0;
OMX_U32 header_len = 0;
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264 clip, NAL length field %d\n",
size_of_nal_length_field);
if (buffer == NULL) {
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"Error - buffer is NULL\n");
}
if (size_of_nal_length_field == 0) {
/* Start code with a lot of 0x00 before 0x00 0x00 0x01
Need to move pBuffer to the first 0x00 0x00 0x00 0x01 */
c1 = 1;
c2 = buffer->pBuffer[curr_ptr++];
c3 = buffer->pBuffer[curr_ptr++];
do {
if (curr_ptr >= buffer->nFilledLen) {
QTV_MSG_PRIO(QTVDIAG_GENERAL,
QTVDIAG_PRIO_ERROR,
"ERROR: parse_first_h264_input_buffer - Couldn't find the first 2 NAL (SPS and PPS)\n");
return 0;
}
c1 = c2;
c2 = c3;
c3 = buffer->pBuffer[curr_ptr++];
} while (c1 || c2 || c3 == 0);
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"curr_ptr = %d\n", curr_ptr);
if (curr_ptr > 4) {
// There are unnecessary 0x00
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"Remove unnecessary 0x00 at SPS\n");
memmove(buffer->pBuffer, &buffer->pBuffer[curr_ptr - 4],
buffer->nFilledLen - curr_ptr - 4);
}
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"dat clip, NAL length field %d\n",
size_of_nal_length_field);
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"Start code SPS 0x00 00 00 01\n");
curr_ptr = 4;
/* Start code 00 00 01 */
for (OMX_U8 i = 0; i < 2; i++) {
c1 = 1;
c2 = buffer->pBuffer[curr_ptr++];
c3 = buffer->pBuffer[curr_ptr++];
do {
if (curr_ptr >= buffer->nFilledLen) {
QTV_MSG_PRIO(QTVDIAG_GENERAL,
QTVDIAG_PRIO_ERROR,
"ERROR: parse_first_h264_input_buffer - Couldn't find the first 2 NAL (SPS and PPS)\n");
break;
}
c1 = c2;
c2 = c3;
c3 = buffer->pBuffer[curr_ptr++];
} while (c1 || c2 || c3 != 1);
}
header_len = curr_ptr - 4;
} else {
/* NAL length clip */
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"NAL length clip, NAL length field %d\n",
size_of_nal_length_field);
/* SPS size */
for (i = 0; i < SIZE_NAL_FIELD_MAX - size_of_nal_length_field;
i++) {
aSize[SIZE_NAL_FIELD_MAX - 1 - i] = 0;
}
for (j = 0; i < SIZE_NAL_FIELD_MAX; i++, j++) {
aSize[SIZE_NAL_FIELD_MAX - 1 - i] = buffer->pBuffer[j];
}
size = (uint32) (*((uint32 *) (aSize)));
header_len = size + size_of_nal_length_field;
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"OMX - SPS length %d\n", header_len);
/* PPS size */
for (i = 0; i < SIZE_NAL_FIELD_MAX - size_of_nal_length_field;
i++) {
aSize[SIZE_NAL_FIELD_MAX - 1 - i] = 0;
}
for (j = header_len; i < SIZE_NAL_FIELD_MAX; i++, j++) {
aSize[SIZE_NAL_FIELD_MAX - 1 - i] = buffer->pBuffer[j];
}
size = (uint32) (*((uint32 *) (aSize)));
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"OMX - PPS size %d\n", size);
header_len += size + size_of_nal_length_field;
}
return header_len;
}
OMX_U32 H264_Utils::check_header(OMX_IN OMX_BUFFERHEADERTYPE * buffer,
OMX_U32 sizeofNAL, bool & isPartial,
OMX_U32 headerState)
{
byte coef1, coef2, coef3;
uint32 pos = 0;
uint32 nal_len = 0, nal_len2 = 0;
uint32 sizeofNalLengthField = 0;
uint32 zero_count;
OMX_U32 eRet = -1;
OMX_U8 *nal1_ptr = NULL, *nal2_ptr = NULL;
isPartial = true;
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_LOW,
"H264_Utils::check_header ");
if (!sizeofNAL) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_HIGH,
"check_header: start code %d",
buffer->nFilledLen);
// Search start_code_prefix_one_3bytes (0x000001)
coef2 = buffer->pBuffer[pos++];
coef3 = buffer->pBuffer[pos++];
do {
if (pos >= buffer->nFilledLen) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_ERROR,
"Error at extract rbsp line %d",
__LINE__);
return eRet;
}
coef1 = coef2;
coef2 = coef3;
coef3 = buffer->pBuffer[pos++];
} while (coef1 || coef2 || coef3 != 1);
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_HIGH,
"check_header: start code got fisrt NAL %d", pos);
nal1_ptr = (OMX_U8 *) & buffer->pBuffer[pos];
// Search start_code_prefix_one_3bytes (0x000001)
if (pos + 2 < buffer->nFilledLen) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_HIGH,
"check_header: start code looking for second NAL %d",
pos);
isPartial = false;
coef2 = buffer->pBuffer[pos++];
coef3 = buffer->pBuffer[pos++];
do {
if (pos >= buffer->nFilledLen) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_HIGH,
"Error at extract rbsp line %d",
__LINE__);
isPartial = true;
break;
}
coef1 = coef2;
coef2 = coef3;
coef3 = buffer->pBuffer[pos++];
} while (coef1 || coef2 || coef3 != 1);
}
if (!isPartial) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: start code two nals in one buffer %d",
pos);
nal2_ptr = (OMX_U8 *) & buffer->pBuffer[pos];
if (((nal1_ptr[0] & 0x1f) == NALU_TYPE_SPS)
&& ((nal2_ptr[0] & 0x1f) == NALU_TYPE_PPS)) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_ERROR,
"check_header: start code two nals in one buffer SPS+PPS %d",
pos);
eRet = 0;
} else if (((nal1_ptr[0] & 0x1f) == NALU_TYPE_SPS) && (buffer->nFilledLen < 512)) {
eRet = 0;
}
} else {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_HIGH,
"check_header: start code partial nal in one buffer %d",
pos);
if (headerState == 0
&& ((nal1_ptr[0] & 0x1f) == NALU_TYPE_SPS)) {
eRet = 0;
} else if (((nal1_ptr[0] & 0x1f) == NALU_TYPE_PPS)) {
eRet = 0;
} else
eRet = -1;
}
} else {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: size nal %d", sizeofNAL);
/* This is the case to play multiple NAL units inside each access unit */
/* Extract the NAL length depending on sizeOfNALength field */
sizeofNalLengthField = sizeofNAL;
nal_len = 0;
while (sizeofNAL--) {
nal_len |= buffer->pBuffer[pos++] << (sizeofNAL << 3);
}
if (nal_len >= buffer->nFilledLen) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"Error at extract rbsp line %d",
__LINE__);
return eRet;
}
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: size nal got fist NAL %d",
nal_len);
nal1_ptr = (OMX_U8 *) & buffer->pBuffer[pos];
if ((nal_len + sizeofNalLengthField) < buffer->nFilledLen) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: getting second NAL %d",
buffer->nFilledLen);
isPartial = false;
pos += nal_len;
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: getting second NAL position %d",
pos);
sizeofNAL = sizeofNalLengthField;
nal_len2 = 0;
while (sizeofNAL--) {
nal_len2 |=
buffer->pBuffer[pos++] << (sizeofNAL << 3);
}
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: getting second NAL %d",
nal_len2);
if (nal_len + nal_len2 + 2 * sizeofNalLengthField >
buffer->nFilledLen) {
QTV_MSG_PRIO1(QTVDIAG_GENERAL,
QTVDIAG_PRIO_ERROR,
"Error at extract rbsp line %d",
__LINE__);
return eRet;
}
QTV_MSG_PRIO1(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: size nal got second NAL %d",
nal_len);
nal2_ptr = (OMX_U8 *) & buffer->pBuffer[pos];
}
if (!isPartial) {
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: size nal partial nal ");
if (((nal1_ptr[0] & 0x1f) == NALU_TYPE_SPS)
&& ((nal2_ptr[0] & 0x1f) == NALU_TYPE_PPS)) {
eRet = 0;
}
} else {
QTV_MSG_PRIO(QTVDIAG_GENERAL, QTVDIAG_PRIO_ERROR,
"check_header: size nal full header");
if (headerState == 0
&& ((nal1_ptr[0] & 0x1f) == NALU_TYPE_SPS)) {
eRet = 0;
} else if (((nal1_ptr[0] & 0x1f) == NALU_TYPE_PPS)) {
eRet = 0;
} else
eRet = -1;
}
}
return eRet;
}
/*===========================================================================
FUNCTION:
validate_profile_and_level
DESCRIPTION:
This function validate the profile and level that is supported.
INPUT/OUTPUT PARAMETERS:
uint32 profile
uint32 level
RETURN VALUE:
false it it's not supported
true otherwise
SIDE EFFECTS:
None.
===========================================================================*/
bool H264_Utils::validate_profile_and_level(uint32 profile, uint32 level)
{
QTV_MSG_PRIO2(QTVDIAG_GENERAL, QTVDIAG_PRIO_MED,
"H264 profile %d, level %d\n", profile, level);
if ((m_default_profile_chk &&
profile != BASELINE_PROFILE &&
profile != MAIN_PROFILE &&
profile != HIGH_PROFILE) || (m_default_level_chk && level > MAX_SUPPORTED_LEVEL)
) {
return false;
}
return true;
}
| 36.23384
| 159
| 0.482974
|
Zuli
|
78c8234b9f8b1270d9a14bab448f53cbe95e1d77
| 2,196
|
hpp
|
C++
|
Ponce/include_IDA6.8/ints.hpp
|
ZhuHuiBeiShaDiao/Ponce
|
fc25268592027af0c71c898f87a347418c5ad475
|
[
"BSL-1.0"
] | 1
|
2019-08-01T03:43:28.000Z
|
2019-08-01T03:43:28.000Z
|
Ponce/include_IDA6.8/ints.hpp
|
ZhuHuiBeiShaDiao/Ponce
|
fc25268592027af0c71c898f87a347418c5ad475
|
[
"BSL-1.0"
] | null | null | null |
Ponce/include_IDA6.8/ints.hpp
|
ZhuHuiBeiShaDiao/Ponce
|
fc25268592027af0c71c898f87a347418c5ad475
|
[
"BSL-1.0"
] | null | null | null |
/*
* Interactive disassembler (IDA).
* Copyright (c) 1990-2015 Hex-Rays
* ALL RIGHTS RESERVED.
*
*/
#ifndef _INTS_HPP
#define _INTS_HPP
#pragma pack(push, 1) // IDA uses 1 byte alignments!
/*! \file ints.hpp
\brief Functions that deal with the predefined comments
*/
class insn_t;
class WorkReg;
//--------------------------------------------------------------------
// P R E D E F I N E D C O M M E N T S
//--------------------------------------------------------------------
/// Get predefined comment.
/// \param cmd current instruction information
/// \param buf buffer for the comment
/// \param bufsize size of the output buffer
/// \return size of comment or -1
idaman ssize_t ida_export get_predef_insn_cmt(
const insn_t &cmd,
char *buf,
size_t bufsize);
/// Get predefined comment.
/// \param info text string with description of operand and register values.
/// This string consists of equations:
/// - reg=value ...
/// where reg may be any word register name,
/// or Op1,Op2 - for first or second operands
/// \param wrktyp icode of instruction to get comment about
/// \param buf buffer for the comment
/// \param bufsize size of the output buffer
/// \return size of comment or -1
idaman ssize_t ida_export get_predef_cmt(
const char *info,
int wrktyp,
char *buf,
size_t bufsize);
/// Get predefined VxD function name.
/// \param vxdnum number of VxD
/// \param funcnum number of function in the VxD
/// \param buf buffer for the comment
/// \param bufsize size of the output buffer
/// \return comment or NULL
#ifdef _IDP_HPP
inline char *idaapi get_vxd_func_name(
int vxdnum,
int funcnum,
char *buf,
size_t bufsize)
{
buf[0] = '\0';
ph.notify(ph.get_vxd_name, vxdnum, funcnum, buf, bufsize);
return buf[0] ? buf : NULL;
}
#endif
//--------------------------------------------------------------------
// Private definitions
//-------------------------------------------------------------------
#pragma pack(pop)
#endif // _INTS_HPP
| 26.457831
| 80
| 0.54827
|
ZhuHuiBeiShaDiao
|
78cea65154305a9c303ce88d6ef546511ff59376
| 1,940
|
cpp
|
C++
|
examples/dispatch/dispatch.cpp
|
jstaursky/libviface
|
67bc973e369869df5c24aa654541c6295e49f889
|
[
"Apache-2.0"
] | 38
|
2016-11-21T08:05:11.000Z
|
2022-03-24T14:27:05.000Z
|
examples/dispatch/dispatch.cpp
|
jstaursky/libviface
|
67bc973e369869df5c24aa654541c6295e49f889
|
[
"Apache-2.0"
] | 7
|
2018-03-12T02:25:04.000Z
|
2022-03-23T08:22:19.000Z
|
examples/dispatch/dispatch.cpp
|
jstaursky/libviface
|
67bc973e369869df5c24aa654541c6295e49f889
|
[
"Apache-2.0"
] | 21
|
2016-01-20T04:20:40.000Z
|
2022-03-29T08:16:49.000Z
|
#include <iostream>
#include <viface/viface.hpp>
#include <viface/utils.hpp>
using namespace std;
class MyDispatcher
{
private:
int count = 0;
public:
bool handler(string const& name, uint id, vector<uint8_t>& packet) {
cout << "+++ Received packet " << dec << count;
cout << " from interface " << name;
cout << " (" << id << ") of size " << packet.size();
cout << " and CRC of 0x" << hex << viface::utils::crc32(packet);
cout << endl;
cout << viface::utils::hexdump(packet) << endl;
this->count++;
return true;
}
};
/**
* This example shows how to setup a dispatcher for a set of virtual interfaces.
* This uses a class method for the callback in order to show this kind of
* usage, but any function using the same signature as dispatcher_cb type
* can be used.
*
* To help with the example you can send a few packets to the created virtual
* interfaces using scapy, wireshark, libtins or any other.
*/
int main(int argc, const char* argv[])
{
cout << "Starting dispatch example ..." << endl;
try {
viface::VIface iface1("viface%d");
iface1.up();
cout << "Interface " << iface1.getName() << " up!" << endl;
viface::VIface iface2("viface%d");
iface2.up();
cout << "Interface " << iface2.getName() << " up!" << endl;
// Call dispatch
set<viface::VIface*> myifaces = {&iface1, &iface2};
MyDispatcher printer;
viface::dispatcher_cb mycb = bind(
&MyDispatcher::handler,
&printer,
placeholders::_1,
placeholders::_2,
placeholders::_3
);
cout << "Calling dispath ..." << endl;
viface::dispatch(myifaces, mycb);
} catch(exception const & ex) {
cerr << ex.what() << endl;
return -1;
}
return 0;
}
| 28.115942
| 80
| 0.554124
|
jstaursky
|
78cff282ce4f82341a4f076bea8b95b1b02a3902
| 7,218
|
cpp
|
C++
|
hermit/cfgscr.cpp
|
ancientlore/hermit
|
0b6b5b3e364fe9a7080517a7f3ddb8cdb03f5b14
|
[
"MIT"
] | 1
|
2020-07-15T19:39:49.000Z
|
2020-07-15T19:39:49.000Z
|
hermit/cfgscr.cpp
|
ancientlore/hermit
|
0b6b5b3e364fe9a7080517a7f3ddb8cdb03f5b14
|
[
"MIT"
] | null | null | null |
hermit/cfgscr.cpp
|
ancientlore/hermit
|
0b6b5b3e364fe9a7080517a7f3ddb8cdb03f5b14
|
[
"MIT"
] | null | null | null |
// Config Scroller class
// Copyright (C) 1996 Michael D. Lore All Rights Reserved
#include <stdio.h>
#include <io.h>
#include "cfgscr.h"
#include "registry.h"
#include "console/colors.h"
#include "cfgdlg.h"
#include "console/inputdlg.h"
#include "ptr.h"
#define COMMAND_SIZE 1024
ConfigScroller::ConfigScroller (Screen& screen, int x, int y, int w, int h) :
Scroller (screen, x, y, w, h, 0), mExitKey (KB_ESC), mDialog (0),
mDllHist ("RegSvr History"), mRegHist ("Cmd Export History")
{
setScrollable (&mScrollCfg);
}
ConfigScroller::~ConfigScroller ()
{
}
int ConfigScroller::processEvent (const Event& event)
{
int key;
int table;
switch (event.key) {
case KB_ESC:
mExitKey = KB_ESC;
postEvent (Event (EV_QUIT));
break;
case KB_ENTER:
// Launch command edit window
myScreen.sendEvent (Event(EV_STATUS_MSG, (DWORD) ""));
key = mScrollCfg.getCursor ();
switch (key) {
case 0: // "Select Color Scheme"
table = getColorTable ();
selectColorTable (++table);
myScreen.sendEvent (Event (EV_COLOR_CHANGE));
if (mDialog != NULL)
mDialog->draw ();
draw ();
break;
case 1: // "Export Custom Commands"
exportReg ();
break;
case 2: // "Import Custom Commands"
importReg ();
break;
case 3: // "Register DLL Server"
registerServer ();
break;
case 4: // "Unregister DLL Server"
unregisterServer ();
break;
default:
break;
}
// drawLine (mCursor);
break;
default:
return Scroller::processEvent (event);
}
return 1;
}
void ConfigScroller::exportReg ()
{
int exitCode = KB_ESC;
char path[512];
*path = 0;
{
InputDialog dlg (myScreen, "Export Custom Commands", "Enter the pathname:",
path, 511, &mRegHist);
dlg.run ();
exitCode = dlg.getExitCode ();
}
if (exitCode != KB_ESC) {
if (_access (path, 0) == 0)
if (myScreen.ask ("Confirm File Replace", "Overwrite the existing file?") == 0)
return;
FILE *file = fopen (path, "w");
if (file == NULL) {
myScreen.sendEvent (Event(EV_STATUS_MSG, (DWORD) "Could not create file."));
return;
}
for (int i = 0; i < 2; i++) {
int st, fn;
if (i == 0) {
st = 'A';
fn = 'Z';
}
else if (i == 1) {
st = '0';
fn = '9';
}
for (char c = st; c <= fn; c++) {
try {
// Open registry key
RegistryKey k (HKEY_CURRENT_USER, HKCU_SUBKEY_HERMIT "\\Commands", KEY_READ);
char valname[2];
valname[0] = c;
valname[1] = '\0';
// try to read the current value
char *value = 0;
DWORD type;
try {
value = k.queryValue (valname, type);
if (type == REG_SZ && value != 0 && value[0] != '\0') {
fprintf (file, "%c,%s\n", c, value);
}
delete [] value;
}
catch (const std::exception&) {
}
}
catch (const std::exception&) {
}
}
}
fclose (file);
myScreen.sendEvent (Event(EV_STATUS_MSG, (DWORD) "Commands exported."));
}
}
void ConfigScroller::importReg ()
{
int exitCode = KB_ESC;
char path[512];
*path = 0;
{
InputDialog dlg (myScreen, "Import Custom Commands", "Enter the pathname:",
path, 511, &mRegHist);
dlg.run ();
exitCode = dlg.getExitCode ();
}
if (exitCode != KB_ESC) {
myScreen.sendEvent (Event(EV_STATUS_MSG, (DWORD) importCommands (path)));
}
}
const char *ConfigScroller::importCommands (const char *path)
{
FILE *file = fopen (path, "r");
if (file == NULL)
return "Could not open file";
ArrayPtr<char> str = new char [COMMAND_SIZE + 3];
if (str == 0)
throw AppException (WHERE, ERR_OUT_OF_MEMORY);
char *status = 0;
while (fgets (str, COMMAND_SIZE + 3, file) != NULL) {
// Remove trailing whitespace
int n = (int) strlen (str);
while (n > 0 && (str[n - 1] == '\n' || str[n - 1] == '\t' || str[n - 1] == ' ')) {
str[n - 1] = '\0';
n--;
}
// If string is empty, just ignore it
if (str[0] == '\0')
continue;
// Uppercase the first letter
str[0] = toupper (str[0]);
// Make sure the command format is [A-Z,0-9],
if ((!(str[0] >= 'A' && str[0] <= 'Z') &&
!(str[0] >= '0' && str[0] <= '9')) || str[1] != ',') {
status = "A read error occurred.";
break;
}
// Create the value name string
char valname[2];
valname[0] = str[0];
valname[1] = '\0';
// Save to registry
try {
// Open registry key
RegistryKey k (HKEY_CURRENT_USER, HKCU_SUBKEY_HERMIT "\\Commands", KEY_READ | KEY_WRITE);
k.setValue (valname, &str[2]);
}
catch (const std::exception&) {
status = "Error saving key to registry";
break;
}
}
if (ferror (file) != 0)
status = "A read error occurred.";
if (status == 0) {
// Set initialized state (actually no reason...we use Commands key)
#if 0
try {
RegistryKey k (HKEY_CURRENT_USER, HKCU_SUBKEY_HERMIT "\\Initialized", KEY_READ | KEY_WRITE);
}
catch (const std::exception&) {
}
#endif
// Set message
status = "Commands imported.";
}
fclose (file);
return status;
}
void ConfigScroller::registerServer ()
{
int exitCode = KB_ESC;
char dllpath[512];
*dllpath = 0;
{
InputDialog dlg (myScreen, "Register DLL Server", "Enter the DLL pathname:",
dllpath, 511, &mDllHist);
dlg.run ();
exitCode = dlg.getExitCode ();
}
if (exitCode != KB_ESC) {
HINSTANCE hInst = LoadLibrary (dllpath);
if (hInst == NULL) {
myScreen.sendWinErrStatusMsg ("Cannot load DLL");
return;
}
FARPROC dllEntryPoint;
dllEntryPoint = GetProcAddress (hInst, "DllRegisterServer");
if (dllEntryPoint == NULL) {
myScreen.sendWinErrStatusMsg ("Cannot load DllRegisterServer");
FreeLibrary (hInst);
return;
}
if (FAILED ((*dllEntryPoint) ()))
myScreen.sendEvent (Event(EV_STATUS_MSG, (DWORD) "The registration function failed."));
else
myScreen.sendEvent (Event(EV_STATUS_MSG, (DWORD) "Server registered!"));
FreeLibrary (hInst);
}
}
void ConfigScroller::unregisterServer ()
{
int exitCode = KB_ESC;
char dllpath[512];
*dllpath = 0;
{
InputDialog dlg (myScreen, "Unregister DLL Server", "Enter the DLL pathname:",
dllpath, 511, &mDllHist);
dlg.run ();
exitCode = dlg.getExitCode ();
}
if (exitCode != KB_ESC) {
HINSTANCE hInst = LoadLibrary (dllpath);
if (hInst == NULL) {
myScreen.sendWinErrStatusMsg ("Cannot load DLL");
return;
}
FARPROC dllEntryPoint;
dllEntryPoint = GetProcAddress (hInst, "DllUnregisterServer");
if (dllEntryPoint == NULL) {
myScreen.sendWinErrStatusMsg ("Cannot load DllUnregisterServer");
FreeLibrary (hInst);
return;
}
if (FAILED ((*dllEntryPoint) ()))
myScreen.sendEvent (Event(EV_STATUS_MSG, (DWORD) "The unregistration function failed."));
else
myScreen.sendEvent (Event(EV_STATUS_MSG, (DWORD) "Server unregistered!"));
FreeLibrary (hInst);
}
}
// End
| 24.140468
| 98
| 0.578969
|
ancientlore
|
78d07c65fff7db1019b418e82aa156c9ff68734d
| 3,901
|
cpp
|
C++
|
core-uv/uv-signal-handler.cpp
|
plok/katla
|
aaaeb8baf041bba7259275beefc71c8452a16223
|
[
"Apache-2.0"
] | null | null | null |
core-uv/uv-signal-handler.cpp
|
plok/katla
|
aaaeb8baf041bba7259275beefc71c8452a16223
|
[
"Apache-2.0"
] | 3
|
2021-03-25T14:33:22.000Z
|
2021-11-16T14:21:56.000Z
|
core-uv/uv-signal-handler.cpp
|
plok/katla
|
aaaeb8baf041bba7259275beefc71c8452a16223
|
[
"Apache-2.0"
] | 1
|
2020-08-26T13:32:36.000Z
|
2020-08-26T13:32:36.000Z
|
/***
* Copyright 2019 The Katla Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "uv-signal-handler.h"
#include "uv-event-loop.h"
#include "katla/core/core-errors.h"
#include <signal.h>
namespace katla {
UvSignalHandler::UvSignalHandler(UvEventLoop& eventLoop) :
m_eventLoop(eventLoop)
{
}
UvSignalHandler::~UvSignalHandler() {
assert(!m_handle); // should be destroyed before destruction because it needs event-loop
}
outcome::result<void, Error> UvSignalHandler::init()
{
if (m_handle) {
return Error(katla::make_error_code(katla::CoreErrorCode::AlreadyInitialized));
}
m_handle = new uv_signal_t();
m_handle->data = this;
auto uvEventLoop = m_eventLoop.handle();
auto result = uv_signal_init(uvEventLoop, m_handle);
if (result != 0) {
return Error(katla::make_error_code(katla::CoreErrorCode::InitFailed), uv_strerror(result), uv_err_name(result));
}
return outcome::success();
}
outcome::result<void, Error> UvSignalHandler::close()
{
if (!m_handle) {
return outcome::success();
}
if (!uv_is_closing(reinterpret_cast<uv_handle_t*>(m_handle))) {
uv_close(reinterpret_cast<uv_handle_t*>(m_handle), uv_close_callback);
}
return outcome::success();
}
outcome::result<void, Error> UvSignalHandler::start(Signal signal, std::function<void()> function)
{
if (!m_handle) {
return Error(katla::make_error_code(katla::CoreErrorCode::NotInitialized));
}
m_function = function;
if (signal == Signal::Unknown) {
return Error(katla::make_error_code(katla::CoreErrorCode::InvalidSignal));
}
int uvSignal = -1;
switch (signal) {
case Signal::Unknown: assert(false);
case Signal::Interrupt: uvSignal = SIGINT; break;
case Signal::Hangup: uvSignal = SIGHUP; break;
case Signal::Kill: uvSignal = SIGKILL; break;
case Signal::Stop: uvSignal = SIGSTOP; break;
case Signal::Terminate: uvSignal = SIGTERM; break;
}
auto result = uv_signal_start(m_handle, &uv_signal_handler_callback, uvSignal);
if (result != 0) {
return Error(katla::make_error_code(katla::CoreErrorCode::OperationFailed), uv_strerror(result), uv_err_name(result));
}
return outcome::success();
}
outcome::result<void, Error> UvSignalHandler::stop()
{
if (!m_handle) {
return outcome::success();
}
if (uv_is_active(reinterpret_cast<uv_handle_t*>(m_handle))) {
auto result = uv_signal_stop(m_handle);
if (result != 0) {
return Error(katla::make_error_code(katla::CoreErrorCode::OperationFailed), uv_strerror(result), uv_err_name(result));
}
}
return outcome::success();
}
void UvSignalHandler::callback(int signum)
{
if (m_function) {
m_function();
}
}
void UvSignalHandler::uv_signal_handler_callback(uv_signal_t* handle, int signum)
{
if (handle->data) {
static_cast<UvSignalHandler*>(handle->data)->callback(signum);
}
}
void UvSignalHandler::uv_close_callback(uv_handle_t* handle)
{
assert(handle);
assert(handle->data); // event-loop should close handle before destruction
if (handle->data) {
static_cast<UvSignalHandler*>(handle->data)->deleteHandle();
}
}
void UvSignalHandler::deleteHandle()
{
if (m_handle) {
delete m_handle;
m_handle = nullptr;
}
}
}
| 27.090278
| 130
| 0.683927
|
plok
|
78d18f73dd6a139fd48edcde91c18e54d4d28be1
| 49,898
|
cpp
|
C++
|
bin/windows/cpp/obj/src/openfl/Assets.cpp
|
DrSkipper/twogames
|
916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b
|
[
"MIT"
] | null | null | null |
bin/windows/cpp/obj/src/openfl/Assets.cpp
|
DrSkipper/twogames
|
916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b
|
[
"MIT"
] | null | null | null |
bin/windows/cpp/obj/src/openfl/Assets.cpp
|
DrSkipper/twogames
|
916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b
|
[
"MIT"
] | null | null | null |
#include <hxcpp.h>
#ifndef INCLUDED_DefaultAssetLibrary
#include <DefaultAssetLibrary.h>
#endif
#ifndef INCLUDED_IMap
#include <IMap.h>
#endif
#ifndef INCLUDED_Type
#include <Type.h>
#endif
#ifndef INCLUDED_flash_display_BitmapData
#include <flash/display/BitmapData.h>
#endif
#ifndef INCLUDED_flash_display_DisplayObject
#include <flash/display/DisplayObject.h>
#endif
#ifndef INCLUDED_flash_display_DisplayObjectContainer
#include <flash/display/DisplayObjectContainer.h>
#endif
#ifndef INCLUDED_flash_display_IBitmapDrawable
#include <flash/display/IBitmapDrawable.h>
#endif
#ifndef INCLUDED_flash_display_InteractiveObject
#include <flash/display/InteractiveObject.h>
#endif
#ifndef INCLUDED_flash_display_MovieClip
#include <flash/display/MovieClip.h>
#endif
#ifndef INCLUDED_flash_display_Sprite
#include <flash/display/Sprite.h>
#endif
#ifndef INCLUDED_flash_events_EventDispatcher
#include <flash/events/EventDispatcher.h>
#endif
#ifndef INCLUDED_flash_events_IEventDispatcher
#include <flash/events/IEventDispatcher.h>
#endif
#ifndef INCLUDED_flash_media_Sound
#include <flash/media/Sound.h>
#endif
#ifndef INCLUDED_flash_text_Font
#include <flash/text/Font.h>
#endif
#ifndef INCLUDED_flash_utils_ByteArray
#include <flash/utils/ByteArray.h>
#endif
#ifndef INCLUDED_flash_utils_IDataInput
#include <flash/utils/IDataInput.h>
#endif
#ifndef INCLUDED_flash_utils_IDataOutput
#include <flash/utils/IDataOutput.h>
#endif
#ifndef INCLUDED_haxe_Log
#include <haxe/Log.h>
#endif
#ifndef INCLUDED_haxe_Unserializer
#include <haxe/Unserializer.h>
#endif
#ifndef INCLUDED_haxe_ds_StringMap
#include <haxe/ds/StringMap.h>
#endif
#ifndef INCLUDED_haxe_io_Bytes
#include <haxe/io/Bytes.h>
#endif
#ifndef INCLUDED_openfl_AssetCache
#include <openfl/AssetCache.h>
#endif
#ifndef INCLUDED_openfl_AssetLibrary
#include <openfl/AssetLibrary.h>
#endif
#ifndef INCLUDED_openfl_AssetType
#include <openfl/AssetType.h>
#endif
#ifndef INCLUDED_openfl_Assets
#include <openfl/Assets.h>
#endif
#ifndef INCLUDED_openfl_utils_IMemoryRange
#include <openfl/utils/IMemoryRange.h>
#endif
namespace openfl{
Void Assets_obj::__construct()
{
return null();
}
Assets_obj::~Assets_obj() { }
Dynamic Assets_obj::__CreateEmpty() { return new Assets_obj; }
hx::ObjectPtr< Assets_obj > Assets_obj::__new()
{ hx::ObjectPtr< Assets_obj > result = new Assets_obj();
result->__construct();
return result;}
Dynamic Assets_obj::__Create(hx::DynamicArray inArgs)
{ hx::ObjectPtr< Assets_obj > result = new Assets_obj();
result->__construct();
return result;}
::openfl::AssetCache Assets_obj::cache;
::haxe::ds::StringMap Assets_obj::libraries;
bool Assets_obj::initialized;
bool Assets_obj::exists( ::String id,::openfl::AssetType type){
HX_STACK_PUSH("Assets::exists","openfl/Assets.hx",40);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(type,"type");
HX_STACK_LINE(42)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(46)
if (((type == null()))){
HX_STACK_LINE(46)
type = ::openfl::AssetType_obj::BINARY;
}
HX_STACK_LINE(52)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(53)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(54)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(56)
if (((library != null()))){
HX_STACK_LINE(56)
return library->exists(symbolName,type);
}
HX_STACK_LINE(64)
return false;
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,exists,return )
::flash::display::BitmapData Assets_obj::getBitmapData( ::String id,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::getBitmapData","openfl/Assets.hx",76);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(78)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(82)
if (((bool((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled))) && bool(::openfl::Assets_obj::cache->bitmapData->exists(id))))){
HX_STACK_LINE(84)
::flash::display::BitmapData bitmapData = ::openfl::Assets_obj::cache->bitmapData->get(id); HX_STACK_VAR(bitmapData,"bitmapData");
HX_STACK_LINE(86)
if ((::openfl::Assets_obj::isValidBitmapData(bitmapData))){
HX_STACK_LINE(86)
return bitmapData;
}
}
HX_STACK_LINE(94)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(95)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(96)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(98)
if (((library != null()))){
HX_STACK_LINE(98)
if ((library->exists(symbolName,::openfl::AssetType_obj::IMAGE))){
HX_STACK_LINE(100)
if ((library->isLocal(symbolName,::openfl::AssetType_obj::IMAGE))){
HX_STACK_LINE(104)
::flash::display::BitmapData bitmapData = library->getBitmapData(symbolName); HX_STACK_VAR(bitmapData,"bitmapData");
HX_STACK_LINE(106)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_STACK_LINE(106)
::openfl::Assets_obj::cache->bitmapData->set(id,bitmapData);
}
HX_STACK_LINE(112)
return bitmapData;
}
else{
HX_STACK_LINE(114)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] BitmapData asset \"") + id) + HX_CSTRING("\" exists, but only asynchronously")),hx::SourceInfo(HX_CSTRING("Assets.hx"),116,HX_CSTRING("openfl.Assets"),HX_CSTRING("getBitmapData")));
}
}
else{
HX_STACK_LINE(120)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no BitmapData asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),122,HX_CSTRING("openfl.Assets"),HX_CSTRING("getBitmapData")));
}
}
else{
HX_STACK_LINE(126)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),128,HX_CSTRING("openfl.Assets"),HX_CSTRING("getBitmapData")));
}
HX_STACK_LINE(134)
return null();
}
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,getBitmapData,return )
::flash::utils::ByteArray Assets_obj::getBytes( ::String id){
HX_STACK_PUSH("Assets::getBytes","openfl/Assets.hx",145);
HX_STACK_ARG(id,"id");
HX_STACK_LINE(147)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(151)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(152)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(153)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(155)
if (((library != null()))){
HX_STACK_LINE(155)
if ((library->exists(symbolName,::openfl::AssetType_obj::BINARY))){
HX_STACK_LINE(157)
if ((library->isLocal(symbolName,::openfl::AssetType_obj::BINARY))){
HX_STACK_LINE(159)
return library->getBytes(symbolName);
}
else{
HX_STACK_LINE(163)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] String or ByteArray asset \"") + id) + HX_CSTRING("\" exists, but only asynchronously")),hx::SourceInfo(HX_CSTRING("Assets.hx"),165,HX_CSTRING("openfl.Assets"),HX_CSTRING("getBytes")));
}
}
else{
HX_STACK_LINE(169)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no String or ByteArray asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),171,HX_CSTRING("openfl.Assets"),HX_CSTRING("getBytes")));
}
}
else{
HX_STACK_LINE(175)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),177,HX_CSTRING("openfl.Assets"),HX_CSTRING("getBytes")));
}
HX_STACK_LINE(183)
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,getBytes,return )
::flash::text::Font Assets_obj::getFont( ::String id,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::getFont","openfl/Assets.hx",194);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(196)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(200)
if (((bool((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled))) && bool(::openfl::Assets_obj::cache->font->exists(id))))){
HX_STACK_LINE(200)
return ::openfl::Assets_obj::cache->font->get(id);
}
HX_STACK_LINE(206)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(207)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(208)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(210)
if (((library != null()))){
HX_STACK_LINE(210)
if ((library->exists(symbolName,::openfl::AssetType_obj::FONT))){
HX_STACK_LINE(212)
if ((library->isLocal(symbolName,::openfl::AssetType_obj::FONT))){
HX_STACK_LINE(216)
::flash::text::Font font = library->getFont(symbolName); HX_STACK_VAR(font,"font");
HX_STACK_LINE(218)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_STACK_LINE(218)
::openfl::Assets_obj::cache->font->set(id,font);
}
HX_STACK_LINE(224)
return font;
}
else{
HX_STACK_LINE(226)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] Font asset \"") + id) + HX_CSTRING("\" exists, but only asynchronously")),hx::SourceInfo(HX_CSTRING("Assets.hx"),228,HX_CSTRING("openfl.Assets"),HX_CSTRING("getFont")));
}
}
else{
HX_STACK_LINE(232)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no Font asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),234,HX_CSTRING("openfl.Assets"),HX_CSTRING("getFont")));
}
}
else{
HX_STACK_LINE(238)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),240,HX_CSTRING("openfl.Assets"),HX_CSTRING("getFont")));
}
HX_STACK_LINE(246)
return null();
}
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,getFont,return )
::openfl::AssetLibrary Assets_obj::getLibrary( ::String name){
HX_STACK_PUSH("Assets::getLibrary","openfl/Assets.hx",251);
HX_STACK_ARG(name,"name");
HX_STACK_LINE(253)
if (((bool((name == null())) || bool((name == HX_CSTRING("")))))){
HX_STACK_LINE(253)
name = HX_CSTRING("default");
}
HX_STACK_LINE(259)
return ::openfl::Assets_obj::libraries->get(name);
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,getLibrary,return )
::flash::display::MovieClip Assets_obj::getMovieClip( ::String id){
HX_STACK_PUSH("Assets::getMovieClip","openfl/Assets.hx",270);
HX_STACK_ARG(id,"id");
HX_STACK_LINE(272)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(276)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(277)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(278)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(280)
if (((library != null()))){
HX_STACK_LINE(280)
if ((library->exists(symbolName,::openfl::AssetType_obj::MOVIE_CLIP))){
HX_STACK_LINE(282)
if ((library->isLocal(symbolName,::openfl::AssetType_obj::MOVIE_CLIP))){
HX_STACK_LINE(284)
return library->getMovieClip(symbolName);
}
else{
HX_STACK_LINE(288)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] MovieClip asset \"") + id) + HX_CSTRING("\" exists, but only asynchronously")),hx::SourceInfo(HX_CSTRING("Assets.hx"),290,HX_CSTRING("openfl.Assets"),HX_CSTRING("getMovieClip")));
}
}
else{
HX_STACK_LINE(294)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no MovieClip asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),296,HX_CSTRING("openfl.Assets"),HX_CSTRING("getMovieClip")));
}
}
else{
HX_STACK_LINE(300)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),302,HX_CSTRING("openfl.Assets"),HX_CSTRING("getMovieClip")));
}
HX_STACK_LINE(308)
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,getMovieClip,return )
::flash::media::Sound Assets_obj::getMusic( ::String id,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::getMusic","openfl/Assets.hx",319);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(321)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(325)
if (((bool((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled))) && bool(::openfl::Assets_obj::cache->sound->exists(id))))){
HX_STACK_LINE(327)
::flash::media::Sound sound = ::openfl::Assets_obj::cache->sound->get(id); HX_STACK_VAR(sound,"sound");
HX_STACK_LINE(329)
if ((::openfl::Assets_obj::isValidSound(sound))){
HX_STACK_LINE(329)
return sound;
}
}
HX_STACK_LINE(337)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(338)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(339)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(341)
if (((library != null()))){
HX_STACK_LINE(341)
if ((library->exists(symbolName,::openfl::AssetType_obj::MUSIC))){
HX_STACK_LINE(343)
if ((library->isLocal(symbolName,::openfl::AssetType_obj::MUSIC))){
HX_STACK_LINE(347)
::flash::media::Sound sound = library->getMusic(symbolName); HX_STACK_VAR(sound,"sound");
HX_STACK_LINE(349)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_STACK_LINE(349)
::openfl::Assets_obj::cache->sound->set(id,sound);
}
HX_STACK_LINE(355)
return sound;
}
else{
HX_STACK_LINE(357)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] Sound asset \"") + id) + HX_CSTRING("\" exists, but only asynchronously")),hx::SourceInfo(HX_CSTRING("Assets.hx"),359,HX_CSTRING("openfl.Assets"),HX_CSTRING("getMusic")));
}
}
else{
HX_STACK_LINE(363)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no Sound asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),365,HX_CSTRING("openfl.Assets"),HX_CSTRING("getMusic")));
}
}
else{
HX_STACK_LINE(369)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),371,HX_CSTRING("openfl.Assets"),HX_CSTRING("getMusic")));
}
HX_STACK_LINE(377)
return null();
}
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,getMusic,return )
::String Assets_obj::getPath( ::String id){
HX_STACK_PUSH("Assets::getPath","openfl/Assets.hx",388);
HX_STACK_ARG(id,"id");
HX_STACK_LINE(390)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(394)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(395)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(396)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(398)
if (((library != null()))){
HX_STACK_LINE(398)
if ((library->exists(symbolName,null()))){
HX_STACK_LINE(400)
return library->getPath(symbolName);
}
else{
HX_STACK_LINE(404)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),406,HX_CSTRING("openfl.Assets"),HX_CSTRING("getPath")));
}
}
else{
HX_STACK_LINE(410)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),412,HX_CSTRING("openfl.Assets"),HX_CSTRING("getPath")));
}
HX_STACK_LINE(418)
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,getPath,return )
::flash::media::Sound Assets_obj::getSound( ::String id,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::getSound","openfl/Assets.hx",429);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(431)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(435)
if (((bool((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled))) && bool(::openfl::Assets_obj::cache->sound->exists(id))))){
HX_STACK_LINE(437)
::flash::media::Sound sound = ::openfl::Assets_obj::cache->sound->get(id); HX_STACK_VAR(sound,"sound");
HX_STACK_LINE(439)
if ((::openfl::Assets_obj::isValidSound(sound))){
HX_STACK_LINE(439)
return sound;
}
}
HX_STACK_LINE(447)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(448)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(449)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(451)
if (((library != null()))){
HX_STACK_LINE(451)
if ((library->exists(symbolName,::openfl::AssetType_obj::SOUND))){
HX_STACK_LINE(453)
if ((library->isLocal(symbolName,::openfl::AssetType_obj::SOUND))){
HX_STACK_LINE(457)
::flash::media::Sound sound = library->getSound(symbolName); HX_STACK_VAR(sound,"sound");
HX_STACK_LINE(459)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_STACK_LINE(459)
::openfl::Assets_obj::cache->sound->set(id,sound);
}
HX_STACK_LINE(465)
return sound;
}
else{
HX_STACK_LINE(467)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] Sound asset \"") + id) + HX_CSTRING("\" exists, but only asynchronously")),hx::SourceInfo(HX_CSTRING("Assets.hx"),469,HX_CSTRING("openfl.Assets"),HX_CSTRING("getSound")));
}
}
else{
HX_STACK_LINE(473)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no Sound asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),475,HX_CSTRING("openfl.Assets"),HX_CSTRING("getSound")));
}
}
else{
HX_STACK_LINE(479)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),481,HX_CSTRING("openfl.Assets"),HX_CSTRING("getSound")));
}
HX_STACK_LINE(487)
return null();
}
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,getSound,return )
::String Assets_obj::getText( ::String id){
HX_STACK_PUSH("Assets::getText","openfl/Assets.hx",498);
HX_STACK_ARG(id,"id");
HX_STACK_LINE(500)
::flash::utils::ByteArray bytes = ::openfl::Assets_obj::getBytes(id); HX_STACK_VAR(bytes,"bytes");
HX_STACK_LINE(502)
if (((bytes == null()))){
HX_STACK_LINE(502)
return null();
}
else{
HX_STACK_LINE(506)
return bytes->readUTFBytes(bytes->length);
}
HX_STACK_LINE(502)
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,getText,return )
Void Assets_obj::initialize( ){
{
HX_STACK_PUSH("Assets::initialize","openfl/Assets.hx",515);
HX_STACK_LINE(515)
if ((!(::openfl::Assets_obj::initialized))){
HX_STACK_LINE(521)
::openfl::Assets_obj::registerLibrary(HX_CSTRING("default"),::DefaultAssetLibrary_obj::__new());
HX_STACK_LINE(525)
::openfl::Assets_obj::initialized = true;
}
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC0(Assets_obj,initialize,(void))
bool Assets_obj::isLocal( ::String id,::openfl::AssetType type,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::isLocal","openfl/Assets.hx",532);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(type,"type");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(534)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(538)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_STACK_LINE(540)
if (((bool((type == ::openfl::AssetType_obj::IMAGE)) || bool((type == null()))))){
HX_STACK_LINE(540)
if ((::openfl::Assets_obj::cache->bitmapData->exists(id))){
HX_STACK_LINE(542)
return true;
}
}
HX_STACK_LINE(546)
if (((bool((type == ::openfl::AssetType_obj::FONT)) || bool((type == null()))))){
HX_STACK_LINE(546)
if ((::openfl::Assets_obj::cache->font->exists(id))){
HX_STACK_LINE(548)
return true;
}
}
HX_STACK_LINE(552)
if (((bool((bool((type == ::openfl::AssetType_obj::SOUND)) || bool((type == ::openfl::AssetType_obj::MUSIC)))) || bool((type == null()))))){
HX_STACK_LINE(552)
if ((::openfl::Assets_obj::cache->sound->exists(id))){
HX_STACK_LINE(554)
return true;
}
}
}
HX_STACK_LINE(560)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(561)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(562)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(564)
if (((library != null()))){
HX_STACK_LINE(564)
return library->isLocal(symbolName,type);
}
HX_STACK_LINE(572)
return false;
}
}
STATIC_HX_DEFINE_DYNAMIC_FUNC3(Assets_obj,isLocal,return )
bool Assets_obj::isValidBitmapData( ::flash::display::BitmapData bitmapData){
HX_STACK_PUSH("Assets::isValidBitmapData","openfl/Assets.hx",577);
HX_STACK_ARG(bitmapData,"bitmapData");
HX_STACK_LINE(581)
return (bitmapData->__handle != null());
HX_STACK_LINE(597)
return true;
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,isValidBitmapData,return )
bool Assets_obj::isValidSound( ::flash::media::Sound sound){
HX_STACK_PUSH("Assets::isValidSound","openfl/Assets.hx",602);
HX_STACK_ARG(sound,"sound");
HX_STACK_LINE(602)
return (bool((sound->__handle != null())) && bool((sound->__handle != (int)0)));
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,isValidSound,return )
Void Assets_obj::loadBitmapData( ::String id,Dynamic handler,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::loadBitmapData","openfl/Assets.hx",617);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(handler,"handler");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(617)
Dynamic handler1 = Dynamic( Array_obj<Dynamic>::__new().Add(handler)); HX_STACK_VAR(handler1,"handler1");
HX_STACK_LINE(617)
Array< ::String > id1 = Array_obj< ::String >::__new().Add(id); HX_STACK_VAR(id1,"id1");
HX_STACK_LINE(619)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(623)
if (((bool((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled))) && bool(::openfl::Assets_obj::cache->bitmapData->exists(id1->__get((int)0)))))){
HX_STACK_LINE(625)
::flash::display::BitmapData bitmapData = ::openfl::Assets_obj::cache->bitmapData->get(id1->__get((int)0)); HX_STACK_VAR(bitmapData,"bitmapData");
HX_STACK_LINE(627)
if ((::openfl::Assets_obj::isValidBitmapData(bitmapData))){
HX_STACK_LINE(629)
handler1->__GetItem((int)0)(bitmapData).Cast< Void >();
HX_STACK_LINE(630)
return null();
}
}
HX_STACK_LINE(636)
::String libraryName = id1->__get((int)0).substring((int)0,id1->__get((int)0).indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(637)
::String symbolName = id1->__get((int)0).substr((id1->__get((int)0).indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(638)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(640)
if (((library != null()))){
HX_STACK_LINE(640)
if ((library->exists(symbolName,::openfl::AssetType_obj::IMAGE))){
HX_STACK_LINE(644)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_BEGIN_LOCAL_FUNC_S2(hx::LocalFunc,_Function_4_1,Array< ::String >,id1,Dynamic,handler1)
Void run(::flash::display::BitmapData bitmapData){
HX_STACK_PUSH("*::_Function_4_1","openfl/Assets.hx",646);
HX_STACK_ARG(bitmapData,"bitmapData");
{
HX_STACK_LINE(648)
::openfl::Assets_obj::cache->bitmapData->set(id1->__get((int)0),bitmapData);
HX_STACK_LINE(649)
handler1->__GetItem((int)0)(bitmapData).Cast< Void >();
}
return null();
}
HX_END_LOCAL_FUNC1((void))
HX_STACK_LINE(644)
library->loadBitmapData(symbolName, Dynamic(new _Function_4_1(id1,handler1)));
}
else{
HX_STACK_LINE(653)
library->loadBitmapData(symbolName,handler1->__GetItem((int)0));
}
HX_STACK_LINE(659)
return null();
}
else{
HX_STACK_LINE(661)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no BitmapData asset with an ID of \"") + id1->__get((int)0)) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),663,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadBitmapData")));
}
}
else{
HX_STACK_LINE(667)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),669,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadBitmapData")));
}
HX_STACK_LINE(675)
handler1->__GetItem((int)0)(null()).Cast< Void >();
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC3(Assets_obj,loadBitmapData,(void))
Void Assets_obj::loadBytes( ::String id,Dynamic handler){
{
HX_STACK_PUSH("Assets::loadBytes","openfl/Assets.hx",680);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(handler,"handler");
HX_STACK_LINE(682)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(686)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(687)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(688)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(690)
if (((library != null()))){
HX_STACK_LINE(690)
if ((library->exists(symbolName,::openfl::AssetType_obj::BINARY))){
HX_STACK_LINE(694)
library->loadBytes(symbolName,handler);
HX_STACK_LINE(695)
return null();
}
else{
HX_STACK_LINE(697)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no String or ByteArray asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),699,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadBytes")));
}
}
else{
HX_STACK_LINE(703)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),705,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadBytes")));
}
HX_STACK_LINE(711)
handler(null()).Cast< Void >();
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,loadBytes,(void))
Void Assets_obj::loadFont( ::String id,Dynamic handler,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::loadFont","openfl/Assets.hx",716);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(handler,"handler");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(716)
Dynamic handler1 = Dynamic( Array_obj<Dynamic>::__new().Add(handler)); HX_STACK_VAR(handler1,"handler1");
HX_STACK_LINE(716)
Array< ::String > id1 = Array_obj< ::String >::__new().Add(id); HX_STACK_VAR(id1,"id1");
HX_STACK_LINE(718)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(722)
if (((bool((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled))) && bool(::openfl::Assets_obj::cache->font->exists(id1->__get((int)0)))))){
HX_STACK_LINE(724)
handler1->__GetItem((int)0)(::openfl::Assets_obj::cache->font->get(id1->__get((int)0))).Cast< Void >();
HX_STACK_LINE(725)
return null();
}
HX_STACK_LINE(729)
::String libraryName = id1->__get((int)0).substring((int)0,id1->__get((int)0).indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(730)
::String symbolName = id1->__get((int)0).substr((id1->__get((int)0).indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(731)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(733)
if (((library != null()))){
HX_STACK_LINE(733)
if ((library->exists(symbolName,::openfl::AssetType_obj::FONT))){
HX_STACK_LINE(737)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_BEGIN_LOCAL_FUNC_S2(hx::LocalFunc,_Function_4_1,Array< ::String >,id1,Dynamic,handler1)
Void run(::flash::text::Font font){
HX_STACK_PUSH("*::_Function_4_1","openfl/Assets.hx",739);
HX_STACK_ARG(font,"font");
{
HX_STACK_LINE(741)
::openfl::Assets_obj::cache->font->set(id1->__get((int)0),font);
HX_STACK_LINE(742)
handler1->__GetItem((int)0)(font).Cast< Void >();
}
return null();
}
HX_END_LOCAL_FUNC1((void))
HX_STACK_LINE(737)
library->loadFont(symbolName, Dynamic(new _Function_4_1(id1,handler1)));
}
else{
HX_STACK_LINE(746)
library->loadFont(symbolName,handler1->__GetItem((int)0));
}
HX_STACK_LINE(752)
return null();
}
else{
HX_STACK_LINE(754)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no Font asset with an ID of \"") + id1->__get((int)0)) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),756,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadFont")));
}
}
else{
HX_STACK_LINE(760)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),762,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadFont")));
}
HX_STACK_LINE(768)
handler1->__GetItem((int)0)(null()).Cast< Void >();
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC3(Assets_obj,loadFont,(void))
Void Assets_obj::loadLibrary( ::String name,Dynamic handler){
{
HX_STACK_PUSH("Assets::loadLibrary","openfl/Assets.hx",773);
HX_STACK_ARG(name,"name");
HX_STACK_ARG(handler,"handler");
HX_STACK_LINE(775)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(779)
::String data = ::openfl::Assets_obj::getText(((HX_CSTRING("libraries/") + name) + HX_CSTRING(".dat"))); HX_STACK_VAR(data,"data");
HX_STACK_LINE(781)
if (((bool((data != null())) && bool((data != HX_CSTRING("")))))){
HX_STACK_LINE(783)
::haxe::Unserializer unserializer = ::haxe::Unserializer_obj::__new(data); HX_STACK_VAR(unserializer,"unserializer");
struct _Function_2_1{
inline static Dynamic Block( ){
HX_STACK_PUSH("*::closure","openfl/Assets.hx",784);
{
hx::Anon __result = hx::Anon_obj::Create();
__result->Add(HX_CSTRING("resolveEnum") , ::openfl::Assets_obj::resolveEnum_dyn(),false);
__result->Add(HX_CSTRING("resolveClass") , ::openfl::Assets_obj::resolveClass_dyn(),false);
return __result;
}
return null();
}
};
HX_STACK_LINE(784)
unserializer->setResolver(_Function_2_1::Block());
HX_STACK_LINE(786)
::openfl::AssetLibrary library = unserializer->unserialize(); HX_STACK_VAR(library,"library");
HX_STACK_LINE(787)
::openfl::Assets_obj::libraries->set(name,library);
HX_STACK_LINE(788)
library->load(handler);
}
else{
HX_STACK_LINE(790)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + name) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),792,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadLibrary")));
}
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,loadLibrary,(void))
Void Assets_obj::loadMusic( ::String id,Dynamic handler,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::loadMusic","openfl/Assets.hx",801);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(handler,"handler");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(801)
Dynamic handler1 = Dynamic( Array_obj<Dynamic>::__new().Add(handler)); HX_STACK_VAR(handler1,"handler1");
HX_STACK_LINE(801)
Array< ::String > id1 = Array_obj< ::String >::__new().Add(id); HX_STACK_VAR(id1,"id1");
HX_STACK_LINE(803)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(807)
if (((bool((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled))) && bool(::openfl::Assets_obj::cache->sound->exists(id1->__get((int)0)))))){
HX_STACK_LINE(809)
::flash::media::Sound sound = ::openfl::Assets_obj::cache->sound->get(id1->__get((int)0)); HX_STACK_VAR(sound,"sound");
HX_STACK_LINE(811)
if ((::openfl::Assets_obj::isValidSound(sound))){
HX_STACK_LINE(813)
handler1->__GetItem((int)0)(sound).Cast< Void >();
HX_STACK_LINE(814)
return null();
}
}
HX_STACK_LINE(820)
::String libraryName = id1->__get((int)0).substring((int)0,id1->__get((int)0).indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(821)
::String symbolName = id1->__get((int)0).substr((id1->__get((int)0).indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(822)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(824)
if (((library != null()))){
HX_STACK_LINE(824)
if ((library->exists(symbolName,::openfl::AssetType_obj::MUSIC))){
HX_STACK_LINE(828)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_BEGIN_LOCAL_FUNC_S2(hx::LocalFunc,_Function_4_1,Array< ::String >,id1,Dynamic,handler1)
Void run(::flash::media::Sound sound){
HX_STACK_PUSH("*::_Function_4_1","openfl/Assets.hx",830);
HX_STACK_ARG(sound,"sound");
{
HX_STACK_LINE(832)
::openfl::Assets_obj::cache->sound->set(id1->__get((int)0),sound);
HX_STACK_LINE(833)
handler1->__GetItem((int)0)(sound).Cast< Void >();
}
return null();
}
HX_END_LOCAL_FUNC1((void))
HX_STACK_LINE(828)
library->loadMusic(symbolName, Dynamic(new _Function_4_1(id1,handler1)));
}
else{
HX_STACK_LINE(837)
library->loadMusic(symbolName,handler1->__GetItem((int)0));
}
HX_STACK_LINE(843)
return null();
}
else{
HX_STACK_LINE(845)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no Sound asset with an ID of \"") + id1->__get((int)0)) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),847,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadMusic")));
}
}
else{
HX_STACK_LINE(851)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),853,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadMusic")));
}
HX_STACK_LINE(859)
handler1->__GetItem((int)0)(null()).Cast< Void >();
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC3(Assets_obj,loadMusic,(void))
Void Assets_obj::loadMovieClip( ::String id,Dynamic handler){
{
HX_STACK_PUSH("Assets::loadMovieClip","openfl/Assets.hx",864);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(handler,"handler");
HX_STACK_LINE(866)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(870)
::String libraryName = id.substring((int)0,id.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(871)
::String symbolName = id.substr((id.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(872)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(874)
if (((library != null()))){
HX_STACK_LINE(874)
if ((library->exists(symbolName,::openfl::AssetType_obj::MOVIE_CLIP))){
HX_STACK_LINE(878)
library->loadMovieClip(symbolName,handler);
HX_STACK_LINE(879)
return null();
}
else{
HX_STACK_LINE(881)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no MovieClip asset with an ID of \"") + id) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),883,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadMovieClip")));
}
}
else{
HX_STACK_LINE(887)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),889,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadMovieClip")));
}
HX_STACK_LINE(895)
handler(null()).Cast< Void >();
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,loadMovieClip,(void))
Void Assets_obj::loadSound( ::String id,Dynamic handler,hx::Null< bool > __o_useCache){
bool useCache = __o_useCache.Default(true);
HX_STACK_PUSH("Assets::loadSound","openfl/Assets.hx",900);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(handler,"handler");
HX_STACK_ARG(useCache,"useCache");
{
HX_STACK_LINE(900)
Dynamic handler1 = Dynamic( Array_obj<Dynamic>::__new().Add(handler)); HX_STACK_VAR(handler1,"handler1");
HX_STACK_LINE(900)
Array< ::String > id1 = Array_obj< ::String >::__new().Add(id); HX_STACK_VAR(id1,"id1");
HX_STACK_LINE(902)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(906)
if (((bool((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled))) && bool(::openfl::Assets_obj::cache->sound->exists(id1->__get((int)0)))))){
HX_STACK_LINE(908)
::flash::media::Sound sound = ::openfl::Assets_obj::cache->sound->get(id1->__get((int)0)); HX_STACK_VAR(sound,"sound");
HX_STACK_LINE(910)
if ((::openfl::Assets_obj::isValidSound(sound))){
HX_STACK_LINE(912)
handler1->__GetItem((int)0)(sound).Cast< Void >();
HX_STACK_LINE(913)
return null();
}
}
HX_STACK_LINE(919)
::String libraryName = id1->__get((int)0).substring((int)0,id1->__get((int)0).indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(920)
::String symbolName = id1->__get((int)0).substr((id1->__get((int)0).indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(921)
::openfl::AssetLibrary library = ::openfl::Assets_obj::getLibrary(libraryName); HX_STACK_VAR(library,"library");
HX_STACK_LINE(923)
if (((library != null()))){
HX_STACK_LINE(923)
if ((library->exists(symbolName,::openfl::AssetType_obj::SOUND))){
HX_STACK_LINE(927)
if (((bool(useCache) && bool(::openfl::Assets_obj::cache->enabled)))){
HX_BEGIN_LOCAL_FUNC_S2(hx::LocalFunc,_Function_4_1,Array< ::String >,id1,Dynamic,handler1)
Void run(::flash::media::Sound sound){
HX_STACK_PUSH("*::_Function_4_1","openfl/Assets.hx",929);
HX_STACK_ARG(sound,"sound");
{
HX_STACK_LINE(931)
::openfl::Assets_obj::cache->sound->set(id1->__get((int)0),sound);
HX_STACK_LINE(932)
handler1->__GetItem((int)0)(sound).Cast< Void >();
}
return null();
}
HX_END_LOCAL_FUNC1((void))
HX_STACK_LINE(927)
library->loadSound(symbolName, Dynamic(new _Function_4_1(id1,handler1)));
}
else{
HX_STACK_LINE(936)
library->loadSound(symbolName,handler1->__GetItem((int)0));
}
HX_STACK_LINE(942)
return null();
}
else{
HX_STACK_LINE(944)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no Sound asset with an ID of \"") + id1->__get((int)0)) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),946,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadSound")));
}
}
else{
HX_STACK_LINE(950)
::haxe::Log_obj::trace(((HX_CSTRING("[openfl.Assets] There is no asset library named \"") + libraryName) + HX_CSTRING("\"")),hx::SourceInfo(HX_CSTRING("Assets.hx"),952,HX_CSTRING("openfl.Assets"),HX_CSTRING("loadSound")));
}
HX_STACK_LINE(958)
handler1->__GetItem((int)0)(null()).Cast< Void >();
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC3(Assets_obj,loadSound,(void))
Void Assets_obj::loadText( ::String id,Dynamic handler){
{
HX_STACK_PUSH("Assets::loadText","openfl/Assets.hx",963);
HX_STACK_ARG(id,"id");
HX_STACK_ARG(handler,"handler");
HX_STACK_LINE(963)
Dynamic handler1 = Dynamic( Array_obj<Dynamic>::__new().Add(handler)); HX_STACK_VAR(handler1,"handler1");
HX_STACK_LINE(965)
::openfl::Assets_obj::initialize();
HX_BEGIN_LOCAL_FUNC_S1(hx::LocalFunc,_Function_1_1,Dynamic,handler1)
Void run(::flash::utils::ByteArray bytes){
HX_STACK_PUSH("*::_Function_1_1","openfl/Assets.hx",969);
HX_STACK_ARG(bytes,"bytes");
{
HX_STACK_LINE(969)
if (((bytes == null()))){
HX_STACK_LINE(971)
handler1->__GetItem((int)0)(null()).Cast< Void >();
}
else{
HX_STACK_LINE(975)
handler1->__GetItem((int)0)(bytes->readUTFBytes(bytes->length)).Cast< Void >();
}
}
return null();
}
HX_END_LOCAL_FUNC1((void))
HX_STACK_LINE(969)
Dynamic callback = Dynamic(new _Function_1_1(handler1)); HX_STACK_VAR(callback,"callback");
HX_STACK_LINE(983)
::openfl::Assets_obj::loadBytes(id,callback);
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,loadText,(void))
Void Assets_obj::registerLibrary( ::String name,::openfl::AssetLibrary library){
{
HX_STACK_PUSH("Assets::registerLibrary","openfl/Assets.hx",994);
HX_STACK_ARG(name,"name");
HX_STACK_ARG(library,"library");
HX_STACK_LINE(996)
if ((::openfl::Assets_obj::libraries->exists(name))){
HX_STACK_LINE(996)
::openfl::Assets_obj::unloadLibrary(name);
}
HX_STACK_LINE(1002)
::openfl::Assets_obj::libraries->set(name,library);
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC2(Assets_obj,registerLibrary,(void))
::Class Assets_obj::resolveClass( ::String name){
HX_STACK_PUSH("Assets::resolveClass","openfl/Assets.hx",1007);
HX_STACK_ARG(name,"name");
HX_STACK_LINE(1007)
return ::Type_obj::resolveClass(name);
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,resolveClass,return )
::Enum Assets_obj::resolveEnum( ::String name){
HX_STACK_PUSH("Assets::resolveEnum","openfl/Assets.hx",1014);
HX_STACK_ARG(name,"name");
HX_STACK_LINE(1016)
::Enum value = ::Type_obj::resolveEnum(name); HX_STACK_VAR(value,"value");
HX_STACK_LINE(1028)
return value;
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,resolveEnum,return )
Void Assets_obj::unloadLibrary( ::String name){
{
HX_STACK_PUSH("Assets::unloadLibrary","openfl/Assets.hx",1033);
HX_STACK_ARG(name,"name");
HX_STACK_LINE(1035)
::openfl::Assets_obj::initialize();
HX_STACK_LINE(1039)
Dynamic keys = ::openfl::Assets_obj::cache->bitmapData->keys(); HX_STACK_VAR(keys,"keys");
HX_STACK_LINE(1041)
for(::cpp::FastIterator_obj< ::String > *__it = ::cpp::CreateFastIterator< ::String >(keys); __it->hasNext(); ){
::String key = __it->next();
{
HX_STACK_LINE(1043)
::String libraryName = key.substring((int)0,key.indexOf(HX_CSTRING(":"),null())); HX_STACK_VAR(libraryName,"libraryName");
HX_STACK_LINE(1044)
::String symbolName = key.substr((key.indexOf(HX_CSTRING(":"),null()) + (int)1),null()); HX_STACK_VAR(symbolName,"symbolName");
HX_STACK_LINE(1046)
if (((libraryName == name))){
HX_STACK_LINE(1046)
::openfl::Assets_obj::cache->bitmapData->remove(key);
}
}
;
}
HX_STACK_LINE(1054)
::openfl::Assets_obj::libraries->remove(name);
}
return null();
}
STATIC_HX_DEFINE_DYNAMIC_FUNC1(Assets_obj,unloadLibrary,(void))
Assets_obj::Assets_obj()
{
}
void Assets_obj::__Mark(HX_MARK_PARAMS)
{
HX_MARK_BEGIN_CLASS(Assets);
HX_MARK_END_CLASS();
}
void Assets_obj::__Visit(HX_VISIT_PARAMS)
{
}
Dynamic Assets_obj::__Field(const ::String &inName,bool inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"cache") ) { return cache; }
break;
case 6:
if (HX_FIELD_EQ(inName,"exists") ) { return exists_dyn(); }
break;
case 7:
if (HX_FIELD_EQ(inName,"getFont") ) { return getFont_dyn(); }
if (HX_FIELD_EQ(inName,"getPath") ) { return getPath_dyn(); }
if (HX_FIELD_EQ(inName,"getText") ) { return getText_dyn(); }
if (HX_FIELD_EQ(inName,"isLocal") ) { return isLocal_dyn(); }
break;
case 8:
if (HX_FIELD_EQ(inName,"getBytes") ) { return getBytes_dyn(); }
if (HX_FIELD_EQ(inName,"getMusic") ) { return getMusic_dyn(); }
if (HX_FIELD_EQ(inName,"getSound") ) { return getSound_dyn(); }
if (HX_FIELD_EQ(inName,"loadFont") ) { return loadFont_dyn(); }
if (HX_FIELD_EQ(inName,"loadText") ) { return loadText_dyn(); }
break;
case 9:
if (HX_FIELD_EQ(inName,"libraries") ) { return libraries; }
if (HX_FIELD_EQ(inName,"loadBytes") ) { return loadBytes_dyn(); }
if (HX_FIELD_EQ(inName,"loadMusic") ) { return loadMusic_dyn(); }
if (HX_FIELD_EQ(inName,"loadSound") ) { return loadSound_dyn(); }
break;
case 10:
if (HX_FIELD_EQ(inName,"getLibrary") ) { return getLibrary_dyn(); }
if (HX_FIELD_EQ(inName,"initialize") ) { return initialize_dyn(); }
break;
case 11:
if (HX_FIELD_EQ(inName,"initialized") ) { return initialized; }
if (HX_FIELD_EQ(inName,"loadLibrary") ) { return loadLibrary_dyn(); }
if (HX_FIELD_EQ(inName,"resolveEnum") ) { return resolveEnum_dyn(); }
break;
case 12:
if (HX_FIELD_EQ(inName,"getMovieClip") ) { return getMovieClip_dyn(); }
if (HX_FIELD_EQ(inName,"isValidSound") ) { return isValidSound_dyn(); }
if (HX_FIELD_EQ(inName,"resolveClass") ) { return resolveClass_dyn(); }
break;
case 13:
if (HX_FIELD_EQ(inName,"getBitmapData") ) { return getBitmapData_dyn(); }
if (HX_FIELD_EQ(inName,"loadMovieClip") ) { return loadMovieClip_dyn(); }
if (HX_FIELD_EQ(inName,"unloadLibrary") ) { return unloadLibrary_dyn(); }
break;
case 14:
if (HX_FIELD_EQ(inName,"loadBitmapData") ) { return loadBitmapData_dyn(); }
break;
case 15:
if (HX_FIELD_EQ(inName,"registerLibrary") ) { return registerLibrary_dyn(); }
break;
case 17:
if (HX_FIELD_EQ(inName,"isValidBitmapData") ) { return isValidBitmapData_dyn(); }
}
return super::__Field(inName,inCallProp);
}
Dynamic Assets_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"cache") ) { cache=inValue.Cast< ::openfl::AssetCache >(); return inValue; }
break;
case 9:
if (HX_FIELD_EQ(inName,"libraries") ) { libraries=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
break;
case 11:
if (HX_FIELD_EQ(inName,"initialized") ) { initialized=inValue.Cast< bool >(); return inValue; }
}
return super::__SetField(inName,inValue,inCallProp);
}
void Assets_obj::__GetFields(Array< ::String> &outFields)
{
super::__GetFields(outFields);
};
static ::String sStaticFields[] = {
HX_CSTRING("cache"),
HX_CSTRING("libraries"),
HX_CSTRING("initialized"),
HX_CSTRING("exists"),
HX_CSTRING("getBitmapData"),
HX_CSTRING("getBytes"),
HX_CSTRING("getFont"),
HX_CSTRING("getLibrary"),
HX_CSTRING("getMovieClip"),
HX_CSTRING("getMusic"),
HX_CSTRING("getPath"),
HX_CSTRING("getSound"),
HX_CSTRING("getText"),
HX_CSTRING("initialize"),
HX_CSTRING("isLocal"),
HX_CSTRING("isValidBitmapData"),
HX_CSTRING("isValidSound"),
HX_CSTRING("loadBitmapData"),
HX_CSTRING("loadBytes"),
HX_CSTRING("loadFont"),
HX_CSTRING("loadLibrary"),
HX_CSTRING("loadMusic"),
HX_CSTRING("loadMovieClip"),
HX_CSTRING("loadSound"),
HX_CSTRING("loadText"),
HX_CSTRING("registerLibrary"),
HX_CSTRING("resolveClass"),
HX_CSTRING("resolveEnum"),
HX_CSTRING("unloadLibrary"),
String(null()) };
static ::String sMemberFields[] = {
String(null()) };
static void sMarkStatics(HX_MARK_PARAMS) {
HX_MARK_MEMBER_NAME(Assets_obj::__mClass,"__mClass");
HX_MARK_MEMBER_NAME(Assets_obj::cache,"cache");
HX_MARK_MEMBER_NAME(Assets_obj::libraries,"libraries");
HX_MARK_MEMBER_NAME(Assets_obj::initialized,"initialized");
};
static void sVisitStatics(HX_VISIT_PARAMS) {
HX_VISIT_MEMBER_NAME(Assets_obj::__mClass,"__mClass");
HX_VISIT_MEMBER_NAME(Assets_obj::cache,"cache");
HX_VISIT_MEMBER_NAME(Assets_obj::libraries,"libraries");
HX_VISIT_MEMBER_NAME(Assets_obj::initialized,"initialized");
};
Class Assets_obj::__mClass;
void Assets_obj::__register()
{
hx::Static(__mClass) = hx::RegisterClass(HX_CSTRING("openfl.Assets"), hx::TCanCast< Assets_obj> ,sStaticFields,sMemberFields,
&__CreateEmpty, &__Create,
&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}
void Assets_obj::__boot()
{
cache= ::openfl::AssetCache_obj::__new();
libraries= ::haxe::ds::StringMap_obj::__new();
initialized= false;
}
} // end namespace openfl
| 37.265123
| 249
| 0.698846
|
DrSkipper
|
78d3b7b5ced8d20e58ed950c2bc7bdb888d2bd1d
| 2,296
|
cpp
|
C++
|
src/goto-instrument/show_locations.cpp
|
dan-blank/yogar-cbmc
|
05b4f056b585b65828acf39546c866379dca6549
|
[
"MIT"
] | 1
|
2017-07-25T02:44:56.000Z
|
2017-07-25T02:44:56.000Z
|
src/goto-instrument/show_locations.cpp
|
dan-blank/yogar-cbmc
|
05b4f056b585b65828acf39546c866379dca6549
|
[
"MIT"
] | 1
|
2017-02-22T14:35:19.000Z
|
2017-02-27T08:49:58.000Z
|
src/goto-instrument/show_locations.cpp
|
dan-blank/yogar-cbmc
|
05b4f056b585b65828acf39546c866379dca6549
|
[
"MIT"
] | 4
|
2019-01-19T03:32:21.000Z
|
2021-12-20T14:25:19.000Z
|
/*******************************************************************\
Module: Show program locations
Author: Daniel Kroening, kroening@kroening.com
\*******************************************************************/
#include <iostream>
#include <util/xml.h>
#include <util/i2string.h>
#include <util/xml_irep.h>
#include <langapi/language_util.h>
#include "show_locations.h"
/*******************************************************************\
Function: show_locations
Inputs:
Outputs:
Purpose:
\*******************************************************************/
void show_locations(
ui_message_handlert::uit ui,
const irep_idt function_id,
const goto_programt &goto_program)
{
for(goto_programt::instructionst::const_iterator
it=goto_program.instructions.begin();
it!=goto_program.instructions.end();
it++)
{
const source_locationt &source_location=it->source_location;
switch(ui)
{
case ui_message_handlert::XML_UI:
{
xmlt xml("program_location");
xml.new_element("function").data=id2string(function_id);
xml.new_element("id").data=i2string(it->location_number);
xmlt &l=xml.new_element();
l.name="location";
l.new_element("line").data=id2string(source_location.get_line());
l.new_element("file").data=id2string(source_location.get_file());
l.new_element("function").data=id2string(source_location.get_function());
std::cout << xml << std::endl;
}
break;
case ui_message_handlert::PLAIN:
std::cout << function_id << " "
<< it->location_number << " "
<< it->source_location << std::endl;
break;
default:
assert(false);
}
}
}
/*******************************************************************\
Function: show_locations
Inputs:
Outputs:
Purpose:
\*******************************************************************/
void show_locations(
ui_message_handlert::uit ui,
const goto_functionst &goto_functions)
{
for(goto_functionst::function_mapt::const_iterator
it=goto_functions.function_map.begin();
it!=goto_functions.function_map.end();
it++)
show_locations(ui, it->first, it->second.body);
}
| 23.916667
| 81
| 0.533101
|
dan-blank
|
78d7b2a7f0b748358776c03a9b2b14c2327b889e
| 1,283
|
cpp
|
C++
|
src/editor/windows/material_properties.cpp
|
tksuoran/erhe
|
07d1ea014e1675f6b09bff0d9d4f3568f187e0d8
|
[
"Apache-2.0"
] | 36
|
2021-05-03T10:47:49.000Z
|
2022-03-19T12:54:03.000Z
|
src/editor/windows/material_properties.cpp
|
tksuoran/erhe
|
07d1ea014e1675f6b09bff0d9d4f3568f187e0d8
|
[
"Apache-2.0"
] | 29
|
2020-05-17T08:26:31.000Z
|
2022-03-27T08:52:47.000Z
|
src/editor/windows/material_properties.cpp
|
tksuoran/erhe
|
07d1ea014e1675f6b09bff0d9d4f3568f187e0d8
|
[
"Apache-2.0"
] | 2
|
2022-01-24T09:24:37.000Z
|
2022-01-31T20:45:36.000Z
|
#include "windows/material_properties.hpp"
#include "editor_tools.hpp"
#include "windows/materials.hpp"
#include "erhe/primitive/material.hpp"
#include <imgui.h>
#include <imgui/misc/cpp/imgui_stdlib.h>
namespace editor
{
Material_properties::Material_properties()
: erhe::components::Component{c_name}
, Imgui_window {c_title}
{
}
Material_properties::~Material_properties() = default;
void Material_properties::connect()
{
m_materials = get<Materials>();
}
void Material_properties::initialize_component()
{
get<Editor_tools>()->register_imgui_window(this);
}
void Material_properties::imgui()
{
if (m_materials == nullptr)
{
return;
}
{
const auto selected_material = m_materials->selected_material();
if (selected_material)
{
ImGui::InputText("Name", &selected_material->name);
ImGui::SliderFloat("Metallic", &selected_material->metallic, 0.0f, 1.0f);
ImGui::SliderFloat("Anisotropy", &selected_material->anisotropy, -1.0f, 1.0f);
ImGui::SliderFloat("Roughness", &selected_material->roughness, 0.0f, 1.0f);
ImGui::ColorEdit4 ("Base Color", &selected_material->base_color.x, ImGuiColorEditFlags_Float);
}
}
}
}
| 24.207547
| 106
| 0.667186
|
tksuoran
|
78e125fb8e7f6eaeebe16d607e63a24ea6e7d400
| 884
|
hpp
|
C++
|
src/engine/graphics/opengl/gl_framebuffer.hpp
|
Overpeek/Overpeek-Engine
|
3df11072378ba870033a19cd09fb332bcc4c466d
|
[
"MIT"
] | 13
|
2020-01-10T16:36:46.000Z
|
2021-08-09T09:24:47.000Z
|
src/engine/graphics/opengl/gl_framebuffer.hpp
|
Overpeek/Overpeek-Engine
|
3df11072378ba870033a19cd09fb332bcc4c466d
|
[
"MIT"
] | 1
|
2020-01-16T11:03:49.000Z
|
2020-01-16T11:11:15.000Z
|
src/engine/graphics/opengl/gl_framebuffer.hpp
|
Overpeek/Overpeek-Engine
|
3df11072378ba870033a19cd09fb332bcc4c466d
|
[
"MIT"
] | 1
|
2020-02-06T21:22:47.000Z
|
2020-02-06T21:22:47.000Z
|
#pragma once
#include "engine/graphics/interface/framebuffer.hpp"
#include "engine/graphics/opengl/gl_texture.hpp"
#include "engine/internal_libs.hpp"
namespace oe::graphics
{
class GLFrameBuffer : public IFrameBuffer
{
private:
// uint32_t m_rbo;
uint32_t m_id;
Texture m_texture;
public:
static uint32_t bound_fbo_id;
static glm::ivec4 current_viewport;
static glm::ivec2 gl_max_fb_size;
static void bind_fb(uint32_t fb_id, const glm::ivec4& viewport);
public:
GLFrameBuffer(const FrameBufferInfo& framebuffer_info);
~GLFrameBuffer() override;
void bind() override;
void clear(const oe::color& c = oe::colors::clear_color) override;
static std::unique_ptr<state> save_state();
static void load_state(const std::unique_ptr<state>&);
inline Texture& getTexture() override { return m_texture; }
};
}
| 22.666667
| 69
| 0.713801
|
Overpeek
|
78e29276d916c0660539ffc9eed806e18eed0da3
| 547
|
cpp
|
C++
|
cozybirdFX/PhysicsSystem.cpp
|
HenryLoo/cozybirdFX
|
0ef522d9a8304c190c8a586a4de6452c6bc9edfe
|
[
"BSD-3-Clause"
] | null | null | null |
cozybirdFX/PhysicsSystem.cpp
|
HenryLoo/cozybirdFX
|
0ef522d9a8304c190c8a586a4de6452c6bc9edfe
|
[
"BSD-3-Clause"
] | null | null | null |
cozybirdFX/PhysicsSystem.cpp
|
HenryLoo/cozybirdFX
|
0ef522d9a8304c190c8a586a4de6452c6bc9edfe
|
[
"BSD-3-Clause"
] | null | null | null |
#include "PhysicsSystem.h"
namespace
{
const unsigned long COMPONENTS_MASK
{
ECSComponent::COMPONENT_POSITION |
ECSComponent::COMPONENT_VELOCITY
};
}
PhysicsSystem::PhysicsSystem(EntityManager &manager,
std::vector<ECSComponent::Position> &positions,
std::vector<ECSComponent::Velocity> &velocities) :
ECSSystem(manager, COMPONENTS_MASK), m_positions(positions),
m_velocities(velocities)
{
}
void PhysicsSystem::updateEntity(int entityId, float deltaTime)
{
m_positions[entityId].xyz += m_velocities[entityId].xyz * deltaTime;
}
| 21.88
| 69
| 0.778793
|
HenryLoo
|
78e37417d11be59453acc52ad910dac5136c603e
| 4,257
|
cpp
|
C++
|
Game/GameConfig.cpp
|
michalzaw/vbcpp
|
911896898d2cbf6a223e3552801c5207e0c2aef2
|
[
"MIT"
] | 9
|
2020-06-09T20:43:35.000Z
|
2022-02-23T17:45:44.000Z
|
Game/GameConfig.cpp
|
michalzaw/vbcpp-fork
|
8b972e8debf825173c001f99fe43f92e9b548384
|
[
"MIT"
] | null | null | null |
Game/GameConfig.cpp
|
michalzaw/vbcpp-fork
|
8b972e8debf825173c001f99fe43f92e9b548384
|
[
"MIT"
] | 1
|
2021-01-04T14:01:12.000Z
|
2021-01-04T14:01:12.000Z
|
#include "GameConfig.h"
#include "../Utils/Strings.h"
void GameConfig::loadGameConfig(const char* filename)
{
XMLDocument doc;
doc.LoadFile(filename);
XMLElement* objElement = doc.FirstChildElement("Game");
for (XMLElement* child = objElement->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
{
const char* ename = child->Name();
if (strcmp(ename,"Resolution") == 0)
{
const char* cWidth = child->Attribute("x");
const char* cHeight = child->Attribute("y");
windowWidth = (int)atoi(cWidth);
windowHeight = (int)atoi(cHeight);
}
else
if (strcmp(ename,"Map") == 0)
{
mapFile = std::string(child->Attribute("name"));
}
else
if (strcmp(ename,"Bus") == 0)
{
busModel = std::string(child->Attribute("model"));
}
else
if (strcmp(ename,"Configuration") == 0)
{
for (XMLElement* configElement = child->FirstChildElement(); configElement != NULL; configElement = configElement->NextSiblingElement())
{
const char* ename = configElement->Name();
if (strcmp(ename,"Fullscreen") == 0)
{
isFullscreen = toBool(configElement->GetText());
}
if (strcmp(ename, "VerticalSync") == 0)
{
verticalSync = toBool(configElement->GetText());
}
else if (strcmp(ename, "HdrQuality") == 0)
{
hdrQuality = toInt(configElement->GetText());
}
else if (strcmp(ename,"MsaaAntialiasing") == 0)
{
msaaAntialiasing = toBool(configElement->GetText());
}
else if (strcmp(ename,"MsaaAntialiasingLevel") == 0)
{
msaaAntialiasingLevel = toInt(configElement->GetText());
}
else if (strcmp(ename,"Shadowmapping") == 0)
{
isShadowmappingEnable = toBool(configElement->GetText());
}
else if (strcmp(ename,"ShadowmapSize") == 0)
{
shadowmapSize = toInt(configElement->GetText());
}
else if (strcmp(ename, "StaticShadowmapSize") == 0)
{
staticShadowmapSize = toInt(configElement->GetText());
}
else if (strcmp(ename,"Bloom") == 0)
{
isBloomEnabled = toBool(configElement->GetText());
}
else if (strcmp(ename,"Grass") == 0)
{
isGrassEnable = toBool(configElement->GetText());
}
else if (strcmp(ename, "GrassRenderingDistance") == 0)
{
grassRenderingDistance = toFloat(configElement->GetText());
}
else if (strcmp(ename, "Mirrors") == 0)
{
isMirrorsEnabled = toBool(configElement->GetText());
}
else if (strcmp(ename, "MirrorRenderingDistance") == 0)
{
mirrorRenderingDistance = toFloat(configElement->GetText());
}
else if (strcmp(ename, "TextureCompression") == 0)
{
textureCompression = toBool(configElement->GetText());
}
else if (strcmp(ename, "AnisotropicFiltering") == 0)
{
anisotropicFiltering = toBool(configElement->GetText());
}
else if (strcmp(ename, "AnisotropySamples") == 0)
{
anisotropySamples = toFloat(configElement->GetText());
}
else if (strcmp(ename, "PbrSupport") == 0)
{
pbrSupport = toBool(configElement->GetText());
}
}
}
}
}
void GameConfig::loadDevelopmentConfig(const char* filename)
{
XMLDocument doc;
doc.LoadFile(filename);
XMLElement* objElement = doc.FirstChildElement("DevSettings");
for (XMLElement* child = objElement->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
{
const char* ename = child->Name();
if (strcmp(ename, "alternativeResourcesPath") == 0)
{
alternativeResourcesPath = std::string(child->GetText());
}
else if (strcmp(ename, "developmentMode") == 0)
{
developmentMode = toBool(child->GetText());
}
}
}
GameConfig* GameConfig::instance = NULL;
| 30.407143
| 148
| 0.554851
|
michalzaw
|
78e4fc875cf757a4ccb9ccb3d300ecd051d72e3d
| 2,654
|
hpp
|
C++
|
inference-engine/thirdparty/clDNN/api/topology.hpp
|
ElenaGvozdeva/openvino
|
084aa4e5916fa2ed3e353dcd45d081ab11d9c75a
|
[
"Apache-2.0"
] | 1
|
2022-02-10T08:05:09.000Z
|
2022-02-10T08:05:09.000Z
|
inference-engine/thirdparty/clDNN/api/topology.hpp
|
ElenaGvozdeva/openvino
|
084aa4e5916fa2ed3e353dcd45d081ab11d9c75a
|
[
"Apache-2.0"
] | 40
|
2020-12-04T07:46:57.000Z
|
2022-02-21T13:04:40.000Z
|
inference-engine/thirdparty/clDNN/api/topology.hpp
|
ElenaGvozdeva/openvino
|
084aa4e5916fa2ed3e353dcd45d081ab11d9c75a
|
[
"Apache-2.0"
] | 1
|
2020-07-22T15:53:40.000Z
|
2020-07-22T15:53:40.000Z
|
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <cstdint>
#include "cldnn.hpp"
#include "compounds.h"
#include "primitive.hpp"
#include <vector>
#include <memory>
namespace cldnn {
/// @addtogroup cpp_api C++ API
/// @{
/// @defgroup cpp_topology Network Topology
/// @{
struct topology_impl;
/// @brief Network topology to be defined by user.
struct topology {
/// @brief Constructs empty network topology.
topology();
/// @brief Constructs topology containing primitives provided in argument(s).
template <class... Args>
explicit topology(const Args&... args) : topology() {
add<Args...>(args...);
}
/// @brief Copy construction.
topology(const topology& other) : _impl(other._impl) { retain(); }
/// @brief Copy assignment.
topology& operator=(const topology& other) {
if (_impl == other._impl)
return *this;
release();
_impl = other._impl;
retain();
return *this;
}
/// Construct C++ topology based on C API @p cldnn_topology
explicit topology(topology_impl* other) : _impl(other) {
if (_impl == nullptr)
throw std::invalid_argument("implementation pointer should not be null");
}
/// @brief Releases wrapped C API @ref cldnn_topology.
~topology() { release(); }
friend bool operator==(const topology& lhs, const topology& rhs) { return lhs._impl == rhs._impl; }
friend bool operator!=(const topology& lhs, const topology& rhs) { return !(lhs == rhs); }
void add_primitive(std::shared_ptr<primitive> desc);
/// @brief Adds a primitive to topology.
template <class PType>
void add(PType const& desc) {
add_primitive(std::static_pointer_cast<primitive>(std::make_shared<PType>(desc)));
}
/// @brief Adds primitives to topology.
template <class PType, class... Args>
void add(PType const& desc, Args const&... args) {
add(desc);
add<Args...>(args...);
}
/// @brief Returns wrapped implementation pointer.
topology_impl* get() const { return _impl; }
const std::vector<primitive_id> get_primitive_ids() const;
void change_input_layout(primitive_id id, const layout& new_layout);
const std::shared_ptr<primitive>& at(const primitive_id& id) const;
private:
friend struct engine;
friend struct network;
topology_impl* _impl;
void retain();
void release();
};
CLDNN_API_CLASS(topology)
/// @}
/// @}
} // namespace cldnn
| 27.360825
| 103
| 0.621326
|
ElenaGvozdeva
|
78e750c3d49ef9e408e0d33a1cadfbf2226d4852
| 8,256
|
cpp
|
C++
|
src/jit-dynamic.cpp
|
eponymous/libjit-python
|
ded363a1ceaee60b622946a34769f70cd434b694
|
[
"BSD-2-Clause"
] | 1
|
2019-04-25T03:24:56.000Z
|
2019-04-25T03:24:56.000Z
|
src/jit-dynamic.cpp
|
eponymous/libjit-python
|
ded363a1ceaee60b622946a34769f70cd434b694
|
[
"BSD-2-Clause"
] | null | null | null |
src/jit-dynamic.cpp
|
eponymous/libjit-python
|
ded363a1ceaee60b622946a34769f70cd434b694
|
[
"BSD-2-Clause"
] | null | null | null |
/*
Copyright (c) 2016, Dan Eicher
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "jit-module.h"
#include <jit/jit-dynamic.h>
typedef struct {
PyObject_HEAD
jit_dynlib_handle_t obj;
} PyJit_dynlib_handle;
extern PyTypeObject PyJit_dynlib_handle_Type;
static PyObject *
PyJit_dynamic_set_debug(PyObject * UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
PyObject *py_flag;
const char *keywords[] = {"flag", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O:set_debug", (char **) keywords, &py_flag)) {
return NULL;
}
jit_dynlib_set_debug(PyObject_IsTrue(py_flag));
Py_RETURN_NONE;
}
static PyObject *
PyJit_dynamic_get_suffix()
{
return Py_BuildValue((char *) "s", jit_dynlib_get_suffix());
}
static PyMethodDef jit_dynamic_functions[] = {
{(char *) "set_debug", (PyCFunction) PyJit_dynamic_set_debug, METH_KEYWORDS|METH_VARARGS, NULL },
{(char *) "get_suffix", (PyCFunction) PyJit_dynamic_get_suffix, METH_NOARGS, NULL },
{NULL, NULL, 0, NULL}
};
static PyObject *
PyJit__dynamic_get_symbol(PyJit_dynlib_handle *self, PyObject *args, PyObject *kwargs)
{
char const *name;
const char *keywords[] = {"name", NULL};
void *symbol;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s:get_symbol", (char **) keywords, &name)) {
return NULL;
}
if ((symbol = jit_dynlib_get_symbol(self->obj, name)) == NULL) {
PyErr_Format(PyExc_ValueError, "symbol '%s' not found", name);
return NULL;
}
return PyLong_FromVoidPtr(symbol);
}
static PyMethodDef PyJit_dynlib_handle_methods[] = {
{(char *) "get_symbol", (PyCFunction) PyJit__dynamic_get_symbol, METH_KEYWORDS|METH_VARARGS, NULL },
{NULL, NULL, 0, NULL}
};
static int
PyJit_dynlib_handle__tp_init(PyJit_dynlib_handle *self, PyObject *args, PyObject *kwargs)
{
char const *name;
const char *keywords[] = {"name", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s", (char **) keywords, &name)) {
return -1;
}
self->obj = jit_dynlib_open(name);
if (self->obj == NULL) {
PyErr_Format(PyExc_ValueError, "unable to open library '%s'", name);
return -1;
}
return 0;
}
static void
PyJit_dynlib_handle__tp_dealloc(PyJit_dynlib_handle *self)
{
jit_dynlib_handle_t tmp = self->obj;
self->obj = NULL;
if (tmp) {
jit_dynlib_close(tmp);
}
Py_TYPE(self)->tp_free((PyObject*)self);
}
PyTypeObject PyJit_dynlib_handle_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
(char *) "jit.dynamic.Library", /* tp_name */
sizeof(PyJit_dynlib_handle), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)PyJit_dynlib_handle__tp_dealloc, /* tp_dealloc */
(printfunc)0, /* tp_print */
(getattrfunc)NULL, /* tp_getattr */
(setattrfunc)NULL, /* tp_setattr */
(cmpfunc)NULL, /* tp_compare */
(reprfunc)NULL, /* tp_repr */
(PyNumberMethods*)NULL, /* tp_as_number */
(PySequenceMethods*)NULL, /* tp_as_sequence */
(PyMappingMethods*)NULL, /* tp_as_mapping */
(hashfunc)NULL, /* tp_hash */
(ternaryfunc)NULL, /* tp_call */
(reprfunc)NULL, /* tp_str */
(getattrofunc)NULL, /* tp_getattro */
(setattrofunc)NULL, /* tp_setattro */
(PyBufferProcs*)NULL, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
NULL, /* Documentation string */
(traverseproc)NULL, /* tp_traverse */
(inquiry)NULL, /* tp_clear */
(richcmpfunc)NULL, /* tp_richcompare */
0, /* tp_weaklistoffset */
(getiterfunc)NULL, /* tp_iter */
(iternextfunc)NULL, /* tp_iternext */
(struct PyMethodDef*)PyJit_dynlib_handle_methods, /* tp_methods */
(struct PyMemberDef*)0, /* tp_members */
0, /* tp_getset */
NULL, /* tp_base */
NULL, /* tp_dict */
(descrgetfunc)NULL, /* tp_descr_get */
(descrsetfunc)NULL, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PyJit_dynlib_handle__tp_init, /* tp_init */
(allocfunc)PyType_GenericAlloc, /* tp_alloc */
(newfunc)PyType_GenericNew, /* tp_new */
(freefunc)0, /* tp_free */
(inquiry)NULL, /* tp_is_gc */
NULL, /* tp_bases */
NULL, /* tp_mro */
NULL, /* tp_cache */
NULL, /* tp_subclasses */
NULL, /* tp_weaklist */
(destructor) NULL /* tp_del */
};
#if PY_VERSION_HEX >= 0x03000000
static struct PyModuleDef jit_dynamic_moduledef = {
PyModuleDef_HEAD_INIT,
"jit.dynamic",
NULL,
-1,
jit_dynamic_functions,
};
#endif
PyObject *
initjit_dynamic(void)
{
PyObject *m;
#if PY_VERSION_HEX >= 0x03000000
m = PyModule_Create(&jit_dynamic_moduledef);
#else
m = Py_InitModule3((char *) "jit.dynamic", jit_dynamic_functions, NULL);
#endif
if (m == NULL) {
return NULL;
}
/* Register the 'jit_dynlib_handle_t' class */
if (PyType_Ready(&PyJit_dynlib_handle_Type)) {
return NULL;
}
PyModule_AddObject(m, (char *) "Library", (PyObject *) &PyJit_dynlib_handle_Type);
return m;
}
| 40.273171
| 107
| 0.518653
|
eponymous
|
78e96470c9e43a2889e44f7dcb6ccff4520e904d
| 4,798
|
cpp
|
C++
|
modules/spaint/src/sampling/cpu/PerLabelVoxelSampler_CPU.cpp
|
GucciPrada/spaint
|
b09ff1ec0d9e123cf316f2737e1b70b5ecc0beea
|
[
"Unlicense"
] | 1
|
2019-05-16T06:39:21.000Z
|
2019-05-16T06:39:21.000Z
|
modules/spaint/src/sampling/cpu/PerLabelVoxelSampler_CPU.cpp
|
GucciPrada/spaint
|
b09ff1ec0d9e123cf316f2737e1b70b5ecc0beea
|
[
"Unlicense"
] | null | null | null |
modules/spaint/src/sampling/cpu/PerLabelVoxelSampler_CPU.cpp
|
GucciPrada/spaint
|
b09ff1ec0d9e123cf316f2737e1b70b5ecc0beea
|
[
"Unlicense"
] | null | null | null |
/**
* spaint: PerLabelVoxelSampler_CPU.cpp
* Copyright (c) Torr Vision Group, University of Oxford, 2015. All rights reserved.
*/
#include "sampling/cpu/PerLabelVoxelSampler_CPU.h"
#include "sampling/shared/PerLabelVoxelSampler_Shared.h"
namespace spaint {
//#################### CONSTRUCTORS ####################
PerLabelVoxelSampler_CPU::PerLabelVoxelSampler_CPU(size_t maxLabelCount, size_t maxVoxelsPerLabel, int raycastResultSize, unsigned int seed)
: PerLabelVoxelSampler(maxLabelCount, maxVoxelsPerLabel, raycastResultSize, seed)
{}
//#################### PRIVATE MEMBER FUNCTIONS ####################
void PerLabelVoxelSampler_CPU::calculate_voxel_mask_prefix_sums(const ORUtils::MemoryBlock<bool>& labelMaskMB) const
{
const bool *labelMask = labelMaskMB.GetData(MEMORYDEVICE_CPU);
const unsigned char *voxelMasks = m_voxelMasksMB->GetData(MEMORYDEVICE_CPU);
unsigned int *voxelMaskPrefixSums = m_voxelMaskPrefixSumsMB->GetData(MEMORYDEVICE_CPU);
// For each possible label:
const int stride = m_raycastResultSize + 1;
for(size_t k = 0; k < m_maxLabelCount; ++k)
{
// If the label is not currently in use, continue.
if(!labelMask[k]) continue;
// Calculate the prefix sum of the voxel mask.
const size_t offset = k * stride;
voxelMaskPrefixSums[offset] = 0;
for(int i = 1; i < stride; ++i)
{
voxelMaskPrefixSums[offset + i] = voxelMaskPrefixSums[offset + (i - 1)] + voxelMasks[offset + (i - 1)];
}
}
}
void PerLabelVoxelSampler_CPU::calculate_voxel_masks(const ITMFloat4Image *raycastResult,
const SpaintVoxel *voxelData,
const ITMVoxelIndex::IndexData *indexData) const
{
const Vector4f *raycastResultData = raycastResult->GetData(MEMORYDEVICE_CPU);
unsigned char *voxelMasks = m_voxelMasksMB->GetData(MEMORYDEVICE_CPU);
#ifdef WITH_OPENMP
#pragma omp parallel for
#endif
for(int voxelIndex = 0; voxelIndex < m_raycastResultSize; ++voxelIndex)
{
// Update the voxel masks based on the contents of the voxel.
update_masks_for_voxel(
voxelIndex,
raycastResultData,
m_raycastResultSize,
voxelData,
indexData,
m_maxLabelCount,
voxelMasks
);
}
}
void PerLabelVoxelSampler_CPU::write_candidate_voxel_counts(const ORUtils::MemoryBlock<bool>& labelMaskMB,
ORUtils::MemoryBlock<unsigned int>& voxelCountsForLabelsMB) const
{
const bool *labelMask = labelMaskMB.GetData(MEMORYDEVICE_CPU);
const unsigned int *voxelMaskPrefixSums = m_voxelMaskPrefixSumsMB->GetData(MEMORYDEVICE_CPU);
unsigned int *voxelCountsForLabels = voxelCountsForLabelsMB.GetData(MEMORYDEVICE_CPU);
#ifdef WITH_OPENMP
#pragma omp parallel for
#endif
for(int k = 0; k < static_cast<int>(m_maxLabelCount); ++k)
{
write_candidate_voxel_count(k, m_raycastResultSize, labelMask, voxelMaskPrefixSums, voxelCountsForLabels);
}
}
void PerLabelVoxelSampler_CPU::write_candidate_voxel_locations(const ITMFloat4Image *raycastResult) const
{
const Vector4f *raycastResultData = raycastResult->GetData(MEMORYDEVICE_CPU);
const unsigned char *voxelMasks = m_voxelMasksMB->GetData(MEMORYDEVICE_CPU);
const unsigned int *voxelMaskPrefixSums = m_voxelMaskPrefixSumsMB->GetData(MEMORYDEVICE_CPU);
Vector3s *candidateVoxelLocations = m_candidateVoxelLocationsMB->GetData(MEMORYDEVICE_CPU);
#ifdef WITH_OPENMP
#pragma omp parallel for
#endif
for(int voxelIndex = 0; voxelIndex < m_raycastResultSize; ++voxelIndex)
{
write_candidate_voxel_location(
voxelIndex,
raycastResultData,
m_raycastResultSize,
voxelMasks,
voxelMaskPrefixSums,
m_maxLabelCount,
candidateVoxelLocations
);
}
}
void PerLabelVoxelSampler_CPU::write_sampled_voxel_locations(const ORUtils::MemoryBlock<bool>& labelMaskMB,
ORUtils::MemoryBlock<Vector3s>& sampledVoxelLocationsMB) const
{
const Vector3s *candidateVoxelLocations = m_candidateVoxelLocationsMB->GetData(MEMORYDEVICE_CPU);
const int *candidateVoxelIndices = m_candidateVoxelIndicesMB->GetData(MEMORYDEVICE_CPU);
const bool *labelMask = labelMaskMB.GetData(MEMORYDEVICE_CPU);
Vector3s *sampledVoxelLocations = sampledVoxelLocationsMB.GetData(MEMORYDEVICE_CPU);
#ifdef WITH_OPENMP
#pragma omp parallel for
#endif
for(int voxelIndex = 0; voxelIndex < static_cast<int>(m_maxVoxelsPerLabel); ++voxelIndex)
{
copy_sampled_voxel_locations(
voxelIndex,
labelMask,
m_maxLabelCount,
m_maxVoxelsPerLabel,
m_raycastResultSize,
candidateVoxelLocations,
candidateVoxelIndices,
sampledVoxelLocations
);
}
}
}
| 35.540741
| 140
| 0.717799
|
GucciPrada
|
78ef66820933b7e1972d9596aee1bcf05a0fe1a3
| 1,401
|
cpp
|
C++
|
src/position.cpp
|
aalin/synthz0r
|
ecf35b3fec39020e46732a15874b66f07a3e48e9
|
[
"MIT"
] | 1
|
2021-12-23T21:14:37.000Z
|
2021-12-23T21:14:37.000Z
|
src/position.cpp
|
aalin/synthz0r
|
ecf35b3fec39020e46732a15874b66f07a3e48e9
|
[
"MIT"
] | null | null | null |
src/position.cpp
|
aalin/synthz0r
|
ecf35b3fec39020e46732a15874b66f07a3e48e9
|
[
"MIT"
] | null | null | null |
#include "position.hpp"
#include <iostream>
#include <regex>
uint32_t Position::parse(const std::string &str) {
const std::regex re("^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$");
std::smatch match;
if (!std::regex_match(str, match, re)) {
throw std::runtime_error("Could not parse string");
}
const uint32_t bar = atoi(match.str(1).c_str());
const uint8_t beat = atoi(match.str(2).c_str());
const uint8_t sixteenths = atoi(match.str(3).c_str());
const uint8_t ticks = atoi(match.str(4).c_str());
return ticksFromPosition(bar, beat, sixteenths, ticks);
}
std::string Position::toString() const {
std::ostringstream oss;
oss <<
"Position(" <<
(uint32_t)bar << "." <<
(uint32_t)beat << "." <<
(uint32_t)sixteenths << "." <<
(uint32_t)ticks << ")";
return oss.str();
}
std::ostream & operator<<(std::ostream &out, const Position &position) {
return out << position.toString();
}
void Position::update(const float &bpm, const float &sampleRate) {
const double ticksPerSecond = (bpm * 4.0 * 240.0) / 60.0;
recalculate(_totalTicks + ticksPerSecond / sampleRate);
}
void Position::recalculate(double newTicks) {
uint32_t previousTicks = _totalTicks;
_totalTicks = newTicks;
uint32_t tmp = newTicks;
ticks = tmp % 240;
tmp /= 240;
sixteenths = tmp % 4;
tmp /= 4;
beat = tmp % 4;
bar = tmp / 4;
_ticksChanged = static_cast<uint32_t>(_totalTicks) != previousTicks;
}
| 23.35
| 72
| 0.656674
|
aalin
|
78efe81c282f4300c9109b8c858f8dc8676ec289
| 12,888
|
cpp
|
C++
|
src/main.cpp
|
hporro/Tarea2GPU
|
68d7a4b01c00710e9c6094dcd627840e93178220
|
[
"MIT"
] | null | null | null |
src/main.cpp
|
hporro/Tarea2GPU
|
68d7a4b01c00710e9c6094dcd627840e93178220
|
[
"MIT"
] | null | null | null |
src/main.cpp
|
hporro/Tarea2GPU
|
68d7a4b01c00710e9c6094dcd627840e93178220
|
[
"MIT"
] | null | null | null |
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <iostream>
#include "Core/Shader.h"
#include "Camera/CenteredCamera.h"
#include "Model.h"
#include "Light.h"
#include "Models/Lamp.h"
#include "Models/Cube.h"
#include "Models/Tetrahedron.h"
#include "Models/Piramid.h"
#include "Models/Sphere.h"
#include "Models/ModelImporter.h"
void global_config();
void framebuffer_size_callback(GLFWwindow* glfWwindow, int width, int height);
void mouse_callback(GLFWwindow* glfWwindow, double xpos, double ypos);
void scroll_callback(GLFWwindow* glfWwindow, double xoffset, double yoffset);
void processInput();
void renderModel();
const unsigned int SCR_WIDTH = 800;
const unsigned int SCR_HEIGHT = 600;
GLFWwindow* window;
float lastX = SCR_WIDTH / 2.0f;
float lastY = SCR_HEIGHT / 2.0f;
bool firstMouse = true;
//Camera
CenteredCamera camera(glm::vec3(0.0f, 0.0f, 0.0f));
//lighting
Light *currLightN, *currLightM;
glm::vec3 lightPos1(0.00001f, -4.0f, 0.0f);
glm::vec3 lightPos2(0.00001f, 0.0f, -4.0f);
Light l1s[4], l2s[4];
//lights and camera movement parameters
float deltaTime = 0.0f; // Time between current frame and last frame
float lastFrame = 0.0f; // Time of last frame
//state machine
bool firstChangeModel = true;
bool firstChangeShader = true;
bool firstChangeLightN = true;
bool firstChangeLightM = true;
int modelRendered = 0;
int shaderRendered = 0;
int lightRenderedN = 0;
int lightRenderedM = 0;
//models
Sphere sphere;
Cube cube;
Piramid piramid;
Tetrahedron tet;
ModelImporter sword;
//Shaders
Shader* currShader;
Shader phongShader;
Shader normalMapShader;
Shader toonShader;
Shader shaders[3];
//project-view matrices
glm::mat4 view;
glm::mat4 projection;
int main() {
global_config();
sphere = Sphere(glm::vec3(0.0,0.0,0.0));
cube = Cube(glm::vec3(0.0,0.0,0.0));
piramid = Piramid(glm::vec3(0.0,0.0,0.0));
tet = Tetrahedron(glm::vec3(0.0,0.0,0.0));
std::string path = "../resources/suzanne.obj";
sword = ModelImporter(glm::vec3(0.0f,0.0f,0.0f),path);
phongShader = Shader("../src/shaders/phong.vert", "../src/shaders/phong.frag");
normalMapShader = Shader("../src/shaders/normalMapping.vert", "../src/shaders/normalMapping.frag");
toonShader = Shader("../src/shaders/toon.vert", "../src/shaders/toon.frag");
shaders[0] = phongShader;
shaders[1] = normalMapShader;
shaders[2] = toonShader;
Texture text = Texture("../resources/tex.jpg",0,GL_RGB);
sphere.addTexture(text,"normalMap");
cube.addTexture(text,"normalMap");
piramid.addTexture(text,"normalMap");
tet.addTexture(text,"normalMap");
sword.addTexture(text,"normalMap");
currShader = &shaders[shaderRendered];
sphere.setShader(*currShader);
cube.setShader(*currShader);
piramid.setShader(*currShader);
tet.setShader(*currShader);
sword.setShader(*currShader);
Lamp lamp1 = Lamp(lightPos1);
Shader lampShader1 = Shader("../src/shaders/vertex.vert", "../src/shaders/brightShader.frag");
lamp1.setShader(lampShader1);
Lamp lamp2 = Lamp(lightPos2);
Shader lampShader2 = Shader("../src/shaders/vertex.vert", "../src/shaders/brightShader.frag");
lamp2.setShader(lampShader2);
l1s[0] = Light(glm::vec3(1.0,1.0,1.0),glm::vec3(0.2f, 0.2f, 0.2f),glm::vec3(0.5f, 0.5f, 0.5f),glm::vec3(0.9f,0.9f,0.9f));
l1s[1] = Light(glm::vec3(0.0,0.0,1.0),glm::vec3(0.0f, 0.0f, 0.2f),glm::vec3(0.0f, 0.0f, 0.5f),glm::vec3(0.0f,0.0f,0.9f));
l1s[2] = Light(glm::vec3(1.0,0.0,0.0),glm::vec3(0.2f, 0.0f, 0.0f),glm::vec3(0.5f, 0.0f, 0.0f),glm::vec3(0.9f,0.0f,0.0f));
l1s[3] = Light(glm::vec3(0.0,1.0,0.0),glm::vec3(0.0f, 0.2f, 0.0f),glm::vec3(0.0f, 0.5f, 0.0f),glm::vec3(0.0f,0.9f,0.0f));
l2s[0] = Light(glm::vec3(1.0,1.0,1.0),glm::vec3(0.2f, 0.2f, 0.2f),glm::vec3(0.5f, 0.5f, 0.5f),glm::vec3(0.9f,0.9f,0.9f));
l2s[1] = Light(glm::vec3(0.0,0.0,1.0),glm::vec3(0.0f, 0.0f, 0.2f),glm::vec3(0.0f, 0.0f, 0.5f),glm::vec3(0.0f,0.0f,0.9f));
l2s[2] = Light(glm::vec3(1.0,0.0,0.0),glm::vec3(0.2f, 0.0f, 0.0f),glm::vec3(0.5f, 0.0f, 0.0f),glm::vec3(0.9f,0.0f,0.0f));
l2s[3] = Light(glm::vec3(0.0,1.0,0.0),glm::vec3(0.0f, 0.2f, 0.0f),glm::vec3(0.0f, 0.5f, 0.0f),glm::vec3(0.0f,0.9f,0.0f));
currLightN = &l1s[0];
currLightM = &l2s[0];
while(!glfwWindowShouldClose(window)){
float currentFrame = glfwGetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
processInput();
//glClearColor(0.0f, 0.4f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
lamp1.setPos(lightPos1);
lamp2.setPos(lightPos2);
projection = glm::mat4(1.0f);
projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.2f, 100.0f);
view = camera.GetViewMatrix();
renderModel();
lamp1.bind();
lampShader1.setVec3("lightColor", currLightN->color);
lamp1.draw(view, projection);
lamp1.unbind();
lamp2.bind();
lampShader2.setVec3("lightColor", currLightM->color);
lamp2.draw(view, projection);
lamp2.unbind();
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
void processInput(){
float cameraSpeed = 1.0f * deltaTime;
float lightSpeed = 1.0f * deltaTime;
if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
camera.ProcessKeyboard(ROLL_OUT, cameraSpeed);
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
camera.ProcessKeyboard(ROLL_IN, cameraSpeed);
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
camera.ProcessKeyboard(LEFT, cameraSpeed);
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
camera.ProcessKeyboard(RIGHT, cameraSpeed);
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
camera.ProcessKeyboard(FORWARD, cameraSpeed);
if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)
camera.ProcessKeyboard(BACKWARD, cameraSpeed);
if (glfwGetKey(window, GLFW_KEY_DOWN) == GLFW_PRESS){
float prevAngle = atan2(lightPos1.y,lightPos1.x);
float rad = glm::length(glm::vec2(lightPos1.x,lightPos1.y));
lightPos1.x = rad*cos(prevAngle-lightSpeed);
lightPos1.y = rad*sin(prevAngle-lightSpeed);
}
if (glfwGetKey(window, GLFW_KEY_UP) == GLFW_PRESS){
float prevAngle = atan2(lightPos1.y,lightPos1.x);
float rad = glm::length(glm::vec2(lightPos1.x,lightPos1.y));
lightPos1.x = rad*cos(prevAngle+lightSpeed);
lightPos1.y = rad*sin(prevAngle+lightSpeed);
}
if (glfwGetKey(window, GLFW_KEY_LEFT) == GLFW_PRESS){
float prevAngle = atan2(lightPos2.z,lightPos2.x);
float rad = glm::length(glm::vec2(lightPos2.x,lightPos2.z));
lightPos2.x = rad*cos(prevAngle-lightSpeed);
lightPos2.z = rad*sin(prevAngle-lightSpeed);
}
if (glfwGetKey(window, GLFW_KEY_RIGHT) == GLFW_PRESS){
float prevAngle = atan2(lightPos2.z,lightPos2.x);
float rad = glm::length(glm::vec2(lightPos2.x,lightPos2.z));
lightPos2.x = rad*cos(prevAngle+lightSpeed);
lightPos2.z = rad*sin(prevAngle+lightSpeed);
}
if (glfwGetKey(window, GLFW_KEY_T) == GLFW_PRESS){
if(firstChangeModel) {
modelRendered=(modelRendered+1)%5;
firstChangeModel = false;
}
}else{
firstChangeModel = true;
}
if (glfwGetKey(window, GLFW_KEY_P) == GLFW_PRESS){
if(firstChangeShader) {
shaderRendered=(shaderRendered+1)%3;
firstChangeShader = false;
currShader = &shaders[shaderRendered];
}
}else{
firstChangeShader = true;
}
if (glfwGetKey(window, GLFW_KEY_N) == GLFW_PRESS){
if(firstChangeLightN) {
lightRenderedN = (lightRenderedN+1)%4;
firstChangeLightN = false;
currLightN = &l1s[lightRenderedN];
}
}else{
firstChangeLightN = true;
}
if (glfwGetKey(window, GLFW_KEY_M) == GLFW_PRESS){
if(firstChangeLightM) {
lightRenderedM = (lightRenderedM+1)%4;
firstChangeLightM = false;
currLightM = &l2s[lightRenderedM];
}
}else{
firstChangeLightM = true;
}
if(glfwGetKey(window, GLFW_KEY_RIGHT_BRACKET) == GLFW_PRESS){ // pluss in latinamerican spanish keyboard
camera.ProcessMouseScroll(0.05);
}
if(glfwGetKey(window, GLFW_KEY_SLASH) == GLFW_PRESS){ // minnus in latinamerican spanish keyboard
camera.ProcessMouseScroll(-0.05);
}
}
void framebuffer_size_callback(GLFWwindow* glfWwindow, int width, int height){
glViewport(0, 0, width, height);
}
void mouse_callback(GLFWwindow* glfWwindow, double xpos, double ypos){
if (firstMouse)
{
lastX = xpos;
lastY = ypos;
firstMouse = false;
}
float xoffset = xpos - lastX;
float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top
lastX = xpos;
lastY = ypos;
camera.ProcessMouseMovement(xoffset, yoffset);
}
void scroll_callback(GLFWwindow* glfWwindow, double xoffset, double yoffset){
camera.ProcessMouseScroll(yoffset);
}
void global_config(){
//glfw window initialization
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "Tarea2GPU", NULL, NULL);
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
exit(-1);
}
glfwMakeContextCurrent(window);
if (glewInit()!=GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
exit(-1);
}
//viewport and callbacks setting
glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwSetCursorPosCallback(window, mouse_callback);
glfwSetScrollCallback(window, scroll_callback);
// glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_ENABLED);
glEnable(GL_DEPTH_TEST);
//texture wrapping / filtering / mipmapping
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//uncoment for debugging models
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
void renderModel(){
currShader->use();
currShader->setVec3("material.ambient", 0.5f, 0.25f, 0.15f);
currShader->setVec3("material.diffuse", 1.0f, 0.5f, 0.31f);
currShader->setVec3("material.specular", 0.5f, 0.5f, 0.5f);
currShader->setFloat("material.shininess", 64.0f);
currShader->setVec3("lights[0].color", currLightN->color);
currShader->setVec3("lights[0].position", lightPos1);
currShader->setVec3("lights[0].ambient", currLightN->ambient);
currShader->setVec3("lights[0].diffuse", currLightN->diffuse);
currShader->setVec3("lights[0].specular", currLightN->specular);
currShader->setVec3("lights[1].color", currLightM->color);
currShader->setVec3("lights[1].position", lightPos2);
currShader->setVec3("lights[1].ambient", currLightM->ambient);
currShader->setVec3("lights[1].diffuse", currLightM->diffuse);
currShader->setVec3("lights[1].specular", currLightM->specular);
currShader->setVec3("viewPos", camera.getCameraPosition().x,camera.getCameraPosition().y,camera.getCameraPosition().z);
if(modelRendered == 1){
sword.setShader(*currShader);
sword.bind();
sword.draw(view, projection);
sword.unbind();
}
if(modelRendered == 0){
sphere.setShader(*currShader);
sphere.bind();
sphere.draw(view, projection);
sphere.unbind();
}
if(modelRendered == 2){
cube.setShader(*currShader);
cube.bind();
cube.draw(view, projection);
cube.unbind();
}
if(modelRendered == 3){
piramid.setShader(*currShader);
piramid.bind();
piramid.draw(view, projection);
piramid.unbind();
}
if(modelRendered == 4){
tet.setShader(*currShader);
tet.bind();
tet.draw(view, projection);
tet.unbind();
}
}
| 33.216495
| 125
| 0.661468
|
hporro
|
78f1537e3a3f56bbfc817d479e86baa8e2e3738c
| 2,501
|
cpp
|
C++
|
unit_test/xyaml.cpp
|
UndefeatedSunny/sc-platform
|
5897c460bf7a4b9694324f09d2492f5e157a3955
|
[
"Apache-2.0"
] | 8
|
2021-06-03T15:22:26.000Z
|
2022-03-18T19:09:10.000Z
|
unit_test/xyaml.cpp
|
UndefeatedSunny/sc-platform
|
5897c460bf7a4b9694324f09d2492f5e157a3955
|
[
"Apache-2.0"
] | null | null | null |
unit_test/xyaml.cpp
|
UndefeatedSunny/sc-platform
|
5897c460bf7a4b9694324f09d2492f5e157a3955
|
[
"Apache-2.0"
] | 1
|
2021-11-17T15:01:44.000Z
|
2021-11-17T15:01:44.000Z
|
#include "report/report.hpp"
#include "report/summary.hpp"
#include "common/common.hpp"
#include "yaml-cpp/yaml.h"
#include <string>
using namespace std;
using namespace sc_core;
namespace {
const char * const MSGID{ "/Doulos/Example/yaml" };
}
string nodeType( const YAML::Node& node )
{
string result;
switch (node.Type()) {
case YAML::NodeType::Null: result = "YAML::NodeType::Null"; break;
case YAML::NodeType::Scalar: result = "YAML::NodeType::Scalar"; break;
case YAML::NodeType::Sequence: result = "YAML::NodeType::Sequence"; break;
case YAML::NodeType::Map: result = "YAML::NodeType::Map"; break;
case YAML::NodeType::Undefined: result = "YAML::NodeType::Undefined"; break;
}
return result;
}
#define SHOW(w,n,t) do {\
if( n ) {\
MESSAGE( "\n " << w << " = " << n.as<t>() );\
}\
}while(0)
#define SHOW2(w,t) do {\
if( pt.second[w] ) {\
MESSAGE( " " << w << "=" << pt.second[w].as<t>() );\
}\
}while(0)
int sc_main( int argc, char* argv[] )
{
sc_report_handler::set_actions( SC_ERROR, SC_DISPLAY | SC_LOG );
sc_report_handler::set_actions( SC_FATAL, SC_DISPLAY | SC_LOG );
// Defaults
string busname{ "top.nth" };
string filename{ "memory_map.yaml" };
// Scan command-line
for( int i=1; i<sc_argc(); ++i ) {
string arg( sc_argv()[i] );
if( arg.find(".yaml") == arg.size() - 5 ) {
filename = arg;
} else if( arg.find("-") != 0 ) {
busname = arg;
}
}
INFO( ALWAYS, "Searching for busname=" << busname );
YAML::Node root;
try {
root = YAML::LoadFile( filename );
} catch (const YAML::Exception& e) {
REPORT( FATAL, e.what() );
}
for( const auto& p : root ) {
if( p.first.as<string>() != busname ) continue;
MESSAGE( p.first.as<string>());
SHOW( "addr", p.second["addr"], string );
SHOW( "size", p.second["size"], Depth_t );
for( const auto& pt : p.second["targ"] ) {
MESSAGE( pt.first.as<string>() << " => " );
if( pt.second["addr"] )
MESSAGE( " " << "addr" << "=" << pt.second["addr"].as<Addr_t>() );
if( pt.second["size"] )
MESSAGE( " " << "size" << "=" << pt.second["size"].as<string>() );
if( pt.second["kind"] )
MESSAGE( " " << "kind" << "=" << pt.second["kind"].as<string>() );
if( pt.second["irq"] )
MESSAGE( " " << "irq" << "=" << pt.second["irq"].as<int>() );
MESSAGE( "\n" );
}
MEND( MEDIUM );
}
return Summary::report();
}
| 28.747126
| 80
| 0.55058
|
UndefeatedSunny
|
78f17b1e168022855a965c270de352807887f8a6
| 3,606
|
hpp
|
C++
|
include/engine/api/table_parameters.hpp
|
jhermsmeier/osrm-backend
|
7b11cd3a11c939c957eeff71af7feddaa86e7f82
|
[
"BSD-2-Clause"
] | 1
|
2017-04-15T22:58:23.000Z
|
2017-04-15T22:58:23.000Z
|
include/engine/api/table_parameters.hpp
|
jhermsmeier/osrm-backend
|
7b11cd3a11c939c957eeff71af7feddaa86e7f82
|
[
"BSD-2-Clause"
] | 1
|
2019-11-21T09:59:27.000Z
|
2019-11-21T09:59:27.000Z
|
include/engine/api/table_parameters.hpp
|
jhermsmeier/osrm-backend
|
7b11cd3a11c939c957eeff71af7feddaa86e7f82
|
[
"BSD-2-Clause"
] | 1
|
2020-11-19T08:51:11.000Z
|
2020-11-19T08:51:11.000Z
|
/*
Copyright (c) 2016, Project OSRM contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ENGINE_API_TABLE_PARAMETERS_HPP
#define ENGINE_API_TABLE_PARAMETERS_HPP
#include "engine/api/base_parameters.hpp"
#include <cstddef>
#include <algorithm>
#include <iterator>
#include <vector>
namespace osrm
{
namespace engine
{
namespace api
{
/**
* Parameters specific to the OSRM Table service.
*
* Holds member attributes:
* - sources: indices into coordinates indicating sources for the Table service, no sources means
* use all coordinates as sources
* - destinations: indices into coordinates indicating destinations for the Table service, no
* destinations means use all coordinates as destinations
*
* \see OSRM, Coordinate, Hint, Bearing, RouteParame, RouteParameters, TableParameters,
* NearestParameters, TripParameters, MatchParameters and TileParameters
*/
struct TableParameters : public BaseParameters
{
std::vector<std::size_t> sources;
std::vector<std::size_t> destinations;
TableParameters() = default;
template <typename... Args>
TableParameters(std::vector<std::size_t> sources_,
std::vector<std::size_t> destinations_,
Args... args_)
: BaseParameters{std::forward<Args>(args_)...}, sources{std::move(sources_)},
destinations{std::move(destinations_)}
{
}
bool IsValid() const
{
if (!BaseParameters::IsValid())
return false;
// Distance Table makes only sense with 2+ coodinates
if (coordinates.size() < 2)
return false;
// 1/ The user is able to specify duplicates in srcs and dsts, in that case it's her fault
// 2/ len(srcs) and len(dsts) smaller or equal to len(locations)
if (sources.size() > coordinates.size())
return false;
if (destinations.size() > coordinates.size())
return false;
// 3/ 0 <= index < len(locations)
const auto not_in_range = [this](const std::size_t x) { return x >= coordinates.size(); };
if (std::any_of(begin(sources), end(sources), not_in_range))
return false;
if (std::any_of(begin(destinations), end(destinations), not_in_range))
return false;
return true;
}
};
}
}
}
#endif // ENGINE_API_TABLE_PARAMETERS_HPP
| 33.388889
| 98
| 0.710483
|
jhermsmeier
|
78f1aec8a73f7eae04a5955e832f42c3944231a6
| 523
|
cpp
|
C++
|
landscaper/src/quad_3D.cpp
|
llGuy/landscaper
|
7b9874c73bd7f5f07a340b9043fdeace032b6c49
|
[
"MIT"
] | null | null | null |
landscaper/src/quad_3D.cpp
|
llGuy/landscaper
|
7b9874c73bd7f5f07a340b9043fdeace032b6c49
|
[
"MIT"
] | null | null | null |
landscaper/src/quad_3D.cpp
|
llGuy/landscaper
|
7b9874c73bd7f5f07a340b9043fdeace032b6c49
|
[
"MIT"
] | null | null | null |
#include "quad_3D.h"
quad_3D::quad_3D(glm::vec3 const & p1, glm::vec3 const & p2,
glm::vec3 const & p3, glm::vec3 const & p4)
: verts { p1, p2, p3, p4 }
{
}
auto quad_3D::create(resource_handler & rh) -> void
{
vertex_buffer.create();
vertex_buffer.fill(verts.size() * sizeof(glm::vec3), verts.data(), GL_STATIC_DRAW, GL_ARRAY_BUFFER);
layout.create();
layout.bind();
layout.attach(vertex_buffer, attribute{ GL_FLOAT, 3, GL_FALSE, 3 * sizeof(float), nullptr, false });
}
auto quad_3D::destroy(void) -> void
{
}
| 23.772727
| 101
| 0.680688
|
llGuy
|
78f1bc6faa242b41e71cd36bb5c129ef3b959a56
| 1,115
|
cpp
|
C++
|
Source/Ilum/Graphics/Model/SubMesh.cpp
|
LavenSun/IlumEngine
|
94841e56af3c5214f04e7a94cb7369f4935c5788
|
[
"MIT"
] | 1
|
2021-11-20T15:39:09.000Z
|
2021-11-20T15:39:09.000Z
|
Source/Ilum/Graphics/Model/SubMesh.cpp
|
LavenSun/IlumEngine
|
94841e56af3c5214f04e7a94cb7369f4935c5788
|
[
"MIT"
] | null | null | null |
Source/Ilum/Graphics/Model/SubMesh.cpp
|
LavenSun/IlumEngine
|
94841e56af3c5214f04e7a94cb7369f4935c5788
|
[
"MIT"
] | null | null | null |
#include "SubMesh.hpp"
namespace Ilum
{
SubMesh::SubMesh(std::vector<Vertex> &&vertices, std::vector<uint32_t> &&indices, uint32_t index_offset, scope<material::DisneyPBR> &&material) :
vertices(std::move(vertices)),
indices(std::move(indices)),
index_offset(index_offset),
material(*material)
{
for (auto& vertex : this->vertices)
{
bounding_box.merge(vertex.position);
}
}
SubMesh::SubMesh(SubMesh &&other) noexcept :
vertices(std::move(other.vertices)),
indices(std::move(other.indices)),
index_offset(other.index_offset),
bounding_box(other.bounding_box),
material(std::move(other.material))
{
other.vertices.clear();
other.indices.clear();
other.index_offset = 0;
}
SubMesh &SubMesh::operator=(SubMesh &&other) noexcept
{
vertices = std::move(other.vertices);
indices = std::move(other.indices);
index_offset = other.index_offset;
bounding_box = other.bounding_box;
material = std::move(other.material);
other.vertices.clear();
other.indices.clear();
other.index_offset = 0;
return *this;
}
} // namespace Ilum
| 25.930233
| 145
| 0.686996
|
LavenSun
|
78f216fc904d76cba43b81d75e42fe4e7e38b1f7
| 461
|
cpp
|
C++
|
luogu/cxx/src/P3372.cpp
|
HoshinoTented/Solutions
|
96fb200c7eb5bce17938aec5ae6efdc43b3fe494
|
[
"WTFPL"
] | 1
|
2019-09-13T13:06:27.000Z
|
2019-09-13T13:06:27.000Z
|
luogu/cxx/src/P3372.cpp
|
HoshinoTented/Solutions
|
96fb200c7eb5bce17938aec5ae6efdc43b3fe494
|
[
"WTFPL"
] | null | null | null |
luogu/cxx/src/P3372.cpp
|
HoshinoTented/Solutions
|
96fb200c7eb5bce17938aec5ae6efdc43b3fe494
|
[
"WTFPL"
] | null | null | null |
#include <iostream>
#include <cmath>
#define N 100000
typedef long long value_type;
int n, m, chunkLen;
value_type values[N], chunk[400];
auto rangeAdd(int begin, int end, value_type value) -> void {
for (int i = 0; i < n; ++ i) {
values[i] += value;
}
for (int i = begin / chunkLen + 0.5; i < end / chunkLen + 0.5; ++ i) {
}
}
auto main(int, char **) -> int {
std::cin >> n >> m;
chunkLen = sqrt(n) + 0.5;
for (int i = 0; i < m; ++ i) {
}
}
| 15.896552
| 71
| 0.563991
|
HoshinoTented
|
78f941228a50b58a8ea72601e56cc361e899e31d
| 2,486
|
cpp
|
C++
|
src/exercises/7/cannypoints.cpp
|
neumanf/pdi
|
b9ac18f79dad331f874405c57eaedf5157b0648b
|
[
"MIT"
] | null | null | null |
src/exercises/7/cannypoints.cpp
|
neumanf/pdi
|
b9ac18f79dad331f874405c57eaedf5157b0648b
|
[
"MIT"
] | null | null | null |
src/exercises/7/cannypoints.cpp
|
neumanf/pdi
|
b9ac18f79dad331f874405c57eaedf5157b0648b
|
[
"MIT"
] | null | null | null |
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <opencv2/core/matx.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/opencv.hpp>
#include <vector>
using namespace std;
using namespace cv;
#define STEP 5
#define JITTER 3
#define RAIO 5
int main(int argc, char **argv) {
vector<int> yrange;
vector<int> xrange;
Mat image, border, frame, points;
int width, height, gray;
int x, y;
image = imread("./exercises/7/hunt.jpg", cv::IMREAD_GRAYSCALE);
srand(time(0));
if (!image.data) {
cout << "nao abriu" << argv[1] << endl;
cout << argv[0] << " imagem.jpg";
exit(0);
}
width = image.size().width;
height = image.size().height;
int cannyThreshold = 30;
Canny(image, border, cannyThreshold, 3 * cannyThreshold);
xrange.resize(height / STEP);
yrange.resize(width / STEP);
iota(xrange.begin(), xrange.end(), 0);
iota(yrange.begin(), yrange.end(), 0);
for (uint i = 0; i < xrange.size(); i++) {
xrange[i] = xrange[i] * STEP + STEP / 2;
}
for (uint i = 0; i < yrange.size(); i++) {
yrange[i] = yrange[i] * STEP + STEP / 2;
}
points = Mat(height, width, CV_8U, Scalar(255));
random_shuffle(xrange.begin(), xrange.end());
for (auto i : xrange) {
random_shuffle(yrange.begin(), yrange.end());
for (auto j : yrange) {
x = i + rand() % (2 * JITTER) - JITTER + 1;
y = j + rand() % (2 * JITTER) - JITTER + 1;
gray = image.at<uchar>(x, y);
circle(points, cv::Point(y, x), RAIO, CV_RGB(gray, gray, gray), -1,
cv::LINE_AA);
}
}
for (int i = 0; i < 10; i++) {
for (auto i : xrange) {
random_shuffle(yrange.begin(), yrange.end());
for (auto j : yrange) {
x = i + rand() % (2 * JITTER) - JITTER + 1;
y = j + rand() % (2 * JITTER) - JITTER + 1;
gray = image.at<uchar>(x, y);
if (border.at<uchar>(x, y) == 255) {
circle(points, cv::Point(y, x), RAIO - 2,
CV_RGB(gray, gray, gray), -1, cv::LINE_AA);
}
}
}
}
imshow("points", points);
waitKey();
imwrite("./exercises/7/pontos.jpg", points);
imwrite("./exercises/7/cannyborders.png", border);
return 0;
}
| 25.111111
| 79
| 0.522526
|
neumanf
|
78fac89b0ba64af914b83ce5e202dd61d3eb0572
| 2,131
|
cc
|
C++
|
src/flyMS/src/ready_check.cc
|
msardonini/Robotics_Cape
|
5a1e7c25f6051f75a176a13d17dd6419731a72a5
|
[
"MIT"
] | 3
|
2017-08-04T01:04:42.000Z
|
2017-11-21T17:56:28.000Z
|
src/flyMS/src/ready_check.cc
|
msardonini/Robotics_Cape
|
5a1e7c25f6051f75a176a13d17dd6419731a72a5
|
[
"MIT"
] | null | null | null |
src/flyMS/src/ready_check.cc
|
msardonini/Robotics_Cape
|
5a1e7c25f6051f75a176a13d17dd6419731a72a5
|
[
"MIT"
] | null | null | null |
#include "flyMS/ready_check.h"
#include <chrono>
#include "rc/dsm.h"
#include "rc/start_stop.h"
#include "rc/led.h"
// Default Constructor
ReadyCheck::ReadyCheck() {
is_running_.store(true);
}
// Desctuctor
ReadyCheck::~ReadyCheck() {
is_running_.store(false);
rc_dsm_cleanup();
}
int ReadyCheck::WaitForStartSignal() {
// Initialze the serial RC hardware
int ret = rc_dsm_init();
//Toggle the kill switch to get going, to ensure controlled take-off
//Keep kill switch down to remain operational
int count = 1, toggle = 0, reset_toggle = 0;
float switch_val[2] = {0.0f , 0.0f};
bool first_run = true;
printf("Toggle the kill swtich twice and leave up to initialize\n");
while (count < 6 && rc_get_state() != EXITING && is_running_.load()) {
// Blink the green LED light to signal that the program is ready
reset_toggle++; // Only blink the led 1 in 20 times this loop runs
if (toggle) {
rc_led_set(RC_LED_GREEN, 0);
if (reset_toggle == 20) {
toggle = 0;
reset_toggle = 0;
}
} else {
rc_led_set(RC_LED_GREEN, 1);
if (reset_toggle == 20) {
toggle = 1;
reset_toggle = 0;
}
}
if (rc_dsm_is_new_data()) {
//Skip the first run to let data history fill up
if (first_run) {
switch_val[1] = rc_dsm_ch_normalized(5);
first_run = false;
continue;
}
switch_val[1] = switch_val[0];
switch_val[0] = rc_dsm_ch_normalized(5);
if (switch_val[0] < 0.25 && switch_val[1] > 0.25)
count++;
if (switch_val[0] > 0.25 && switch_val[1] < 0.25)
count++;
}
std::this_thread::sleep_for(std::chrono::milliseconds(10)); // Run at 100 Hz
}
//make sure the kill switch is in the position to fly before starting
while (switch_val[0] < 0.25 && rc_get_state() != EXITING && is_running_.load()) {
if (rc_dsm_is_new_data()) {
switch_val[0] = rc_dsm_ch_normalized(5);
}
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
printf("\nInitialized! Starting program\n");
rc_led_set(RC_LED_GREEN, 1);
return 0;
}
| 26.974684
| 83
| 0.628813
|
msardonini
|
78fae6fe7970874345f18ecc5d6303ced3a896d4
| 5,270
|
cpp
|
C++
|
src/mpi/contention/cuda/CUDADriver.cpp
|
Knutakir/shoc
|
85a7f5d4c1fe19be970f2fc97b0113bad9a2358a
|
[
"BSD-3-Clause-Clear",
"BSD-3-Clause"
] | 162
|
2015-01-25T23:22:48.000Z
|
2022-03-19T12:36:05.000Z
|
src/mpi/contention/cuda/CUDADriver.cpp
|
Knutakir/shoc
|
85a7f5d4c1fe19be970f2fc97b0113bad9a2358a
|
[
"BSD-3-Clause-Clear",
"BSD-3-Clause"
] | 20
|
2016-01-08T21:54:33.000Z
|
2021-11-05T13:36:30.000Z
|
src/mpi/contention/cuda/CUDADriver.cpp
|
Knutakir/shoc
|
85a7f5d4c1fe19be970f2fc97b0113bad9a2358a
|
[
"BSD-3-Clause-Clear",
"BSD-3-Clause"
] | 85
|
2015-01-06T15:27:13.000Z
|
2022-01-24T16:49:09.000Z
|
#include <iostream>
#include <stdlib.h>
#include "ResultDatabase.h"
#include "OptionParser.h"
#include "Utility.h"
using namespace std;
//using namespace SHOC;
#include <cuda.h>
#include <cuda_runtime.h>
void addBenchmarkSpecOptions(OptionParser &op);
void RunBenchmark(ResultDatabase &resultDB,
OptionParser &op);
void EnumerateDevicesAndChoose(int chooseDevice, bool verbose, const char* prefix = NULL)
{
cudaSetDevice(chooseDevice);
int actualdevice;
cudaGetDevice(&actualdevice);
int deviceCount;
cudaGetDeviceCount(&deviceCount);
string deviceName = "";
for (int device = 0; device < deviceCount; ++device)
{
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, device);
if (device == actualdevice)
deviceName = deviceProp.name;
if (verbose)
{
cout << "Device "<<device<<":\n";
cout << " name = '"<<deviceProp.name<<"'"<<endl;
cout << " totalGlobalMem = "<<HumanReadable(deviceProp.totalGlobalMem)<<endl;
cout << " sharedMemPerBlock = "<<HumanReadable(deviceProp.sharedMemPerBlock)<<endl;
cout << " regsPerBlock = "<<deviceProp.regsPerBlock<<endl;
cout << " warpSize = "<<deviceProp.warpSize<<endl;
cout << " memPitch = "<<HumanReadable(deviceProp.memPitch)<<endl;
cout << " maxThreadsPerBlock = "<<deviceProp.maxThreadsPerBlock<<endl;
cout << " maxThreadsDim[3] = "<<deviceProp.maxThreadsDim[0]<<","<<deviceProp.maxThreadsDim[1]<<","<<deviceProp.maxThreadsDim[2]<<endl;
cout << " maxGridSize[3] = "<<deviceProp.maxGridSize[0]<<","<<deviceProp.maxGridSize[1]<<","<<deviceProp.maxGridSize[2]<<endl;
cout << " totalConstMem = "<<HumanReadable(deviceProp.totalConstMem)<<endl;
cout << " major (hw version) = "<<deviceProp.major<<endl;
cout << " minor (hw version) = "<<deviceProp.minor<<endl;
cout << " clockRate = "<<deviceProp.clockRate<<endl;
cout << " textureAlignment = "<<deviceProp.textureAlignment<<endl;
}
}
std::ostringstream chosenDevStr;
if( prefix != NULL )
{
chosenDevStr << prefix;
}
chosenDevStr << "Chose device:"
<< " name='"<<deviceName<<"'"
<< " index="<<actualdevice;
std::cout << chosenDevStr.str() << std::endl;
}
// ****************************************************************************
// Function: GPUSetup
//
// Purpose:
// do the necessary OpenCL setup for GPU part of the test
//
// Arguments:
// op: the options parser / parameter database
// mympirank: for printing errors in case of failure
// mynoderank: this is typically the device ID (the mapping done in main)
//
// Returns: success/failure
//
// Creation: 2009
//
// Modifications:
//
// ****************************************************************************
//
int GPUSetup(OptionParser &op, int mympirank, int mynoderank)
{
//op.addOption("device", OPT_VECINT, "0", "specify device(s) to run on", 'd');
//op.addOption("verbose", OPT_BOOL, "", "enable verbose output", 'v');
addBenchmarkSpecOptions(op);
// The device option supports specifying more than one device
int deviceIdx = mynoderank;
if( deviceIdx >= op.getOptionVecInt( "device" ).size() )
{
std::ostringstream estr;
estr << "Warning: not enough devices specified with --device flag for task "
<< mympirank
<< " ( node rank " << mynoderank
<< ") to claim its own device; forcing to use first device ";
std::cerr << estr.str() << std::endl;
deviceIdx = 0;
}
int device = op.getOptionVecInt("device")[deviceIdx];
bool verbose = op.getOptionBool("verbose");
int deviceCount;
cudaGetDeviceCount(&deviceCount);
if (device >= deviceCount) {
cerr << "Warning: device index: " << device <<
"out of range, defaulting to device 0.\n";
device = 0;
}
std::ostringstream pstr;
pstr << mympirank << ": ";
// Initialization
EnumerateDevicesAndChoose(device,verbose, pstr.str().c_str());
return 0;
}
// ****************************************************************************
// Function: GPUCleanup
//
// Purpose:
// do the necessary OpenCL cleanup for GPU part of the test
//
// Arguments:
// op: option parser (to be removed)
//
// Returns: success/failure
//
// Creation: 2009
//
// Modifications:
//
// ****************************************************************************
//
int GPUCleanup(OptionParser &op)
{
return 0;
}
// ****************************************************************************
// Function: GPUDriver
//
// Purpose:
// drive the GPU test in both sequential and simultaneous run (with MPI)
//
// Arguments:
// op: benchmark options to be passed down to the gpu benchmark
//
// Returns: success/failure
//
// Creation: 2009
//
// Modifications:
//
// ****************************************************************************
//
int GPUDriver(OptionParser &op, ResultDatabase &resultDB)
{
// Run the benchmark
RunBenchmark(resultDB, op);
return 0;
}
| 31
| 149
| 0.560911
|
Knutakir
|
78fb123b6855472cb7ed340cca1e06396cd66234
| 156,823
|
cpp
|
C++
|
game/pt3_tunes.cpp
|
vladpower/Gamebox
|
9491675ee37ed852e533c22e2ce7331d0d7b33c6
|
[
"Apache-2.0"
] | 9
|
2017-08-31T08:59:06.000Z
|
2020-07-17T04:04:04.000Z
|
game/pt3_tunes.cpp
|
vladpower/Gamebox
|
9491675ee37ed852e533c22e2ce7331d0d7b33c6
|
[
"Apache-2.0"
] | 1
|
2019-08-04T15:24:39.000Z
|
2019-08-04T15:24:39.000Z
|
game/pt3_tunes.cpp
|
vladpower/Gamebox
|
9491675ee37ed852e533c22e2ce7331d0d7b33c6
|
[
"Apache-2.0"
] | 7
|
2017-08-31T10:12:12.000Z
|
2019-04-17T18:37:18.000Z
|
#include <Arduino.h>
#include "music.h"
#include "tunes.h"
const uint8_t mario[] MUSICMEM = {
0x50, 0x72, 0x6f, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x33, 0x2e, 0x35, 0x20, 0x63,
0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4d, 0x61, 0x72, 0x69, 0x6f, 0x20, 0x28, 0x4c, 0x65, 0x76,
0x65, 0x6c, 0x20, 0x31, 0x2d, 0x31, 0x29, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
0x79, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x47, 0x4f, 0x47, 0x49, 0x4e, 0x20, 0x6f,
0x6e, 0x20, 0x32, 0x32, 0x2e, 0x30, 0x31, 0x2e, 0x32, 0x30, 0x30, 0x32, 0x2e, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20,
/* +99 */
0x01, 0x07, 0x0e, 0x01,
/* +103 */
0xd8, 0x00, 0x00, 0x00, 0x40, 0x04, 0x9e, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x05, 0x17, 0x05, 0x2d, 0x05, 0x43,
0x05, 0x59, 0x05, 0x66, 0x05, 0x7c, 0x05, 0x92, 0x05, 0xa8, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 201(c9) - order */
0x00, 0x03, 0x03, 0x06, 0x06, 0x09, 0x00,
/* dx */
0x03, 0x03, 0x0c, 0x0c, 0x09, 0x00, 0x0c, 0xff, 0xf6, 0x00, 0x09, 0x01, 0x1d, 0x01, 0x31, 0x01,
0x5b, 0x01, 0x85, 0x01, 0xaf, 0x01, 0xf8, 0x01, 0x41, 0x02, 0x85, 0x02, 0xc6, 0x02, 0x07, 0x03,
/* fx */
0x32, 0x03, 0x8b, 0x03, 0xed, 0x03, 0xf0, 0x02, 0xb1, 0x01, 0x84, 0xb1, 0x02, 0x84, 0x84, 0xb1,
0x01, 0x80, 0xb1, 0x02, 0x84, 0xb1, 0x08, 0x87, 0x00, 0xf0, 0x02, 0xb1, 0x01, 0x7a, 0xb1, 0x02,
0x7a, 0x7a, 0xb1, 0x01, 0x7a, 0xb1, 0x02, 0x7a, 0xb1, 0x04, 0x7f, 0x7b, 0x00, 0xf0, 0x02, 0xb1,
0x01, 0x6a, 0xb1, 0x02, 0x6a, 0x6a, 0xb1, 0x01, 0x6a, 0xb1, 0x02, 0x6a, 0xb1, 0x04, 0x7b, 0x6f,
0x00, 0xf0, 0x02, 0xb1, 0x03, 0x80, 0x7b, 0x78, 0xb1, 0x02, 0x7d, 0x7f, 0xb1, 0x01, 0x7e, 0xb1,
0x02, 0x7d, 0xf2, 0x04, 0xb1, 0x04, 0x7b, 0xf0, 0x02, 0xb1, 0x02, 0x89, 0xb1, 0x01, 0x85, 0xb1,
0x02, 0x87, 0x84, 0xb1, 0x01, 0x80, 0x82, 0xb1, 0x03, 0x7f, 0x00, 0xf0, 0x02, 0xb1, 0x03, 0x78,
0x74, 0x6f, 0xb1, 0x02, 0x74, 0x76, 0xb1, 0x01, 0x75, 0xb1, 0x02, 0x74, 0xf3, 0x04, 0xb1, 0x04,
0x74, 0xf0, 0x02, 0xb1, 0x02, 0x80, 0xb1, 0x01, 0x7d, 0xb1, 0x02, 0x7f, 0x7d, 0xb1, 0x01, 0x78,
0x79, 0xb1, 0x03, 0x76, 0x00, 0xf0, 0x02, 0xb1, 0x03, 0x6f, 0x6c, 0x68, 0xb1, 0x02, 0x6d, 0x6f,
0xb1, 0x01, 0x6e, 0xb1, 0x02, 0x6d, 0xf1, 0x04, 0xb1, 0x04, 0x6c, 0xf0, 0x02, 0xb1, 0x02, 0x79,
0xb1, 0x01, 0x76, 0xb1, 0x02, 0x78, 0x74, 0xb1, 0x01, 0x71, 0x73, 0xb1, 0x03, 0x6f, 0x00, 0xb1,
0x02, 0xd0, 0xf0, 0x02, 0xb1, 0x01, 0x87, 0x86, 0x85, 0xb1, 0x02, 0x83, 0x84, 0xb1, 0x01, 0x7c,
0x7d, 0xb1, 0x02, 0x80, 0xb1, 0x01, 0x7d, 0x80, 0xb1, 0x03, 0x82, 0xb1, 0x01, 0x87, 0x86, 0x85,
0xb1, 0x02, 0x83, 0x84, 0x8c, 0xb1, 0x01, 0x8c, 0xb1, 0x06, 0x8c, 0xb1, 0x01, 0x87, 0x86, 0x85,
0xb1, 0x02, 0x83, 0x84, 0xb1, 0x01, 0x7c, 0x7d, 0xb1, 0x02, 0x80, 0xb1, 0x01, 0x7d, 0x80, 0xb1,
0x03, 0x82, 0x83, 0x82, 0xb1, 0x08, 0x80, 0x00, 0xb1, 0x02, 0xd0, 0xf0, 0x02, 0xb1, 0x01, 0x84,
0x83, 0x82, 0xb1, 0x02, 0x7f, 0x80, 0xb1, 0x01, 0x78, 0x79, 0xb1, 0x02, 0x7b, 0xb1, 0x01, 0x74,
0x78, 0xb1, 0x03, 0x79, 0xb1, 0x01, 0x84, 0x83, 0x82, 0xb1, 0x02, 0x7f, 0x80, 0x85, 0xb1, 0x01,
0x85, 0xb1, 0x06, 0x85, 0xb1, 0x01, 0x84, 0x83, 0x82, 0xb1, 0x02, 0x7f, 0x80, 0xb1, 0x01, 0x78,
0x79, 0xb1, 0x02, 0x7b, 0xb1, 0x01, 0x74, 0x78, 0xb1, 0x03, 0x79, 0x7c, 0x7e, 0xb1, 0x08, 0x78,
0x00, 0xf0, 0x02, 0xb1, 0x03, 0x68, 0x6f, 0xb1, 0x02, 0x74, 0xb1, 0x03, 0x6d, 0xb1, 0x01, 0x74,
0xb1, 0x02, 0x74, 0x6d, 0xb1, 0x03, 0x68, 0x6c, 0xb1, 0x01, 0x6f, 0xb1, 0x02, 0x74, 0x87, 0xb1,
0x01, 0x87, 0xb1, 0x02, 0x87, 0x6f, 0xb1, 0x03, 0x68, 0x6f, 0xb1, 0x02, 0x74, 0xb1, 0x03, 0x6d,
0xb1, 0x01, 0x74, 0xb1, 0x02, 0x74, 0x6d, 0x68, 0xb1, 0x03, 0x70, 0x72, 0x74, 0xb1, 0x01, 0x6f,
0xb1, 0x02, 0x6f, 0x68, 0x00, 0xb1, 0x01, 0x80, 0xb1, 0x02, 0x80, 0x80, 0xb1, 0x01, 0x80, 0xb1,
0x02, 0x82, 0xb1, 0x01, 0x84, 0xb1, 0x02, 0x80, 0xb1, 0x01, 0x7d, 0xb1, 0x04, 0x7b, 0xb1, 0x01,
0x80, 0xb1, 0x02, 0x80, 0x80, 0xb1, 0x01, 0x80, 0x82, 0xb1, 0x09, 0x84, 0xb1, 0x01, 0x80, 0xb1,
0x02, 0x80, 0x80, 0xb1, 0x01, 0x80, 0xb1, 0x02, 0x82, 0xb1, 0x01, 0x84, 0xb1, 0x02, 0x80, 0xb1,
0x01, 0x7d, 0xb1, 0x04, 0x7b, 0x00, 0xb1, 0x01, 0x7c, 0xb1, 0x02, 0x7c, 0x7c, 0xb1, 0x01, 0x7c,
0xb1, 0x02, 0x7e, 0xb1, 0x01, 0x7b, 0xb1, 0x02, 0x78, 0xb1, 0x01, 0x78, 0xb1, 0x04, 0x74, 0xb1,
0x01, 0x7c, 0xb1, 0x02, 0x7c, 0x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01, 0x80, 0xb1, 0x04, 0x79, 0xf4, 0x04, 0x7b, 0x46, 0x85, 0xf0, 0x02, 0xb1, 0x01, 0x80, 0xb1,
0x02, 0x7d, 0xb1, 0x01, 0x79, 0xb1, 0x04, 0x78, 0xb1, 0x01, 0x80, 0xb1, 0x02, 0x7d, 0xb1, 0x03,
0x78, 0xb1, 0x02, 0x78, 0xb1, 0x01, 0x79, 0xb1, 0x02, 0x80, 0xb1, 0x01, 0x80, 0xb1, 0x04, 0x79,
0xb1, 0x01, 0x7b, 0xb1, 0x02, 0x82, 0xb1, 0x01, 0x82, 0xf7, 0x04, 0xb1, 0x04, 0x82, 0xf0, 0x02,
0xb1, 0x01, 0x7b, 0xb1, 0x02, 0x78, 0xb1, 0x01, 0x78, 0xb1, 0x04, 0x74, 0x00, 0xf0, 0x02, 0xb1,
0x03, 0x68, 0xb1, 0x01, 0x6e, 0xb1, 0x02, 0x6f, 0x74, 0x6d, 0x6d, 0xb1, 0x01, 0x74, 0x74, 0xb1,
0x02, 0x6d, 0xb1, 0x03, 0x6a, 0xb1, 0x01, 0x6d, 0xb1, 0x02, 0x6f, 0x73, 0x6f, 0x6f, 0xb1, 0x01,
0x74, 0x74, 0xb1, 0x02, 0x6f, 0xb1, 0x03, 0x68, 0xb1, 0x01, 0x6e, 0xb1, 0x02, 0x6f, 0x74, 0x6d,
0x6d, 0xb1, 0x01, 0x74, 0x74, 0xb1, 0x02, 0x6d, 0xb1, 0x01, 0x6f, 0xb1, 0x02, 0x6f, 0xb1, 0x01,
0x6f, 0xf8, 0x04, 0xb1, 0x04, 0x6f, 0xf0, 0x02, 0xb1, 0x02, 0x74, 0x6f, 0xb1, 0x04, 0x68, 0x00,
0x16, 0x17, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8c,
0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x84,
0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x82,
0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x85,
0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x81,
0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1d,
0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00,
0x00, 0x8c, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00,
0x00, 0x85, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00,
0x00, 0x8d, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00,
0x00, 0x84, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00,
0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00,
0x00, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x13, 0x14, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x0c, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0a, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0x13, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xfd, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe,
0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x04,
};
const uint8_t cantina[] MUSICMEM = {
0x50, 0x72, 0x6f, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x33, 0x2e, 0x34, 0x20, 0x63,
0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x49, 0x6e,
0x20, 0x53, 0x74, 0x61, 0x72, 0x20, 0x57, 0x61, 0x72, 0x73, 0x20, 0x50, 0x55, 0x42, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
0x79, 0x20, 0x4d, 0x61, 0x73, 0x74, 0x2f, 0x46, 0x74, 0x4c, 0x20, 0x31, 0x32, 0x2e, 0x30, 0x32,
0x2e, 0x39, 0x39, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x01, 0x06, 0x07, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0xbe,
0x06, 0x00, 0x00, 0x28, 0x07, 0x8e, 0x07, 0x14, 0x08, 0x9a, 0x08, 0x00, 0x00, 0xa8, 0x08, 0x00,
0x00, 0xe6, 0x08, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x08, 0x01, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x09, 0x0d, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x09, 0x00, 0x03, 0x09, 0x06, 0x0c, 0x06, 0x0f,
0xff, 0xf5, 0x00, 0x7d, 0x01, 0x02, 0x02, 0x6b, 0x02, 0xaf, 0x02, 0xf8, 0x02, 0x43, 0x03, 0x89,
0x03, 0xcc, 0x03, 0x02, 0x04, 0x4a, 0x04, 0x95, 0x04, 0xd4, 0x04, 0x18, 0x05, 0x5e, 0x05, 0x95,
0x05, 0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c9, 0xd0, 0xda, 0xcf,
0x8b, 0xcb, 0x8b, 0xcf, 0x8a, 0xcb, 0x8b, 0xcf, 0x84, 0x85, 0xcd, 0xd0, 0xdc, 0xcf, 0x81, 0xce,
0xd0, 0xcd, 0xd0, 0xc7, 0xd0, 0xc6, 0xd0, 0xc3, 0xd0, 0xc2, 0xd0, 0xc1, 0xb1, 0x02, 0xd0, 0x00,
0xf7, 0x14, 0xcb, 0xb1, 0x02, 0x74, 0xb1, 0x01, 0x74, 0xcc, 0xd0, 0xb1, 0x02, 0x75, 0xcd, 0x75,
0xb1, 0x01, 0x76, 0xce, 0xb1, 0x02, 0x77, 0xd3, 0xcc, 0xb1, 0x01, 0x78, 0xcb, 0xd0, 0xca, 0xd0,
0xc9, 0xd0, 0xc8, 0xd0, 0xf0, 0x0a, 0xcd, 0x80, 0xca, 0xd0, 0xcd, 0x80, 0xca, 0xd0, 0xcd, 0x80,
0x80, 0xcc, 0xd0, 0xcf, 0x80, 0xce, 0xd0, 0xd1, 0xcf, 0x6f, 0xb1, 0x02, 0x6f, 0x6f, 0x6f, 0x00,
0x16, 0x17, 0x00, 0x0f, 0x29, 0xfe, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17,
0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x17,
0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17,
0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x15,
0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x13,
0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x14, 0x1a,
0x01, 0x8e, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00, 0x01, 0x8d, 0x00, 0x00, 0x01, 0x8d, 0x00, 0x00,
0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00,
0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00,
0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00,
0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00,
0x01, 0x8c, 0x01, 0x00, 0x01, 0x8c, 0x03, 0x00, 0x01, 0x8c, 0x01, 0x00, 0x01, 0x8c, 0xff, 0xff,
0x01, 0x8c, 0xfd, 0xff, 0x01, 0x8c, 0xff, 0xff, 0x18, 0x19, 0x05, 0x0f, 0x00, 0x01, 0x07, 0x0e,
0x80, 0x01, 0x09, 0x0e, 0x00, 0x02, 0x0b, 0x1e, 0x00, 0x00, 0x0b, 0x1e, 0x00, 0x00, 0x01, 0x1e,
0x00, 0x00, 0x01, 0x1e, 0x00, 0x00, 0x01, 0x1d, 0x00, 0x00, 0x01, 0x1d, 0x00, 0x00, 0x01, 0x1d,
0x00, 0x00, 0x01, 0x1c, 0x00, 0x00, 0x01, 0x1c, 0x00, 0x00, 0x01, 0x1c, 0x00, 0x00, 0x01, 0x1c,
0x00, 0x00, 0x01, 0x1b, 0x00, 0x00, 0x01, 0x1a, 0x00, 0x00, 0x01, 0x19, 0x00, 0x00, 0x01, 0x18,
0x00, 0x00, 0x01, 0x17, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00, 0x01, 0x13,
0x00, 0x00, 0x01, 0x12, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x20, 0x21,
0x09, 0x1e, 0x00, 0x00, 0x0b, 0x1d, 0x00, 0x00, 0x0b, 0x1d, 0x00, 0x00, 0x09, 0x1c, 0x00, 0x00,
0x05, 0x1c, 0x00, 0x00, 0x03, 0x1a, 0x00, 0x00, 0x03, 0x19, 0x00, 0x00, 0x03, 0x18, 0x00, 0x00,
0x01, 0x17, 0x00, 0x00, 0x01, 0x17, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00,
0x01, 0x15, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00, 0x01, 0x13, 0x00, 0x00, 0x01, 0x12, 0x00, 0x00,
0x01, 0x11, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x01, 0x80, 0x00, 0x00, 0x20, 0x21, 0x01, 0x1d, 0x00, 0x00, 0x01, 0x1c, 0x00, 0x00, 0x01, 0x1a,
0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x01, 0x15,
0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x13, 0x00, 0x00, 0x01, 0x13, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80,
0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80,
0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80,
0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80,
0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80,
0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x02, 0x03, 0x01, 0x1d, 0x00, 0x00,
0x01, 0x19, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x0e, 0x0f, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x8e,
0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8a,
0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x86,
0x00, 0x00, 0x01, 0x85, 0x00, 0x00, 0x01, 0x84, 0x00, 0x00, 0x01, 0x83, 0x00, 0x00, 0x01, 0x82,
0x00, 0x00, 0x01, 0x81, 0x00, 0x00, 0x03, 0x04, 0x01, 0x8e, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00,
0x01, 0x8d, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x04, 0x00, 0xfb, 0xf7, 0xf4, 0x00, 0x04, 0x00, 0xfb, 0xf8, 0xf4, 0x01, 0x02, 0x0c,
0x00, 0x00, 0x02, 0x06, 0xfa,
};
const uint8_t dizzy[] MUSICMEM = {
0x50, 0x72, 0x6f, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x33, 0x2e, 0x37, 0x20, 0x63,
0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x57, 0x6f,
0x72, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x44, 0x69, 0x7a, 0x7a, 0x79, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
0x79, 0x20, 0x43, 0x6a, 0x20, 0x53, 0x70, 0x6c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x27, 0x73, 0x20,
0x49, 0x6e, 0x74, 0x72, 0x6f, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x02, 0x04, 0x18, 0x17, 0xe2, 0x00, 0x00, 0x00, 0xbe, 0x0d, 0x00, 0x00, 0xd4,
0x0d, 0x00, 0x00, 0xe2, 0x0d, 0xf4, 0x0d, 0x0a, 0x0e, 0x40, 0x0e, 0x4e, 0x0e, 0x54, 0x0e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x0e, 0x00, 0x00, 0x5d, 0x0e, 0x63,
0x0e, 0x68, 0x0e, 0x6d, 0x0e, 0x71, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x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, 0x34, 0x51, 0x00,
0xf0, 0x02, 0xcf, 0xb1, 0x03, 0x7f, 0xb1, 0x01, 0xc0, 0xb1, 0x03, 0x7f, 0xb1, 0x01, 0xc0, 0xb1,
0x02, 0x7f, 0xda, 0x02, 0x7d, 0x01, 0x1c, 0x00, 0x11, 0x00, 0x02, 0x7b, 0x01, 0x1e, 0x00, 0x11,
0x00, 0x02, 0x7d, 0x01, 0x1e, 0x00, 0xef, 0xff, 0xca, 0x7b, 0xd1, 0xcf, 0x7f, 0xda, 0xca, 0x7d,
0xd1, 0xcf, 0x7b, 0xca, 0x7f, 0xcf, 0x7b, 0x7b, 0xda, 0x02, 0x7a, 0x01, 0x11, 0x00, 0x11, 0x00,
0xd1, 0x02, 0x7b, 0x01, 0x11, 0x00, 0xef, 0xff, 0xda, 0x7a, 0x02, 0x78, 0x01, 0x24, 0x00, 0x11,
0x00, 0xd1, 0x76, 0x78, 0x7a, 0xcc, 0x76, 0xcf, 0x7b, 0xca, 0x76, 0xcc, 0x7b, 0xc8, 0x7b, 0xca,
0x7b, 0xc8, 0x7b, 0xcf, 0x7b, 0x7d, 0x7b, 0x00, 0xf0, 0x0a, 0xcd, 0xb1, 0x01, 0x84, 0xca, 0x84,
0xcd, 0x87, 0xca, 0x84, 0xcd, 0x8b, 0xca, 0x87, 0xcd, 0x87, 0xca, 0x8b, 0xcd, 0x84, 0xca, 0x87,
0xcd, 0x87, 0xca, 0x84, 0xcd, 0x8b, 0xca, 0x87, 0xcd, 0x87, 0xca, 0x8b, 0xcd, 0x84, 0xca, 0x87,
0xcd, 0x87, 0xca, 0x84, 0xcd, 0x8b, 0xca, 0x87, 0xcd, 0x87, 0xca, 0x8b, 0xcd, 0x84, 0xca, 0x87,
0xcd, 0x87, 0xca, 0x84, 0xcd, 0x8b, 0xca, 0x87, 0xcd, 0x87, 0xca, 0x8b, 0xcd, 0x80, 0xca, 0x87,
0xcd, 0x84, 0xca, 0x80, 0xcd, 0x87, 0xca, 0x84, 0xcd, 0x84, 0xca, 0x87, 0xcd, 0x80, 0xca, 0x84,
0xcd, 0x84, 0xca, 0x80, 0xcd, 0x87, 0xca, 0x84, 0xcd, 0x84, 0xca, 0x87, 0xcd, 0x80, 0xca, 0x84,
0xcd, 0x84, 0xca, 0x80, 0xcd, 0x87, 0xca, 0x84, 0xcd, 0x84, 0xca, 0x87, 0xcd, 0x8c, 0xca, 0x84,
0xcd, 0x87, 0xca, 0x8c, 0xcd, 0x89, 0xca, 0x87, 0xcd, 0x84, 0xca, 0x89, 0x00, 0x1c, 0x00, 0x46,
0x0c, 0x40, 0xb1, 0x02, 0x68, 0xd3, 0xbd, 0x00, 0x23, 0x51, 0xd7, 0xbd, 0x00, 0x46, 0x6f, 0xd3,
0xbd, 0x00, 0x23, 0x51, 0xd6, 0xbd, 0x00, 0x46, 0x68, 0xd3, 0xbd, 0x00, 0x23, 0x51, 0xd7, 0xbd,
0x00, 0x46, 0x6f, 0xd3, 0xbd, 0x00, 0x23, 0x51, 0xd6, 0xbd, 0x00, 0x46, 0x68, 0xd3, 0xbd, 0x00,
0x23, 0x51, 0xd7, 0xbd, 0x00, 0x46, 0x6f, 0xd3, 0xbd, 0x00, 0x23, 0x51, 0xd6, 0xbd, 0x00, 0x46,
0x68, 0xd3, 0xbd, 0x00, 0x23, 0x51, 0xd7, 0xbd, 0x00, 0x46, 0x6f, 0xd3, 0xbd, 0x00, 0x23, 0x51,
0xd6, 0xbd, 0x00, 0x5d, 0x67, 0xd3, 0xbd, 0x00, 0x2f, 0x51, 0xd7, 0xbd, 0x00, 0x5d, 0x6f, 0xd3,
0xbd, 0x00, 0x2f, 0x51, 0xd6, 0xbd, 0x00, 0x5d, 0x67, 0xd3, 0xbd, 0x00, 0x2f, 0x51, 0xd7, 0xbd,
0x00, 0x5d, 0x6f, 0xd3, 0xbd, 0x00, 0x2f, 0xb1, 0x01, 0x51, 0x51, 0xd6, 0xbd, 0x00, 0x5d, 0xb1,
0x02, 0x67, 0xd3, 0xbd, 0x00, 0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, 0xef,
0xff, 0xcc, 0x7d, 0x00, 0xf0, 0x0a, 0xcf, 0xb1, 0x01, 0x97, 0xca, 0x82, 0xc9, 0x87, 0xc8, 0x97,
0xcf, 0x8b, 0xca, 0x97, 0xcf, 0x95, 0xca, 0x97, 0xcd, 0x82, 0xca, 0x95, 0xcd, 0x87, 0xca, 0x82,
0xcd, 0x8b, 0xca, 0x87, 0xcd, 0x87, 0xca, 0x8b, 0xcf, 0x97, 0xca, 0x87, 0xc8, 0x97, 0xca, 0x82,
0xcf, 0x98, 0xca, 0x87, 0xcf, 0x95, 0xca, 0x8b, 0x93, 0x87, 0xcd, 0x87, 0xca, 0x82, 0xcd, 0x8b,
0xca, 0x87, 0xcd, 0x87, 0xca, 0x8b, 0xcf, 0x97, 0xca, 0x87, 0xcd, 0x82, 0xca, 0x7d, 0xcd, 0x89,
0xca, 0x82, 0xcf, 0x95, 0xca, 0x7d, 0xcd, 0x7d, 0xca, 0x82, 0xcd, 0x82, 0xca, 0x7d, 0xcd, 0x89,
0xca, 0x82, 0xcd, 0x82, 0xca, 0x7d, 0xcf, 0x97, 0xca, 0x82, 0xcf, 0x97, 0xca, 0x7d, 0xcf, 0x95,
0xca, 0x82, 0xcf, 0x93, 0xca, 0x89, 0x95, 0x82, 0xcf, 0x95, 0xca, 0x89, 0xcf, 0x97, 0xca, 0x89,
0xcf, 0x8e, 0xca, 0x8c, 0x00, 0xf0, 0x14, 0xcf, 0xb1, 0x04, 0x7f, 0xca, 0x01, 0xb1, 0x02, 0x7f,
0x06, 0x11, 0x00, 0xd1, 0xcf, 0x02, 0x7d, 0x01, 0x1c, 0x00, 0x11, 0x00, 0xca, 0x7f, 0x7d, 0xc9,
0x7f, 0xc6, 0x7d, 0xcf, 0x7f, 0xcc, 0x7d, 0xcf, 0x02, 0x80, 0x01, 0x28, 0x00, 0xef, 0xff, 0x7d,
0xc8, 0x7d, 0xcc, 0x7d, 0xc8, 0x7d, 0xca, 0x7d, 0xda, 0x45, 0xcf, 0x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d, 0x00, 0x68, 0x6c, 0xd3, 0xbd, 0x00, 0x34, 0x51, 0xd7, 0xbd, 0x00, 0x68,
0x6f, 0xd3, 0xbd, 0x00, 0x34, 0x51, 0xd6, 0xbd, 0x00, 0x68, 0x6c, 0xd3, 0xbd, 0x00, 0x34, 0x51,
0xd7, 0xbd, 0x00, 0x68, 0x6f, 0xd3, 0xbd, 0x00, 0x34, 0x51, 0x00, 0xf0, 0x02, 0xcf, 0x01, 0xb1,
0x03, 0x8b, 0x0f, 0x11, 0x00, 0xb1, 0x01, 0xc0, 0xb1, 0x03, 0x8b, 0xb1, 0x01, 0xc0, 0xb1, 0x02,
0x8b, 0xda, 0x02, 0x89, 0x01, 0x0d, 0x00, 0x11, 0x00, 0x02, 0x87, 0x01, 0x10, 0x00, 0x11, 0x00,
0x02, 0x89, 0x01, 0x10, 0x00, 0xef, 0xff, 0xd1, 0xca, 0x87, 0xcf, 0x8b, 0xca, 0x89, 0xcf, 0x87,
0xca, 0x8b, 0xcf, 0x87, 0xda, 0x87, 0x02, 0x86, 0x01, 0x08, 0x00, 0x11, 0x00, 0x02, 0x87, 0x01,
0x08, 0x00, 0xef, 0xff, 0x02, 0x86, 0x01, 0x08, 0x00, 0x11, 0x00, 0x02, 0x84, 0x01, 0x12, 0x00,
0x11, 0x00, 0xd1, 0x82, 0x84, 0x86, 0xcc, 0x82, 0xcf, 0x87, 0xca, 0x86, 0xcc, 0x87, 0xc8, 0x87,
0xca, 0x87, 0xc8, 0x87, 0xcf, 0x87, 0x89, 0x87, 0x00, 0xf3, 0x10, 0xcf, 0xb1, 0x02, 0x84, 0x84,
0xca, 0x84, 0xcf, 0x84, 0xca, 0x84, 0x40, 0xcc, 0x78, 0x7f, 0x78, 0x43, 0xcf, 0x84, 0x84, 0xca,
0x84, 0xcf, 0x84, 0xca, 0x84, 0x40, 0xcc, 0x78, 0x7f, 0x78, 0x43, 0xcf, 0x80, 0x80, 0xca, 0x80,
0xcf, 0x80, 0xca, 0x80, 0x40,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 0xda, 0xcf,
0xb1, 0x04, 0x8b, 0xca, 0xb1, 0x02, 0x8b, 0xd1, 0xcf, 0x89, 0xca, 0x8b, 0x89, 0xc9, 0x8b, 0xc6,
0x89, 0xda, 0xcf, 0x8b, 0xca, 0x89, 0xd1, 0xcf, 0x8c, 0x02, 0x89, 0x01, 0x13, 0x00, 0x11, 0x00,
0xc8, 0x89, 0xcc, 0x89, 0xc8, 0x89, 0xca, 0x89, 0xda, 0xcf, 0xb1, 0x04, 0x8b, 0xca, 0xb1, 0x02,
0x8b, 0xd1, 0xcf, 0x02, 0x89, 0x01, 0x0d, 0x00, 0x11, 0x00, 0xcb, 0x8b, 0xc8, 0x89, 0xca, 0x8b,
0x89, 0xda, 0xcf, 0x02, 0x8b, 0x01, 0x0d, 0x00, 0xef, 0xff, 0xcc, 0x02, 0x89, 0x01, 0x0d, 0x00,
0x11, 0x00, 0xd1, 0xcf, 0x02, 0x89, 0x01, 0x00, 0x00, 0x11, 0x00, 0x02, 0x87, 0x01, 0x10, 0x00,
0x11, 0x00, 0xcc, 0x89, 0xcf, 0x02, 0x89, 0x01, 0x00, 0x00, 0x11, 0x00, 0x02, 0x8b, 0x01, 0x0d,
0x00, 0xef, 0xff, 0xcc, 0x89, 0x00, 0x43, 0xb0, 0xcf, 0xb1, 0x02, 0x82, 0x82, 0xc0, 0x82, 0xc0,
0x40, 0x76, 0x7f, 0x76, 0x44, 0x87, 0x87, 0xc0, 0x87, 0xc0, 0x40, 0x76, 0x7f, 0x80, 0x43, 0x89,
0x89, 0xc0, 0x89, 0xc0, 0x40, 0x7f, 0x7d, 0x7b, 0x43, 0x8b, 0x8b, 0xc0, 0x89, 0xc0, 0xc0, 0xb1,
0x04, 0x8b, 0x00, 0xf0, 0x02, 0xcf, 0xb1, 0x02, 0x8b, 0x8b, 0xb1, 0x01, 0x8b, 0xc0, 0x8b, 0xc0,
0xda, 0xb1, 0x02, 0x8b, 0x02, 0x89, 0x01, 0x0d, 0x00, 0x11, 0x00, 0x02, 0x87, 0x01, 0x10, 0x00,
0x11, 0x00, 0xd1, 0x02, 0x8b, 0x01, 0x1d, 0x00, 0xef, 0xff, 0xc0, 0xd5, 0xcd, 0x9c, 0x9e, 0xa1,
0xa3, 0xd1, 0xcf, 0x87, 0x87, 0x86, 0x87, 0x86, 0x84, 0x82, 0x84, 0x86, 0xcd, 0x82, 0xcf, 0x87,
0xc0, 0xcd, 0x87, 0xc0, 0xca, 0x87, 0xc0, 0xcf, 0x87, 0x02, 0x89, 0x01, 0x10, 0x00, 0xef, 0xff,
0x02, 0x87, 0x01, 0x10, 0x00, 0x11, 0x00, 0x00, 0xda, 0xcf, 0xb1, 0x04, 0x8b, 0xca, 0x01, 0xb1,
0x02, 0x8b, 0x06, 0x11, 0x00, 0xd1, 0xcf, 0x02, 0x89, 0x01, 0x0d, 0x00, 0x11, 0x00, 0xca, 0x8b,
0x89, 0xc9, 0x8b, 0xc6, 0x89, 0xcf, 0x8b, 0xcc, 0x89, 0xcf, 0x02, 0x8c, 0x01, 0x13, 0x00, 0xef,
0xff, 0x89, 0xc8, 0x89, 0xcc, 0x89, 0xc8, 0x89, 0xca, 0x89, 0xda, 0xcf, 0xb1, 0x03, 0x8b, 0xb1,
0x01, 0xc0, 0xd1, 0xca, 0xb1, 0x02, 0x8b, 0xcf, 0x02, 0x89, 0x01, 0x0d, 0x00, 0x11, 0x00, 0xcb,
0x8b, 0xc8, 0x89, 0xca, 0x8b, 0x89, 0xda, 0xcf, 0x02, 0x8b, 0x01, 0x0d, 0x00, 0xef, 0xff, 0xcc,
0x89, 0xcf, 0x89, 0x02, 0x87, 0x01, 0x10, 0x00, 0x11, 0x00, 0xcc, 0x89, 0xcf, 0x89, 0x02, 0x8b,
0x01, 0x0d, 0x00, 0xef, 0xff, 0xcc, 0x89, 0x00, 0xf2, 0x02, 0xcc, 0xb1, 0x01, 0x76, 0xc8, 0x80,
0xcc, 0x7b, 0xc8, 0x6a, 0xcc, 0x7f, 0xc8, 0x6f, 0xcc,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xb4, 0xf3, 0x01, 0x8f, 0xb3, 0xf3, 0x00, 0x90,
0x00, 0x00, 0x03, 0x04, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00,
0x80, 0x8c, 0x00, 0x00, 0x04, 0x05, 0x1f, 0x0d, 0xaa, 0x01, 0x01, 0x8c, 0xff, 0x01, 0x01, 0x8b,
0x22, 0x02, 0x01, 0x8b, 0x33, 0x03, 0x00, 0xb0, 0x00, 0x00, 0x0c, 0x0d, 0x01, 0x0f, 0x00, 0x00,
0x01, 0x0f, 0x80, 0x00, 0x01, 0x0f, 0x00, 0x01, 0x01, 0x0e, 0x80, 0x01, 0x00, 0x8d, 0x00, 0x02,
0x00, 0x9c, 0x80, 0x02, 0x00, 0x9b, 0x00, 0x03, 0x00, 0x9a, 0x80, 0x03, 0x00, 0x99, 0x01, 0x04,
0x00, 0x99, 0x80, 0x04, 0x00, 0x98, 0x80, 0x04, 0x00, 0x98, 0x00, 0x05, 0x00, 0x90, 0x00, 0x00,
0x00, 0x03, 0x01, 0x8c, 0x01, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x81, 0x8c, 0x00, 0x00, 0x00, 0x01,
0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x01, 0x8e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x04, 0x00,
0x0c, 0x18, 0x0c, 0x00, 0x03, 0x00, 0x07, 0x0c, 0x00, 0x03, 0x00, 0x02, 0x0c, 0x01, 0x02, 0x00,
0x0c, 0x00, 0x03, 0x00, 0x04, 0x0c,
};
const uint8_t dizzy4[] MUSICMEM = {
0x56, 0x6f, 0x72, 0x74, 0x65, 0x78, 0x20, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x49,
0x49, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x20, 0x44, 0x69,
0x7a, 0x7a, 0x79, 0x20, 0x34, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x69, 0x74, 0x6c, 0x65,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
0x79, 0x20, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x42, 0x65,
0x79, 0x20, 0x45, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x01, 0x07, 0x0f, 0x01, 0xd9, 0x00, 0x00, 0x00, 0x5a, 0x05, 0x7c, 0x05, 0x00,
0x00, 0xa2, 0x05, 0xd0, 0x05, 0xee, 0x05, 0x00, 0x00, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x06, 0x3d, 0x06, 0x47, 0x06, 0x00,
0x00, 0x4a, 0x06, 0x57, 0x06, 0x60, 0x06, 0x69, 0x06, 0x6c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x06, 0x09, 0x09, 0x06,
0x06, 0x0c, 0x0c, 0x0f, 0x12, 0x12, 0x15, 0x15, 0xff, 0x09, 0x01, 0x66, 0x01, 0xb1, 0x01, 0x09,
0x01, 0x66, 0x01, 0xb5, 0x01, 0x30, 0x02, 0x66, 0x01, 0xb5, 0x01, 0x7a, 0x02, 0x66, 0x01, 0xb5,
0x01, 0xc0, 0x02, 0x12, 0x03, 0x5d, 0x03, 0xe2, 0x03, 0xe7, 0x03, 0x32, 0x04, 0xc0, 0x04, 0x12,
0x03, 0x5d, 0x03, 0x0b, 0x05, 0x12, 0x03, 0x5d, 0x03, 0xd1, 0x41, 0xb1, 0x01, 0x90, 0x8c, 0x8e,
0xb1, 0x02, 0x8c, 0xb1, 0x01, 0x87, 0x89, 0x8c, 0x90, 0x8c, 0x8e, 0xb1, 0x02, 0x8c, 0xb1, 0x01,
0x87, 0x89, 0x8c, 0x90, 0x8c, 0x8e, 0xb1, 0x02, 0x8c, 0xb1, 0x01, 0x87, 0x89, 0x8c, 0x90, 0x8c,
0x8e, 0xb1, 0x02, 0x8c, 0xb1, 0x01, 0x87, 0x89, 0x8c, 0x90, 0x8c, 0x8e, 0xb1, 0x02, 0x8c, 0xb1,
0x01, 0x87, 0x89, 0x8c, 0x90, 0x8c, 0x8e, 0xb1, 0x02, 0x8c, 0xb1, 0x01, 0x87, 0x89, 0x8c, 0x90,
0x8c, 0x8e, 0xb1, 0x02, 0x8c, 0xb1, 0x01, 0x87, 0x89, 0x8c, 0x90, 0x8c, 0x8e, 0xb1, 0x02, 0x8c,
0xb1, 0x01, 0x87, 0x89, 0x8c, 0x00, 0xd2, 0x42, 0xb1, 0x02, 0x68, 0x68, 0xb1, 0x01, 0x68, 0xb1,
0x02, 0x68, 0x68, 0x68, 0xb1, 0x01, 0x68, 0xb1, 0x02, 0x68, 0x67, 0x65, 0x65, 0xb1, 0x01, 0x65,
0xb1, 0x02, 0x65, 0x65, 0x65, 0xb1, 0x01, 0x65, 0xb1, 0x02, 0x65, 0x63, 0x61, 0x61, 0xb1, 0x01,
0x61, 0xb1, 0x02, 0x61, 0x61, 0x61, 0xb1, 0x01, 0x61, 0x61, 0x61, 0x60, 0x61, 0xb1, 0x02, 0x63,
0x63, 0xb1, 0x01, 0x63, 0xb1, 0x02, 0x63, 0x63, 0xb1, 0x01, 0x63, 0xb1, 0x02, 0x63, 0x65, 0x67,
0x00, 0xb1, 0x40, 0xd0, 0x00, 0xd5, 0x45, 0xb1, 0x02, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d,
0xd4, 0x44, 0xb1, 0x01, 0x72, 0xd5, 0x45, 0xb1, 0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5,
0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44,
0xb1, 0x01, 0x72, 0xd5, 0x45, 0xb1, 0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0x6d,
0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1, 0x01,
0x72, 0xd5, 0x45, 0xb1, 0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44,
0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1, 0x01, 0x72, 0xd5,
0x45, 0xb1, 0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0x00,
0xd2, 0x42, 0xb1, 0x02, 0x84, 0x84, 0xb1, 0x01, 0x84, 0x82, 0x80, 0xb1, 0x02, 0x82, 0x84, 0x80,
0xb1, 0x01, 0x80, 0xb1, 0x02, 0x7f, 0xb1, 0x01, 0x80, 0x7f, 0x7d, 0x7f, 0x80, 0xb1, 0x02, 0x82,
0x84, 0x82, 0x80, 0xb1, 0x01, 0x80, 0x82, 0x80, 0xb1, 0x03, 0x84, 0xb1, 0x05, 0x82, 0xb1, 0x02,
0x84, 0xb1, 0x01, 0x85, 0xb1, 0x05, 0x82, 0xb1, 0x03, 0x84, 0xb1, 0x05, 0x82, 0xb1, 0x02, 0x84,
0xb1, 0x01, 0x82, 0xb1, 0x02, 0x80, 0xb1, 0x03, 0x7f, 0x00, 0xd6, 0x46, 0xb1, 0x02, 0x7b, 0x79,
0x78, 0xb1, 0x01, 0x79, 0xb1, 0x09, 0x7b, 0xb1, 0x01, 0x7d, 0x7b, 0x7d, 0x7b, 0x7d, 0xb1, 0x02,
0x7b, 0x7d, 0x7b, 0x78, 0x76, 0xb1, 0x01, 0x74, 0xb1, 0x02, 0x78, 0x78, 0x79, 0xb1, 0x01, 0x78,
0xb1, 0x02, 0x7b, 0xb1, 0x01, 0x80, 0x7f, 0x80, 0x7f, 0x7b, 0xb1, 0x02, 0x76, 0x7f, 0x7f, 0x80,
0xb1, 0x01, 0x7f, 0xb1, 0x02, 0x82, 0xb1, 0x01, 0x80, 0x7f, 0x80, 0x7f, 0x7d, 0x7b, 0x79, 0x00,
0xd1, 0x41, 0xb1, 0x01, 0x87, 0x85, 0x84, 0x87, 0x85, 0x84, 0x87, 0x85, 0x87, 0x85, 0x84, 0x87,
0x85, 0x84, 0x87, 0x85, 0xb1, 0x02, 0x8c, 0x8c, 0xb1, 0x01, 0x8c, 0xb1, 0x02, 0x8c, 0x8b, 0x89,
0x89, 0xb1, 0x01, 0x89, 0xb1, 0x02, 0x87, 0xb1, 0x01, 0x85, 0x84, 0x80, 0x85, 0x84, 0x80, 0x85,
0x84, 0x85, 0x84, 0x80, 0x85, 0x84, 0x80, 0x85, 0x84, 0xb1, 0x02, 0x87, 0x87, 0xb1, 0x01, 0x87,
0xb1, 0x02, 0x87, 0x8b, 0xb1, 0x01, 0x8b, 0xb1, 0x02, 0x8b, 0xb1, 0x01, 0x8e, 0x8e, 0xb1, 0x02,
0x8e, 0x00, 0xd2, 0x42, 0xb1, 0x02, 0x5c, 0x5c, 0xb1, 0x01, 0x5c, 0xb1, 0x02, 0x5c, 0x5c, 0x5c,
0xb1, 0x01, 0x5c, 0xb1, 0x02, 0x5c, 0x5b, 0x59, 0x59, 0xb1, 0x01, 0x59, 0xb1, 0x02, 0x59, 0x59,
0x59, 0xb1, 0x01, 0x59, 0xb1, 0x02, 0x59, 0x63, 0x61, 0x61, 0xb1, 0x01, 0x61, 0xb1, 0x02, 0x61,
0x61, 0x61, 0xb1, 0x01, 0x61, 0x61, 0x61, 0x60, 0x61, 0xb1, 0x02, 0x63, 0x63, 0xb1, 0x01, 0x63,
0xb1, 0x02, 0x63, 0x63, 0x63, 0xb1, 0x01, 0x63, 0xb1, 0x02, 0x61, 0x5e, 0x00, 0xd5, 0x45, 0xb1,
0x02, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1, 0x01, 0x72, 0xd5, 0x45, 0xb1,
0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d,
0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1, 0x01, 0x72, 0xd5, 0x45, 0xb1, 0x03, 0x6d,
0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0xb1, 0x01, 0x6d, 0xd4, 0x44, 0xb1, 0x03, 0x72, 0xd5,
0x45, 0xb1, 0x02, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1, 0x01, 0x72, 0xd5,
0x45, 0xb1, 0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5,
0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1, 0x01, 0x72, 0xd5, 0x45, 0xb1,
0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0xb1, 0x01, 0x6d, 0xd4, 0x44, 0xb1, 0x03,
0x72, 0x00, 0x47, 0xb1, 0x40, 0xd0, 0x00, 0xd8, 0x48, 0xb1, 0x02, 0x5c, 0x5c, 0xb1, 0x01, 0x5c,
0xb1, 0x02, 0x5c, 0x5c, 0x5c, 0xb1, 0x01, 0x5c, 0xb1, 0x02, 0x5c, 0x5b, 0x59, 0x59, 0xb1, 0x01,
0x59, 0xb1, 0x02, 0x59, 0x59, 0x59, 0xb1, 0x01, 0x59, 0xb1, 0x02, 0x59, 0x63, 0x61, 0x61, 0xb1,
0x01, 0x61, 0xb1, 0x02, 0x61, 0x61, 0x61, 0xb1, 0x01, 0x61, 0x61, 0x61, 0x60, 0x61, 0xb1, 0x02,
0x63, 0x63, 0xb1, 0x01, 0x63, 0xb1, 0x02, 0x63, 0x63, 0x63, 0xb1, 0x01, 0x63, 0xb1, 0x02, 0x61,
0x5e, 0x00, 0xd5, 0x45, 0xb1, 0x02, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1,
0x01, 0x72, 0xd5, 0x45, 0xb1, 0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0x6d, 0xd4,
0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1, 0x01, 0x72,
0xd5, 0x45, 0xb1, 0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45, 0xb1, 0x01, 0x6d, 0xd4,
0x44, 0xb1, 0x03, 0x72, 0xd5, 0x45, 0xb1, 0x02, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4,
0x44, 0xb1, 0x01, 0x72, 0xd5, 0x45, 0xb1, 0x03, 0x6d, 0xd4, 0x44, 0xb1, 0x02, 0x72, 0xd5, 0x45,
0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0xb1,
0x01, 0x72, 0xd5, 0x45, 0x6d, 0xd4, 0x44, 0x72, 0xd5, 0x45, 0xb1, 0x02, 0x6d, 0xd4, 0x44, 0xb1,
0x01, 0x72, 0xd5, 0x45, 0xb1, 0x02, 0x6d, 0xd4, 0x44, 0xb1, 0x01, 0x72, 0xd5, 0x45, 0x6d, 0x00,
0xd8, 0x48, 0xb1, 0x01, 0x90, 0x90, 0xb1, 0x06, 0x8c, 0xb1, 0x01, 0x90, 0x8c, 0x8e, 0xb1, 0x02,
0x8c, 0xb1, 0x01, 0x8c, 0xb1, 0x02, 0x8b, 0xb1, 0x01, 0x89, 0x8b, 0x8c, 0xb1, 0x05, 0x89, 0xb1,
0x01, 0x87, 0x89, 0x87, 0xb1, 0x05, 0x84, 0xb1, 0x01, 0x91, 0x91, 0xb1, 0x02, 0x91, 0x91, 0xb1,
0x01, 0x90, 0xb1, 0x02, 0x8e, 0x8c, 0xb1, 0x05, 0x89, 0xb1, 0x01, 0x90, 0x8e, 0x90, 0x8e, 0x90,
0xb1, 0x02, 0x8e, 0x91, 0x90, 0x8e, 0x8c, 0xb1, 0x01, 0x87, 0x00, 0xd8, 0x48, 0xb1, 0x01, 0x91,
0x91, 0x91, 0x90, 0x90, 0x90, 0x90, 0x90, 0x8e, 0x8e, 0x8e, 0x90, 0x90, 0x90, 0x90, 0x90, 0x91,
0x91, 0x91, 0x90, 0x90, 0x90, 0x90, 0x90, 0x8c, 0x8c, 0x8c, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x91,
0x91, 0x91, 0xb1, 0x05, 0x90, 0xb1, 0x01, 0x8e, 0x8e, 0x8e, 0xb1, 0x05, 0x90, 0xb1, 0x01, 0x91,
0x91, 0x91, 0xb1, 0x02, 0x90, 0xb1, 0x01, 0x90, 0xb1, 0x02, 0x8e, 0xb1, 0x01, 0x8c, 0x8c, 0x8c,
0xb1, 0x02, 0x8b, 0xb1, 0x01, 0x8b, 0xb1, 0x02, 0x89, 0x00, 0x07, 0x08, 0x01, 0x8f, 0x00, 0x00,
0x01, 0x8f, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00, 0x01, 0x8d, 0x00, 0x00,
0x01, 0x8c, 0x00, 0x00, 0x01, 0x88, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x08, 0x09, 0x01, 0x8d,
0x00, 0x00, 0x01, 0x8e, 0x01, 0x00, 0x01, 0x8f, 0xff, 0xff, 0x01, 0x8e, 0x02, 0x00, 0x01, 0x8d,
0xfe, 0xff, 0x01, 0x8c, 0x03, 0x00, 0x01, 0x8b, 0xfd, 0xff, 0x01, 0x8a, 0x00, 0x00, 0x01, 0x88,
0x00, 0x00, 0x0a, 0x0b, 0x01, 0x8f, 0x00, 0x00, 0x09, 0x1f, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00,
0x09, 0x1d, 0x00, 0x00, 0x01, 0x8d, 0x00, 0x00, 0x09, 0x1d, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00,
0x01, 0x8c, 0x00, 0x00, 0x01, 0x8b, 0x00, 0x00, 0x01, 0x88, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
0x06, 0x07, 0x01, 0x8f, 0x00, 0x00, 0x01, 0x8f, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00, 0x01, 0x8d,
0x00, 0x00, 0x01, 0x8b, 0x00, 0x00, 0x01, 0x88, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x06, 0x07,
0x01, 0x8f, 0x00, 0x00, 0x01, 0x8f, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00,
0x01, 0x8d, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x01, 0x88, 0x00, 0x00, 0x0a, 0x0b, 0x01, 0x8d,
0x00, 0x00, 0x01, 0x8e, 0x01, 0x00, 0x01, 0x8f, 0x02, 0x00, 0x01, 0x8f, 0x00, 0x00, 0x01, 0x8f,
0x01, 0x00, 0x01, 0x8f, 0x02, 0x00, 0x01, 0x8d, 0x03, 0x00, 0x01, 0x8a, 0x02, 0x00, 0x01, 0x88,
0x01, 0x00, 0x01, 0x87, 0x00, 0x00, 0x01, 0x86, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x08, 0x00,
0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x0b, 0x00, 0x00, 0xfb, 0x00,
0xf6, 0x00, 0xf1, 0xec, 0xe7, 0xe2, 0xdd, 0x06, 0x07, 0x00, 0xfb, 0xf6, 0xf1, 0xec, 0xe7, 0xe2,
0x06, 0x07, 0x00, 0x0c, 0x18, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00,
};
const uint8_t dizzy6[] MUSICMEM = {
0x56, 0x6f, 0x72, 0x74, 0x65, 0x78, 0x20, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x49,
0x49, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x20, 0x44, 0x69,
0x7a, 0x7a, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x41, 0x64, 0x76, 0x65, 0x6e, 0x74, 0x75, 0x72,
0x65, 0x72, 0x20, 0x4f, 0x76, 0x65, 0x72, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x20, 0x31, 0x20, 0x62,
0x79, 0x20, 0x31, 0x33, 0x27, 0x6e, 0x69, 0x78, 0x2e, 0x27, 0x6f, 0x72, 0x67, 0x3a, 0x20, 0x4d,
0x61, 0x74, 0x74, 0x20, 0x53, 0x69, 0x6d, 0x6d, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x02, 0x03, 0x12, 0x0a, 0xdc, 0x00, 0x00, 0x00, 0x8f, 0x0a, 0x9d, 0x0a, 0xd3,
0x0a, 0x19, 0x0b, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x0b, 0x00,
0x00, 0x6b, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x0b, 0x00, 0x00, 0x88, 0x0b, 0x8c,
0x0b, 0x93, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12,
0x15, 0x18, 0x1b, 0x24, 0x33, 0x27, 0x1e, 0x21, 0x2a, 0x2d, 0x30, 0xff, 0x48, 0x01, 0x7f, 0x01,
0xeb, 0x01, 0x2d, 0x02, 0x64, 0x02, 0xf8, 0x02, 0x2d, 0x02, 0x51, 0x03, 0xd4, 0x03, 0x01, 0x04,
0x51, 0x03, 0x35, 0x04, 0x01, 0x04, 0x51, 0x03, 0x5b, 0x04, 0x85, 0x04, 0xc4, 0x04, 0x35, 0x04,
0x51, 0x05, 0x88, 0x05, 0x1c, 0x06, 0x4e, 0x06, 0x88, 0x05, 0x82, 0x06, 0x4e, 0x06, 0x88, 0x05,
0x1c, 0x06, 0xb5, 0x06, 0xf3, 0x06, 0x9b, 0x07, 0x85, 0x04, 0xc4, 0x04, 0x43, 0x08, 0x51, 0x05,
0x88, 0x05, 0x6f, 0x08, 0x2d, 0x02, 0x51, 0x03, 0xce, 0x07, 0x01, 0x04, 0x51, 0x03, 0x1c, 0x08,
0x98, 0x08, 0xcc, 0x08, 0x70, 0x09, 0x4e, 0x06, 0x88, 0x05, 0x6f, 0x08, 0x99, 0x09, 0xc1, 0x09,
0x66, 0x0a, 0x01, 0x04, 0x51, 0x03, 0xf8, 0x07, 0xf2, 0x04, 0xc7, 0xb1, 0x04, 0x78, 0xb1, 0x02,
0x78, 0xb1, 0x04, 0x84, 0xb1, 0x02, 0x84, 0xc8, 0xb1, 0x04, 0x77, 0xb1, 0x02, 0x77, 0xb1, 0x04,
0x83, 0xb1, 0x02, 0x83, 0xc9, 0xb1, 0x04, 0x75, 0xb1, 0x02, 0x75, 0xb1, 0x04, 0x81, 0xb1, 0x02,
0x81, 0xca, 0xb1, 0x04, 0x73, 0xb1, 0x02, 0x73, 0xb1, 0x04, 0x7f, 0xb1, 0x02, 0x7f, 0x00, 0x1a,
0x00, 0x53, 0x02, 0x40, 0xb1, 0x04, 0x60, 0xbb, 0x00, 0x53, 0xb1, 0x02, 0x60, 0xbb, 0x00, 0x2a,
0xb1, 0x04, 0x6c, 0xbb, 0x00, 0x2a, 0xb1, 0x02, 0x6c, 0xbb, 0x00, 0x58, 0xb1, 0x04, 0x5f, 0xbb,
0x00, 0x58, 0xb1, 0x02, 0x5f, 0xbb, 0x00, 0x2c, 0xb1, 0x04, 0x6b, 0xbb, 0x00, 0x2c, 0xb1, 0x02,
0x6b, 0xbb, 0x00, 0x63, 0xb1, 0x04, 0x69, 0xbb, 0x00, 0x63, 0xb1, 0x02, 0x69, 0xbb, 0x00, 0x31,
0xb1, 0x04, 0x5d, 0xbb, 0x00, 0x31, 0xb1, 0x02, 0x5d, 0xbb, 0x00, 0x6f, 0xb1, 0x04, 0x5b, 0xbb,
0x00, 0x6f, 0x21, 0xb1, 0x01, 0x5b, 0x22, 0xd0, 0xbb, 0x00, 0x37, 0x23, 0x67, 0x24, 0xd0, 0x25,
0xd0, 0x26, 0xd0, 0xbb, 0x00, 0x37, 0x27, 0x67, 0x28, 0xd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xd0, 0x20, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00, 0x2c, 0x68, 0xbb,
0x00, 0x63, 0xb1, 0x04, 0x68, 0xbb, 0x00, 0x63, 0xb1, 0x02, 0x68, 0xdc, 0xbb, 0x00, 0x31, 0x23,
0xb1, 0x01, 0x74, 0x25, 0xd0, 0x20, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00, 0x31, 0x68, 0xbb, 0x00,
0x6f, 0x23, 0xb1, 0x01, 0x68, 0x25, 0xd0, 0x20, 0xb1, 0x02, 0xd0, 0xdc, 0xbb, 0x00, 0x6f, 0x23,
0xb1, 0x01, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x37, 0x23, 0x74, 0x25, 0xd0, 0x23, 0x74, 0x25, 0xd0,
0xbb, 0x00, 0x37, 0x23, 0x74, 0x25, 0xd0, 0x00, 0xf3, 0x06, 0xcf, 0xb1, 0x02, 0x60, 0xd2, 0x42,
0xc7, 0xb1, 0x04, 0x78, 0xd3, 0x43, 0xcb, 0xb1, 0x02, 0x60, 0xd2, 0x42, 0xc7, 0xb1, 0x04, 0x84,
0xd3, 0x43, 0xc9, 0xb1, 0x02, 0x60, 0xd2, 0x42, 0xc7, 0xb1, 0x04, 0x77, 0xd3, 0x43, 0xb1, 0x02,
0x60, 0xd2, 0x42, 0xb1, 0x04, 0x83, 0xb1, 0x02, 0x83, 0xb1, 0x04, 0x75, 0xd3, 0x43, 0xc9, 0xb1,
0x02, 0x5d, 0xd2, 0x42, 0xc7, 0xb1, 0x04, 0x81, 0xd3, 0x43, 0xcb, 0xb1, 0x02, 0x5b, 0xd2, 0x42,
0xc7, 0xb1, 0x04, 0x73, 0xd3, 0x43, 0xcf, 0xb1, 0x02, 0x5b, 0xd2, 0x42, 0xc7, 0xb1, 0x04, 0x7f,
0x00, 0x1a, 0x00, 0x53, 0x14, 0x40, 0xcf, 0xb1, 0x04, 0x68, 0xbb, 0x00, 0x53, 0xb1, 0x02, 0x68,
0xdc, 0xbb, 0x00, 0x2a, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0x20, 0xb1, 0x02, 0xd0, 0xda, 0xbb,
0x00, 0x2a, 0x68, 0xbb, 0x00, 0x58, 0xb1, 0x04, 0x68, 0xbb, 0x00, 0x58, 0xb1, 0x02, 0x68, 0xdc,
0xbb, 0x00, 0x2c, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0x20, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00,
0x2c, 0x68, 0xbb, 0x00, 0x63, 0xb1, 0x04, 0x68, 0xbb, 0x00, 0x63, 0xb1, 0x02, 0x68, 0xdc, 0xbb,
0x00, 0x31, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0x20, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00, 0x31,
0x68, 0xbb, 0x00, 0x6f, 0xb1, 0x04, 0x68, 0xdc, 0xbb, 0x00, 0x6f, 0x23, 0xb1, 0x01, 0x74, 0x25,
0xd0, 0xbb, 0x00, 0x37, 0x23, 0x74, 0x25, 0xd0, 0x23, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x37, 0x23,
0x74, 0x25, 0xd0, 0x00, 0xf3, 0x06, 0xcf, 0xb1, 0x02, 0x60, 0xd2, 0x42, 0xc9, 0x84, 0xce, 0x84,
0xb1, 0x04, 0x81, 0xb1, 0x02, 0x7c, 0xb1, 0x04, 0x7f, 0xb1, 0x06, 0x81, 0xb1, 0x08, 0x84, 0xca,
0xb1, 0x02, 0x84, 0xce, 0x86, 0x88, 0x86, 0x84, 0xca, 0x81, 0xb1, 0x04, 0x7f, 0xb1, 0x02, 0x7f,
0x00, 0xd2, 0x42, 0xcc, 0xb1, 0x04, 0x78, 0xb1, 0x02, 0x78, 0xb1, 0x04, 0x84, 0xb1, 0x02, 0x84,
0xb1, 0x04, 0x77, 0xb1, 0x02, 0x77, 0xb1, 0x04, 0x83, 0xb1, 0x02, 0x83, 0xb1, 0x04, 0x75, 0xb1,
0x02, 0x75, 0xb1, 0x04, 0x81, 0xb1, 0x02, 0x81, 0xb1, 0x04, 0x73, 0xb1, 0x02, 0x73, 0xb1, 0x04,
0x7f, 0xb1, 0x02, 0x7f, 0x00, 0xf2, 0x04, 0xce, 0xb1, 0x04, 0x84, 0xb1, 0x02, 0x84, 0xb1, 0x04,
0x81, 0xb1, 0x02, 0x7c, 0xb1, 0x04, 0x7f, 0xb1, 0x06, 0x81, 0xb1, 0x08, 0x84, 0xca, 0xb1, 0x02,
0x84, 0xce, 0x86, 0x88, 0x89, 0x88, 0x86, 0x88, 0x86, 0x84, 0x00, 0xf2, 0x04, 0xce, 0xb1, 0x04,
0x84, 0xb1, 0x02, 0x84, 0xb1, 0x04, 0x81, 0xb1, 0x02, 0x7c, 0xb1, 0x04, 0x7f, 0xb1, 0x06, 0x81,
0xb1, 0x08, 0x84, 0xca, 0xb1, 0x02, 0x84, 0xce, 0x86, 0x88, 0x86, 0x84, 0xca, 0x81, 0xb1, 0x04,
0x7f, 0xb1, 0x02, 0x7f, 0x00, 0xd2, 0x42, 0xcc, 0xb1, 0x04, 0x78, 0xb1, 0x02, 0x78, 0xb1, 0x04,
0x84, 0xb1, 0x02, 0x84, 0xb1, 0x04, 0x77, 0xb1, 0x02, 0x77, 0xb1, 0x04, 0x83, 0xb1, 0x02, 0x83,
0xb1, 0x04, 0x75, 0xb1, 0x02, 0x75, 0xcb, 0x81, 0xca, 0xd0, 0xc9, 0x81, 0xc8, 0x73, 0xc7, 0xd0,
0xd4, 0xc8, 0xb1, 0x01, 0x68, 0xc9, 0xd0, 0xca, 0xd0, 0xcb, 0xd0, 0xcc, 0xd0, 0xcd, 0xd0, 0xce,
0xd0, 0xcf, 0xd0, 0x00, 0x1a, 0x00, 0x53, 0x14, 0x40, 0xcf, 0xb1, 0x04, 0x68, 0xbb, 0x00, 0x53,
0xb1, 0x02, 0x68, 0xdc, 0xbb, 0x00, 0x2a, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0x20, 0xb1, 0x02,
0xd0, 0xda, 0xbb, 0x00, 0x2a, 0x68, 0xbb, 0x00, 0x58, 0xb1, 0x04, 0x68, 0xbb, 0x00, 0x58, 0xb1,
0x02, 0x68, 0xdc, 0xbb, 0x00, 0x2c, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0x20, 0xb1, 0x02, 0xd0,
0xda, 0xbb, 0x00, 0x2c, 0x68, 0xbb, 0x00, 0x63, 0xb1, 0x04, 0x68, 0xbb, 0x00, 0x63, 0xb1, 0x02,
0x68, 0xdc, 0xbb, 0x00, 0x31, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0x20, 0xb1, 0x02, 0xd0, 0xda,
0xbb, 0x00, 0x31, 0x68, 0xdc, 0xbb, 0x00, 0x6f, 0x25, 0xb1, 0x01, 0x74, 0x27, 0xd0, 0xda, 0x20,
0xb1, 0x02, 0x68, 0xbb, 0x00, 0x6f, 0x21, 0xb1, 0x01, 0x68, 0x22, 0xd0, 0xdc, 0xbb, 0x00, 0x37,
0x23, 0x74, 0x24, 0xd0, 0xda, 0x25, 0x68, 0x26, 0xd0, 0xbb, 0x00, 0x37, 0x27, 0x68, 0x28, 0xd0,
0x00, 0xf3, 0x06, 0xcf, 0xb1, 0x02, 0x65, 0xcb, 0x65, 0xd2, 0x42, 0xcc, 0x7d, 0xb1, 0x04, 0x89,
0xb1, 0x02, 0x89, 0xb1, 0x04, 0x7d, 0xb1, 0x02, 0x7d, 0xb1, 0x04, 0x89, 0xb1, 0x02, 0x89, 0xb1,
0x04, 0x7f, 0xb1, 0x02, 0x7f, 0xb1, 0x04, 0x8b, 0xb1, 0x02, 0x8b, 0xb1, 0x04, 0x7f, 0xb1, 0x02,
0x7f, 0xb1, 0x04, 0x8b, 0xb1, 0x02, 0x8b, 0x00, 0x1c, 0x00, 0x3e, 0x14, 0x40, 0xcf, 0x26, 0xb1,
0x02, 0x68, 0xbb, 0x00, 0x3e, 0xd0, 0xbb, 0x00, 0x3e, 0x68, 0xdc, 0xbd, 0x00, 0x3e, 0x23, 0xb1,
0x01, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x1f, 0x26, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00, 0x1f, 0x68,
0xbd, 0x00, 0x3e, 0x68, 0xbb, 0x00, 0x3e, 0xd0, 0xbb, 0x00, 0x3e, 0x68, 0xdc, 0xbd, 0x00, 0x3e,
0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x1f, 0x26, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00,
0x1f, 0x68, 0xbd, 0x00, 0x37, 0x68, 0xbb, 0x00, 0x37, 0xd0, 0xbb, 0x00, 0x37, 0x68, 0xdc, 0xbd,
0x00, 0x37, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x1c, 0x26, 0xb1, 0x02, 0xd0, 0xda,
0xbb, 0x00, 0x1c, 0x68, 0xbd, 0x00, 0x37, 0x68, 0xbb, 0x00, 0x37, 0xd0, 0xdc, 0xbb, 0x00, 0x37,
0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xbd, 0x00, 0x37, 0x23, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x1c,
0x23, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x1c, 0x23, 0x74, 0x25, 0xd0, 0x00, 0xf4, 0x06, 0xcf, 0xb1,
0x02, 0x81, 0xca, 0x88, 0xcf, 0x81, 0x83, 0xca, 0x83, 0xcf, 0x83, 0x84, 0xca, 0x84, 0xcf, 0x86,
0xca, 0x86, 0xcf, 0x8d, 0xca, 0x8d, 0xcf, 0x8b, 0xca, 0x8b, 0xcf, 0x88, 0xca, 0x88, 0xcf, 0x86,
0xca, 0x86, 0xcf, 0x83, 0xca, 0xb1, 0x04, 0x83, 0x83, 0xc8, 0xb1, 0x02, 0x83, 0x00, 0xf2, 0x04,
0xcc, 0xb1, 0x04, 0x7d, 0xb1, 0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25, 0xd0, 0xbb,
0x00, 0x1f, 0x26, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00, 0x1f, 0x68, 0xbd, 0x00, 0x3e, 0x68, 0xbb,
0x00, 0x3e, 0xd0, 0xbb, 0x00, 0x3e, 0x68, 0xdc, 0xbd, 0x00, 0x3e, 0x23, 0xb1, 0x01, 0x74, 0x25,
0xd0, 0xbb, 0x00, 0x1f, 0x26, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00, 0x1f, 0x68, 0xdc, 0xbd, 0x00,
0x4a, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xda, 0xbb, 0x00, 0x4a, 0x26, 0xb1, 0x02, 0x68, 0xbb,
0x00, 0x4a, 0x68, 0xdc, 0xbd, 0x00, 0x4a, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xda, 0xbb, 0x00,
0x94, 0x26, 0xb1, 0x02, 0x68, 0xbb, 0x00, 0x94, 0x68, 0xdc, 0xbd, 0x00, 0x4a, 0x23, 0xb1, 0x01,
0x68, 0x25, 0xd0, 0xda, 0xbb, 0x00, 0x4a, 0x26, 0xb1, 0x02, 0x68, 0xbb, 0x00, 0x4a, 0x21, 0xb1,
0x01, 0x68, 0x22, 0xd0, 0xdc, 0xbd, 0x00, 0x4a, 0x23, 0x74, 0x24, 0xd0, 0xbb, 0x00, 0x94, 0x25,
0x74, 0x26, 0xd0, 0xbb, 0x00, 0x94, 0x27, 0x74, 0x28, 0xd0, 0x00, 0xf4, 0x06, 0xcf, 0xb1, 0x02,
0x8d, 0x8b, 0x88, 0x86, 0xca, 0xb1, 0x04, 0x86, 0xcf, 0xb1, 0x02, 0x8d, 0x8b, 0x88, 0x86, 0xca,
0xb1, 0x04, 0x86, 0xcf, 0xb1, 0x02, 0x81, 0xca, 0x81, 0xcf, 0x83, 0xcd, 0x86, 0xcf, 0x84, 0xca,
0x84, 0xcf, 0x86, 0xca, 0x86, 0xcf, 0x84, 0xcd, 0x86, 0xcf, 0x83, 0xca, 0x83, 0x00, 0xf3, 0x06,
0xcf, 0xb1, 0x02, 0x60, 0xd2, 0x42, 0xc9, 0x84, 0xce, 0x84, 0xb1, 0x04, 0x81, 0xb1, 0x02, 0x7c,
0xb1, 0x04, 0x7f, 0xb1, 0x06, 0x81, 0xb1, 0x08, 0x7c, 0xb1, 0x02, 0x84, 0x86, 0x88, 0x89, 0x88,
0x86, 0xb1, 0x04, 0x7f, 0xb1, 0x02, 0x7f, 0x00, 0xf2, 0x04, 0xce, 0xb1, 0x04, 0x84, 0xb1, 0x02,
0x84, 0xb1, 0x04, 0x81, 0xb1, 0x02, 0x7c, 0xb1, 0x04, 0x7f, 0xb1, 0x06, 0x81, 0xb1, 0x08, 0x84,
0xb1, 0x02, 0x84, 0x86, 0x88, 0x89, 0x88, 0x86, 0x88, 0x86, 0x84, 0x00, 0xf2, 0x04, 0xce, 0xb1,
0x04, 0x84, 0xb1, 0x02, 0x84, 0xb1, 0x04, 0x81, 0xb1, 0x02, 0x7c, 0xb1, 0x04, 0x7f, 0xb1, 0x06,
0x81, 0xb1, 0x08, 0x7c, 0xb1, 0x02, 0x84, 0x86, 0x88, 0x89, 0x88, 0x86, 0xb1, 0x04, 0x7f, 0xb1,
0x02, 0x7f, 0x00, 0xf2, 0x04, 0xce, 0xb1, 0x04, 0x84, 0xb1, 0x02, 0x84, 0xb1, 0x04, 0x81, 0xb1,
0x02, 0x7c, 0xb1, 0x04, 0x7f, 0xb1, 0x06, 0x81, 0x84, 0xb1, 0x02, 0x88, 0xca, 0x7c, 0xce, 0x86,
0xca, 0x7a, 0xce, 0x84, 0xca, 0x78, 0xce, 0x83, 0xca, 0x77, 0xce, 0x81, 0xca, 0x77, 0x00, 0xf4,
0x06, 0xcf, 0xb1, 0x02, 0x8d, 0xca, 0x8d, 0xcf, 0x89, 0x8d, 0xca, 0x8d, 0xcf, 0x89, 0x8d, 0xca,
0x8d, 0xcf, 0x89, 0x8d, 0xca, 0x8d, 0xcf, 0x89, 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x23, 0xb1, 0x01, 0x68, 0x25, 0xd0, 0xbb, 0x00, 0x4a, 0x26, 0xb1, 0x02, 0xd0,
0xdc, 0xbb, 0x00, 0x4a, 0x21, 0xb1, 0x01, 0x74, 0x22, 0xd0, 0xbd, 0x00, 0x4a, 0x23, 0x74, 0x24,
0xd0, 0xbb, 0x00, 0x94, 0x25, 0x74, 0x26, 0xd0, 0xbb, 0x00, 0x94, 0x27, 0x74, 0x28, 0xd0, 0x00,
0xf4, 0x06, 0xcf, 0xb1, 0x02, 0x8d, 0xca, 0x8d, 0xcf, 0x89, 0x8d, 0xca, 0x8d, 0xcf, 0x89, 0x8d,
0xca, 0x8d, 0xcf, 0x89, 0x8d, 0xca, 0x8d, 0xcf, 0x89, 0xd5, 0x42, 0xce, 0x86, 0x88, 0x89, 0x88,
0x86, 0x84, 0x86, 0x88, 0x89, 0x88, 0x86, 0x84, 0x00, 0xf2, 0x04, 0xcc, 0xb1, 0x04, 0x7d, 0xb1,
0x02, 0x7d, 0xb1, 0x04, 0x89, 0xb1, 0x02, 0x89, 0xb1, 0x04, 0x7d, 0xb1, 0x02, 0x7d, 0xb1, 0x04,
0x89, 0xb1, 0x02, 0x89, 0x7a, 0x78, 0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70, 0x6f, 0x6e,
0x00, 0x1c, 0x00, 0x3e, 0x14, 0x40, 0xcf, 0x26, 0xb1, 0x02, 0x68, 0xbb, 0x00, 0x3e, 0xd0, 0xbb,
0x00, 0x3e, 0x68, 0xdc, 0xbd, 0x00, 0x3e, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x1f,
0x26, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00, 0x1f, 0x68, 0xbd, 0x00, 0x3e, 0x68, 0xbb, 0x00, 0x3e,
0xd0, 0xbb, 0x00, 0x3e, 0x68, 0xdc, 0xbd, 0x00, 0x3e, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xbb,
0x00, 0x1f, 0x26, 0xb1, 0x02, 0xd0, 0xda, 0xbb, 0x00, 0x1f, 0x68, 0xdc, 0xbb, 0x00, 0x25, 0x23,
0xb1, 0x01, 0x74, 0x25, 0xd0, 0xda, 0xbb, 0x00, 0x2a, 0x26, 0xb1, 0x02, 0x68, 0xbb, 0x00, 0x2c,
0x68, 0xdc, 0xbb, 0x00, 0x2f, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xda, 0xbb, 0x00, 0x31, 0x26,
0xb1, 0x02, 0x68, 0xbb, 0x00, 0x34, 0x68, 0xdc, 0xbb, 0x00, 0x37, 0x23, 0xb1, 0x01, 0x68, 0x25,
0xd0, 0xda, 0xbb, 0x00, 0x3b, 0x26, 0xb1, 0x02, 0x68, 0xbb, 0x00, 0x3e, 0x68, 0xdc, 0xbb, 0x00,
0x42, 0x23, 0xb1, 0x01, 0x74, 0x25, 0xd0, 0xbb, 0x00, 0x46, 0x23, 0x74, 0x25, 0xd0, 0xbb, 0x00,
0x4a, 0x23, 0x74, 0x25, 0xd0, 0x00, 0xf4, 0x06, 0xcf, 0xb1, 0x02, 0x8d, 0xca, 0x8d, 0xcf, 0x89,
0x8d, 0xca, 0x8d, 0xcf, 0x89, 0x8d, 0xca, 0x8d, 0xcf, 0x89, 0x8d, 0xca, 0x8d, 0xcf, 0x89, 0xd5,
0x42, 0xce, 0x86, 0x84, 0x83, 0x82, 0x81, 0x80, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x00, 0x02,
0x03, 0x00, 0x8f, 0x12, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x0c, 0x0d, 0x01,
0x8d, 0x00, 0x00, 0x01, 0x8d, 0x03, 0x00, 0x01, 0x8d, 0x00, 0x00, 0x01, 0x8d, 0xfd, 0xff, 0x01,
0x8d, 0x00, 0x00, 0x01, 0x8c, 0x03, 0x00, 0x01, 0x8b, 0x00, 0x00, 0x01, 0x8a, 0xfd, 0xff, 0x01,
0x89, 0x00, 0x00, 0x01, 0x87, 0x03, 0x00, 0x01, 0x85, 0x00, 0x00, 0x01, 0x82, 0xfd, 0xff, 0x01,
0x80, 0x00, 0x00, 0x10, 0x11, 0x01, 0x8f, 0x00, 0x00, 0x01, 0x0f, 0x00, 0x00, 0x01, 0x0e, 0x00,
0x00, 0x01, 0x0d, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x01, 0x0a, 0x00,
0x00, 0x01, 0x09, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x01, 0x07, 0x00, 0x00, 0x01, 0x06, 0x00,
0x00, 0x01, 0x05, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x01, 0x02, 0x00,
0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x01, 0x01, 0x1f, 0x00, 0x00, 0x0c,
0x0d, 0x01, 0x8d, 0x00, 0x00, 0x01, 0x0d, 0x03, 0x00, 0x01, 0x0d, 0x00, 0x00, 0x01, 0x8d, 0xfd,
0xff, 0x01, 0x8d, 0x00, 0x00, 0x01, 0x8c, 0x03, 0x00, 0x01, 0x8b, 0x00, 0x00, 0x01, 0x8a, 0xfd,
0xff, 0x01, 0x89, 0x00, 0x00, 0x01, 0x87, 0x03, 0x00, 0x01, 0x85, 0x00, 0x00, 0x01, 0x82, 0xfd,
0xff, 0x01, 0x80, 0x00, 0x00, 0x04, 0x05, 0x01, 0xcf, 0x00, 0x01, 0x01, 0xce, 0x00, 0x01, 0x01,
0xcd, 0x00, 0x01, 0x01, 0xcc, 0x00, 0x01, 0x00, 0x90, 0x00, 0x00, 0x05, 0x06, 0x0d, 0x6f, 0x64,
0x00, 0x01, 0xcf, 0x64, 0x00, 0x01, 0x4e, 0x28, 0x01, 0x81, 0x4d, 0x32, 0x00, 0x01, 0x4d, 0x32,
0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x00, 0x00, 0x05, 0x30, 0x24,
0x18, 0x0c, 0x00, 0x04, 0x05, 0x00, 0x0c, 0x00, 0x0c, 0x00,
};
const uint8_t dizzy_sack[] MUSICMEM = {
0x56, 0x6f, 0x72, 0x74, 0x65, 0x78, 0x20, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x49,
0x49, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x20, 0x53, 0x70,
0x65, 0x63, 0x69, 0x61, 0x6c, 0x20, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x20, 0x66, 0x6f, 0x72, 0x20,
0x44, 0x69, 0x7a, 0x7a, 0x79, 0x20, 0x53, 0x2e, 0x41, 0x2e, 0x43, 0x2e, 0x4b, 0x2e, 0x20, 0x62,
0x79, 0x20, 0x4b, 0x61, 0x72, 0x62, 0x6f, 0x66, 0x6f, 0x73, 0x27, 0x32, 0x30, 0x30, 0x36, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x02, 0x03, 0x1b, 0x01, 0xe5, 0x00, 0x00, 0x00, 0x60, 0x0b, 0x66, 0x0b, 0x74,
0x0b, 0x7a, 0x0b, 0x80, 0x0b, 0x86, 0x0b, 0x90, 0x0b, 0x00, 0x00, 0xb6, 0x0b, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x0b, 0xcb, 0x0b, 0xd0, 0x0b, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x0b, 0x00, 0x00, 0x03, 0x06, 0x09, 0x06, 0x0c,
0x0f, 0x12, 0x0f, 0x12, 0x15, 0x15, 0x18, 0x18, 0x1b, 0x1b, 0x1e, 0x1e, 0x21, 0x21, 0x1b, 0x1b,
0x18, 0x18, 0x15, 0x15, 0xff, 0x2d, 0x01, 0x31, 0x01, 0xa1, 0x01, 0xc7, 0x01, 0xcb, 0x01, 0x05,
0x02, 0x27, 0x02, 0x1c, 0x03, 0x56, 0x03, 0x78, 0x03, 0x00, 0x04, 0x37, 0x04, 0x59, 0x04, 0x00,
0x04, 0x37, 0x04, 0x2c, 0x05, 0xcb, 0x01, 0x05, 0x02, 0x50, 0x05, 0x72, 0x05, 0xab, 0x05, 0xcd,
0x05, 0x52, 0x06, 0x8d, 0x06, 0xd2, 0x06, 0x52, 0x06, 0x8d, 0x06, 0x57, 0x07, 0x52, 0x06, 0x8d,
0x06, 0xda, 0x07, 0x5f, 0x08, 0x9a, 0x08, 0x9d, 0x09, 0x22, 0x0a, 0x5d, 0x0a, 0xb1, 0x40, 0xc0,
0x00, 0xff, 0x02, 0xcf, 0x09, 0xb1, 0x01, 0x61, 0x06, 0xc0, 0x61, 0xc0, 0xd7, 0xb1, 0x02, 0x74,
0xd1, 0xb1, 0x01, 0x5e, 0xc0, 0x61, 0xc0, 0x61, 0xc0, 0xd7, 0xb1, 0x02, 0x74, 0xd1, 0xb1, 0x01,
0x5e, 0xc0, 0x61, 0xc0, 0x61, 0xc0, 0xd7, 0xb1, 0x02, 0x74, 0xd1, 0xb1, 0x01, 0x5e, 0xc0, 0x61,
0xc0, 0x61, 0xc0, 0xd7, 0xb1, 0x02, 0x74, 0xd1, 0xb1,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04, 0x79, 0xb1, 0x02, 0x79, 0x00, 0xff, 0x06, 0xcf, 0xb1, 0x01, 0x85, 0x01, 0xd0, 0x02,
0x01, 0x00, 0xd1, 0x01, 0x85, 0x01, 0xff, 0xff, 0x01, 0xd0, 0x01, 0x01, 0x00, 0xb1, 0x02, 0x82,
0xc8, 0x85, 0xd3, 0xcf, 0xb1, 0x01, 0x80, 0x01, 0xd0, 0x02, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd,
0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xd1, 0xb1, 0x03, 0x80, 0xca, 0xb1, 0x01, 0x7e, 0xd3, 0xcf,
0x7d, 0x01, 0xd0, 0x02, 0x02, 0x00, 0x01, 0xd0, 0x01, 0xfe, 0xff, 0x01, 0xd0, 0x01, 0x02, 0x00,
0x01, 0xd0, 0x01, 0xfe, 0xff, 0x01, 0xd0, 0x01, 0x02, 0x00, 0xd1, 0x01, 0x7d, 0x01, 0xfe, 0xff,
0x01, 0xd0, 0x01, 0x02, 0x00, 0xb1, 0x02, 0x7b, 0xc8, 0x7d, 0xd3, 0xcf, 0xb1, 0x01, 0x7d, 0x01,
0xd0, 0x02, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0x01, 0xd0,
0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01,
0x03, 0x00, 0x80, 0x01, 0xd0, 0x02, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01,
0x03, 0x00, 0xc8, 0xb1, 0x04, 0x7d, 0xcf, 0xb1, 0x01, 0x7d, 0x01, 0xd0, 0x02, 0x03, 0x00, 0x01,
0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xce, 0x01, 0xd0, 0x01, 0x0a, 0x00, 0xcd,
0xd0, 0xcc, 0xd0, 0xcb, 0xd0, 0xc8, 0x7d, 0x01, 0xd0, 0x02, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd,
0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xcf, 0x7b, 0x01, 0xd0, 0x02, 0x03, 0x00, 0x01, 0xd0, 0x01,
0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03,
0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0x00, 0xd1, 0x09, 0xb1, 0x02,
0x61, 0x03, 0xc0, 0x61, 0xc0, 0xd7, 0xb1, 0x04, 0x74, 0xd1, 0xb1, 0x02, 0x5e, 0xc0, 0x61, 0xc0,
0x61, 0xc0, 0xd7, 0xb1, 0x04, 0x74, 0xd1, 0xb1, 0x02, 0x5e, 0xc0, 0x61, 0xc0, 0x61, 0xc0, 0xd7,
0xb1, 0x04, 0x74, 0xd1, 0xb1, 0x02, 0x5e, 0xc0, 0x61, 0xc0, 0x61, 0xc0, 0xd7, 0xb1, 0x04, 0x74,
0xd1, 0xb1, 0x02, 0x5e, 0xc0, 0x00, 0xd2, 0x42, 0xca, 0xb1, 0x04, 0x79, 0xb1, 0x08, 0x79, 0xb1,
0x04, 0x79, 0x79, 0xb1, 0x08, 0x79, 0xb1, 0x04, 0x79, 0x79, 0xb1, 0x08, 0x79, 0xb1, 0x04, 0x79,
0x79, 0xb1, 0x08, 0x79, 0xb1, 0x04, 0x79, 0x00, 0xd3, 0xb1, 0x01, 0x7d, 0x01, 0xd0, 0x02, 0x03,
0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xce, 0x01, 0xd0, 0x01, 0xfd,
0xff, 0xcd, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xcc, 0xd0, 0xcb, 0xd0, 0xcf, 0x02, 0xb1, 0x02, 0x80,
0x01, 0x2e, 0x00, 0xf1, 0xff, 0x01, 0xd0, 0x01, 0x01, 0x00, 0xb1, 0x01, 0x7d, 0x01, 0xd0, 0x02,
0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xc8, 0xb1, 0x04, 0x80,
0x7d, 0xcf, 0xb1, 0x01, 0x7b, 0x01, 0xd0, 0x02, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01,
0xd0, 0x01, 0x03, 0x00, 0x80, 0x01, 0xd0, 0x02, 0x02, 0x00, 0x01, 0xd0, 0x01, 0xfe, 0xff, 0x01,
0xd0, 0x01, 0x02, 0x00, 0x01, 0xd0, 0x01, 0xfe, 0xff, 0x01, 0xd0, 0x01, 0x02, 0x00, 0x01, 0xd0,
0x01, 0xfe, 0xff, 0x01, 0xd0, 0x01, 0x02, 0x00, 0x01, 0xb1, 0x1c, 0xc0, 0x01, 0xfe, 0xff, 0x00,
0xd1, 0xb1, 0x02, 0x5c, 0xc0, 0x5c, 0xc0, 0xd7, 0xb1, 0x04, 0x74, 0xd1, 0xb1, 0x02, 0x57, 0xc0,
0x5c, 0xc0, 0x5c, 0xc0, 0xd7, 0xb1, 0x04, 0x74, 0xd1, 0xb1, 0x02, 0x57, 0xc0, 0x5c, 0xc0, 0x5c,
0xc0, 0xd7, 0xb1, 0x04, 0x74, 0xd1, 0xb1, 0x02, 0x57, 0xc0, 0x5c, 0xc0, 0x5c, 0xc0, 0xd7, 0x74,
0xca, 0x74, 0xcf, 0x74, 0xcd, 0x74, 0x00, 0xd2, 0x42, 0xca, 0xb1, 0x04, 0x74, 0xb1, 0x08, 0x74,
0xb1, 0x04, 0x74, 0x74, 0xb1, 0x08, 0x74, 0xb1, 0x04, 0x74, 0x74, 0xb1, 0x08, 0x74, 0xb1, 0x04,
0x74, 0x74, 0xb1, 0x08, 0x74, 0xb1, 0x04, 0x74, 0x00, 0xd3, 0xb1, 0x01, 0x7d, 0x01, 0xd0, 0x02,
0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xce, 0x01, 0xd0, 0x01,
0xfd, 0xff, 0xcd, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xcc, 0xd0, 0xcb, 0xd0, 0xcf, 0x02, 0xb1, 0x02,
0x80, 0x01, 0x2e, 0x00, 0xf1, 0xff, 0x01, 0xd0, 0x01, 0x01, 0x00, 0xb1, 0x01, 0x7d, 0x01, 0xd0,
0x02, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff, 0x01, 0xd0, 0x01, 0x03, 0x00, 0xc8, 0xb1, 0x04,
0x80, 0x7d, 0xcf, 0xb1, 0x01, 0x7b, 0x01, 0xd0, 0x02, 0x03, 0x00, 0x01, 0xd0, 0x01, 0xfd, 0xff,
0x01, 0xd0, 0x01, 0x03, 0x00, 0x84, 0x01, 0xd0, 0x02, 0x02, 0x00, 0x01, 0xd0, 0x01, 0xfe, 0xff,
0x01, 0xd0, 0x01, 0x02, 0x00, 0x01, 0xd0, 0x01, 0xfe, 0xff, 0x01, 0xb1, 0x03, 0xd0, 0x01, 0x07,
0x00, 0xc8, 0xb1, 0x04, 0x84, 0x7b, 0xb1, 0x03, 0x84, 0xb1, 0x01, 0x84, 0xcf, 0x02, 0x85, 0x01,
0x09, 0x00, 0xfd, 0xff, 0x01, 0xd0, 0x02, 0x02, 0x00, 0x01, 0xd0, 0x01, 0xfe, 0xff, 0x01, 0xd0,
0x01, 0x02, 0x00, 0x01, 0xd0, 0x01, 0xfe, 0xff, 0x01, 0xd0, 0x01, 0x02, 0x00, 0x01, 0xd0, 0x01,
0xfe, 0xff, 0x01, 0xd0, 0x01, 0x02, 0x00, 0x87, 0x01, 0xd0, 0x02, 0x02, 0x00, 0x01, 0xd0, 0x01,
0xfe, 0xff, 0x01, 0xd0, 0x01, 0x02, 0x00, 0x01, 0xd0, 0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 0x63, 0xbb, 0x00, 0x27, 0x55, 0xbd, 0x00,
0x27, 0x61, 0xbb, 0x00, 0x27, 0x55, 0x00, 0x1c, 0x00, 0x0d, 0x08, 0x40, 0xb1, 0x02, 0x74, 0xbd,
0x00, 0x10, 0xb1, 0x01, 0x71, 0xbb, 0x00, 0x27, 0x55, 0xbd, 0x00, 0x14, 0xb1, 0x02, 0x6d, 0xbd,
0x00, 0x10, 0xb1, 0x01, 0x71, 0xbb, 0x00, 0x27, 0x55, 0xbd, 0x00, 0x0f, 0xb1, 0x02, 0x72, 0xbd,
0x00, 0x14, 0xb1, 0x01, 0x6d, 0xbb, 0x00, 0x1d, 0x5a, 0xbd, 0x00, 0x0a, 0xb1, 0x02, 0x78, 0xbd,
0x00, 0x34, 0xb1, 0x01, 0x5c, 0xbb, 0x00, 0x1d, 0x5a, 0xbd, 0x00, 0x11, 0xb1, 0x02, 0x6f, 0xbd,
0x00, 0x14, 0xb1, 0x01, 0x6d, 0xbb, 0x00, 0x1a, 0x5c, 0xbd, 0x00, 0x15, 0xb1, 0x02, 0x6c, 0xbd,
0x00, 0x17, 0xb1, 0x01, 0x6a, 0xbb, 0x00, 0x1a, 0x5c, 0xbd, 0x00, 0x1a, 0xb1, 0x02, 0x68, 0xbd,
0x00, 0x1f, 0xb1, 0x01, 0x65, 0xbb, 0x00, 0x27, 0x55, 0xbd, 0x00, 0x23, 0x63, 0xbb, 0x00, 0x27,
0x55, 0xbd, 0x00, 0x27, 0x61, 0xbb, 0x00, 0x27, 0x55, 0x00, 0x1c, 0x00, 0x27, 0x0a, 0x40, 0xb1,
0x02, 0x61, 0xbb, 0x00, 0x27, 0x55, 0xbd, 0x00, 0x23, 0x63, 0xbb, 0x00, 0x27, 0x55, 0xbd, 0x00,
0x1f, 0x65, 0xbb, 0x00, 0x27, 0x55, 0xbd, 0x00, 0x27, 0x61, 0xbb, 0x00, 0x27, 0x55, 0xbd, 0x00,
0x1d, 0x66, 0xbb, 0x00, 0x1d, 0x5a, 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, 0x79, 0xd6, 0x41, 0xcf, 0x71,
0xd3, 0x42, 0xca, 0x79, 0xd6, 0x41, 0xcc, 0x68, 0xd3, 0x42, 0xca, 0x79, 0xd6, 0x41, 0xcf, 0x68,
0xd3, 0x42, 0xca, 0x79, 0xd6, 0x41, 0xcc, 0x71, 0xd3, 0x42, 0xca, 0x79, 0x00, 0x1c, 0x00, 0x23,
0x0a, 0x40, 0xb1, 0x02, 0x63, 0xbb, 0x00, 0x23, 0x57, 0xbd, 0x00, 0x1f, 0x65, 0xbb, 0x00, 0x23,
0x57, 0xbd, 0x00, 0x1c, 0x67, 0xbb, 0x00, 0x23, 0x57, 0xbd, 0x00, 0x23, 0x63, 0xbb, 0x00, 0x23,
0x57, 0xbd, 0x00, 0x1a, 0x68, 0xbb, 0x00, 0x1a, 0x5c, 0xbd, 0x00, 0x14, 0x6c, 0xbb, 0x00, 0x1a,
0x5c, 0xbd, 0x00, 0x12, 0x6f, 0xbb, 0x00, 0x1a, 0x5c, 0xbd, 0x00, 0x14, 0x6c, 0xbb, 0x00, 0x1a,
0x5c, 0xbd, 0x00, 0x17, 0x6a, 0xbb, 0x00, 0x17, 0x5e, 0xbd, 0x00, 0x13, 0x6e, 0xbb, 0x00, 0x17,
0x5e, 0xbd, 0x00, 0x0f, 0x71, 0xbb, 0x00, 0x17, 0x5e, 0xbd, 0x00, 0x13, 0x6e, 0xbb, 0x00, 0x17,
0x5e, 0xbd, 0x00, 0x12, 0x6f, 0xbb, 0x00, 0x23, 0x57, 0xbd, 0x00, 0x14, 0x6c, 0xbb, 0x00, 0x23,
0x57, 0xbd, 0x00, 0x17, 0x6a, 0xbb, 0x00, 0x23, 0x57, 0xbd, 0x00, 0x1c, 0x67, 0xbb, 0x00, 0x23,
0x57, 0x00, 0xd1, 0xcf, 0x09, 0xb1, 0x02, 0x63, 0x03, 0xc0, 0x63, 0xc0, 0xd7, 0xb1, 0x04, 0x76,
0xd1, 0xb1, 0x02, 0x60, 0xc0, 0x68, 0xc0,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,
0x41, 0xcc, 0x6a, 0xd3, 0x42, 0xca, 0x82, 0xd6, 0x41, 0xcf, 0x71, 0xd3, 0x42, 0xca, 0x82, 0xd6,
0x41, 0xcc, 0x74, 0xd3, 0x42, 0xca, 0x82, 0xd6, 0x41, 0xcf, 0x6a, 0xd3, 0x42, 0xca, 0x82, 0xd6,
0x41, 0xcf, 0x6a, 0xd3, 0x42, 0xca, 0x82, 0xd6, 0x41, 0xcc, 0x74, 0xd3, 0x42, 0xca, 0x82, 0xd6,
0x41, 0xcf, 0x6f, 0xd3, 0x42, 0xca, 0x7b, 0xd6, 0x41, 0xcc, 0x6a, 0xd3, 0x42, 0xca, 0x7b, 0xd6,
0x41, 0xcf, 0x6a, 0xd3, 0x42, 0xca, 0x7b, 0xd6, 0x41, 0xcc, 0x6f, 0xd3, 0x42, 0xca, 0x7b, 0xd6,
0x41, 0xcf, 0x73, 0xd3, 0x42, 0xca, 0x7b, 0xd6, 0x41, 0xcc, 0x6a, 0xd3, 0x42, 0xca, 0x7b, 0xd6,
0x41, 0xcf, 0x6a, 0xd3, 0x42, 0xca, 0x7b, 0xd6, 0x41, 0xcc, 0x73, 0xd3, 0x42, 0xca, 0x7b, 0x00,
0x00, 0x01, 0x81, 0x8f, 0x00, 0x00, 0x02, 0x03, 0x01, 0x0f, 0x00, 0x00, 0x01, 0x0f, 0x00, 0x00,
0x01, 0x8f, 0x00, 0x00, 0x00, 0x01, 0x01, 0x8f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0x00, 0x00,
0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x01, 0x8f, 0x00, 0x00, 0x81, 0x8f, 0x00, 0x00,
0x08, 0x09, 0x09, 0x0f, 0x32, 0x00, 0x01, 0x8f, 0x64, 0x00, 0x15, 0x0f, 0x96, 0x00, 0x15, 0x0e,
0xc8, 0x00, 0x17, 0x0d, 0xfa, 0x00, 0x19, 0x0c, 0x2c, 0x01, 0x1b, 0x1b, 0x5e, 0x01, 0x1d, 0x1a,
0x90, 0x01, 0x01, 0x99, 0x68, 0x01, 0x03, 0x04, 0x01, 0x17, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00,
0x01, 0x13, 0x00, 0x00, 0x81, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x03, 0x13, 0x13, 0x00,
0x00, 0x03, 0x00, 0x04, 0x07, 0x00, 0x01, 0x00,
};
const uint8_t kukushka[] MUSICMEM = {
0x50, 0x72, 0x6f, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x33, 0x2e, 0x35, 0x20, 0x63,
0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x56, 0x2e,
0x43, 0x6f, 0x79, 0x20, 0x22, 0x4b, 0x75, 0x6b, 0x75, 0x73, 0x68, 0x6b, 0x61, 0x22, 0x20, 0x3c,
0x72, 0x4d, 0x78, 0x3e, 0x20, 0x68, 0x21, 0x20, 0x66, 0x41, 0x6e, 0x5a, 0x3b, 0x29, 0x20, 0x62,
0x79, 0x20, 0x4d, 0x6d, 0x3c, 0x4d, 0x20, 0x6f, 0x66, 0x20, 0x53, 0x61, 0x67, 0x65, 0x20, 0x31,
0x39, 0x2e, 0x44, 0x65, 0x63, 0x2e, 0x58, 0x58, 0x20, 0x74, 0x77, 0x72, 0x20, 0x32, 0x31, 0x3a,
0x31, 0x35, 0x20, 0x02, 0x03, 0x19, 0x02, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x0e, 0x03,
0x0f, 0x19, 0x0f, 0x23, 0x0f, 0x31, 0x0f, 0x3f, 0x0f, 0x45, 0x0f, 0x00, 0x00, 0x63, 0x0f, 0x71,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x0f, 0x7a, 0x0f, 0x00, 0x00, 0x85,
0x0f, 0x8a, 0x0f, 0x8f, 0x0f, 0x93, 0x0f, 0x9b, 0x0f, 0xa3, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x09, 0x06, 0x09, 0x06,
0x09, 0x0c, 0x0f, 0x12, 0x15, 0x18, 0x1b, 0x1e, 0x21, 0x24, 0x15, 0x27, 0x21, 0x2a, 0x15, 0x2d,
0x06, 0x09, 0xff, 0x43, 0x01, 0x4c, 0x01, 0x8d, 0x01, 0xd6, 0x01, 0xee, 0x01, 0x2d, 0x02, 0x76,
0x02, 0xf4, 0x02, 0x38, 0x03, 0x3b, 0x04, 0xee, 0x01, 0xb9, 0x04, 0xbc, 0x05, 0x30, 0x06, 0x6a,
0x06, 0x6d, 0x07, 0xe1, 0x07, 0x6a, 0x06, 0x27, 0x08, 0x9b, 0x08, 0xe5, 0x08, 0x6d, 0x07, 0xe8,
0x09, 0x35, 0x0a, 0x6d, 0x07, 0x34, 0x0b, 0x6a, 0x06, 0x6d, 0x07, 0x66, 0x0b, 0x6a, 0x06, 0xa1,
0x0b, 0x18, 0x0c, 0xe5, 0x08, 0x6d, 0x07, 0x62, 0x0c, 0x35, 0x0a, 0xaf, 0x0c, 0x23, 0x0d, 0xe5,
0x08, 0x27, 0x08, 0x73, 0x0d, 0xe5, 0x08, 0xa5, 0x0d, 0x1c, 0x0e, 0xe5, 0x08, 0x6c, 0x0e, 0xe1,
0x0e, 0xe5, 0x08, 0xf3, 0x16, 0xc9, 0xb1, 0x20, 0x7d, 0x44, 0x80, 0x00, 0xf5, 0x14, 0xcf, 0xb1,
0x04, 0x7d, 0xcc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x04, 0x71, 0xd4, 0x08, 0xb1, 0x02, 0x80, 0x01, 0x01, 0x00, 0x80,
0x00, 0xf1, 0x14, 0xcf, 0xb1, 0x04, 0x84, 0xcc, 0xb1, 0x02, 0x82, 0x84, 0xcf, 0xb1, 0x04, 0x84,
0xcc, 0xb1, 0x02, 0x82, 0xb1, 0x04, 0x84, 0xcb, 0xb1, 0x02, 0x82, 0xb1, 0x04, 0x84, 0xca, 0xb1,
0x02, 0x82, 0xb1, 0x04, 0x84, 0xc9, 0xb1, 0x02, 0x82, 0xb1, 0x04, 0x84, 0xc8, 0xb1, 0x02, 0x82,
0xb1, 0x06, 0x84, 0xcf, 0xb1, 0x04, 0x84, 0x84, 0xcc, 0xb1, 0x02, 0x82, 0x84, 0xcf, 0xb1, 0x04,
0x80, 0xcc, 0xb1, 0x02, 0x84, 0x80, 0x00, 0xf0, 0x04, 0xbd, 0x00, 0x8c, 0xcf, 0xb1, 0x04, 0x71,
0xf7, 0x0a, 0x82, 0xf0, 0x08, 0xbd, 0x00, 0x46, 0xb1, 0x02, 0x6f, 0xf7, 0x0a, 0xcc, 0x82, 0xf0,
0x08, 0xbd, 0x00, 0x8c, 0xcf, 0x63, 0xbd, 0x00, 0x46, 0x6f, 0x10, 0x06, 0xb1, 0x04, 0x7d, 0x1c,
0x00, 0x8c, 0x08, 0x63, 0x1c, 0x00, 0x46, 0x04, 0x71, 0x1c, 0x00, 0x8c, 0x08, 0xb1, 0x02, 0x63,
0x76, 0x1c, 0x00, 0x9d, 0x04, 0xb1, 0x04, 0x71, 0xf7, 0x0a, 0x80, 0xf0, 0x08, 0xbd, 0x00, 0x4e,
0xb1, 0x02, 0x6d, 0xf7, 0x0a, 0xcc, 0x80, 0xf0, 0x08, 0xbd, 0x00, 0x9d, 0xcf, 0x61, 0xbd, 0x00,
0x4e, 0x6d, 0x10, 0x06, 0xb1, 0x04, 0x7d, 0x1c, 0x00, 0x9d, 0x08, 0x61, 0x1c, 0x00, 0x34, 0x04,
0x71, 0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 0x02, 0x7f, 0x80, 0xcf, 0xb1, 0x04,
0x7d, 0x7d, 0xcd, 0x7d, 0xcf, 0x85, 0xcc, 0xb1, 0x02, 0x7d, 0x85, 0x00, 0xf0, 0x04, 0xbd, 0x00,
0x8c, 0xcf, 0xb1, 0x04, 0x71, 0xf7, 0x0a, 0x82, 0xf0, 0x08, 0xbd, 0x00, 0x46, 0xb1, 0x02, 0x6f,
0xf7, 0x0a, 0xcc, 0x82, 0xf0, 0x08, 0xbd, 0x00, 0x8c, 0xcf, 0x63, 0xbd, 0x00, 0x46, 0x6f, 0x10,
0x06, 0xb1, 0x04, 0x7d, 0x1c, 0x00, 0x8c, 0x08, 0x63, 0x1c, 0x00, 0x2f, 0x04, 0x71, 0xd4, 0x08,
0xb1, 0x02, 0x76, 0x01, 0x03, 0x00, 0x76, 0x1c, 0x00, 0x9d, 0x04, 0xb1, 0x04, 0x71, 0xf7, 0x0a,
0x80, 0xf0, 0x08, 0xbd, 0x00, 0x4e, 0xb1, 0x02, 0x6d, 0xf7, 0x0a, 0xcc, 0x80, 0xf0, 0x08, 0xbd,
0x00, 0x9d, 0xcf, 0x61, 0xbd, 0x00, 0x4e, 0x6d, 0x10, 0x06, 0xb1, 0x04, 0x7d, 0x1c, 0x00, 0x9d,
0x08, 0x61, 0x1c, 0x00, 0x34, 0x04, 0x71, 0xd4, 0x08, 0xb1, 0x02, 0x74, 0x01, 0x03, 0x00, 0x74,
0x00, 0xf7, 0x10, 0xcf, 0xb1, 0x20, 0x82, 0xb1, 0x18, 0x80, 0xf1, 0x14, 0xb1, 0x04, 0x80, 0xcc,
0xb1, 0x02, 0x7d, 0x80, 0x00, 0x02, 0x03, 0x01, 0x8f, 0x00, 0x01, 0x01, 0x8f, 0xc0, 0x02, 0x00,
0x90, 0x00, 0x00, 0x03, 0x05, 0x09, 0x6f, 0xe0, 0x00, 0x01, 0xcf, 0x60, 0x01, 0x01, 0x4e, 0x40,
0xff, 0x01, 0x4d, 0x20, 0x00, 0x81, 0x4d, 0x40, 0x00, 0x01, 0x02, 0x01, 0x0f, 0x00, 0x00, 0x00,
0x90, 0x00, 0x00, 0x01, 0x03, 0x01, 0x0f, 0x00, 0x00, 0x01, 0x8f, 0x00, 0x00, 0x81, 0x8f, 0x00,
0x00, 0x01, 0x03, 0x01, 0x4f, 0x60, 0x00, 0x01, 0xcf, 0x60, 0x00, 0x81, 0xcf, 0x60, 0x00, 0x00,
0x01, 0x01, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x01, 0x0f, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00, 0x01,
0x8c, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x01, 0x88, 0x00, 0x00, 0x01, 0x87, 0x00, 0x00, 0x81,
0x0e, 0x00, 0x00, 0x00, 0x03, 0x01, 0x8f, 0x00, 0x00, 0x01, 0x8f, 0x00, 0x00, 0x81, 0x8f, 0x00,
0x00, 0x00, 0x01, 0x01, 0x8f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x09, 0x13, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x07, 0x00, 0x03, 0x00, 0x04, 0x07, 0x01,
0x02, 0xf4, 0x00, 0x00, 0x06, 0x00, 0x00, 0xfc, 0xfc, 0xf9, 0xf9, 0x00, 0x06, 0x00, 0x00, 0xfd,
0xfd, 0xf9, 0xf9, 0x02, 0x03, 0xfe, 0xff, 0x00,
};
const uint8_t b2_silver[] MUSICMEM = {
0x50, 0x72, 0x6f, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x33, 0x2e, 0x35, 0x20, 0x63,
0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x42, 0x32,
0x2d, 0x53, 0x49, 0x4c, 0x56, 0x45, 0x52, 0x2d, 0x41, 0x4b, 0x55, 0x53, 0x54, 0x49, 0x4b, 0x41,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
0x79, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x2d, 0x4b, 0x79, 0x56, 0x27, 0x33, 0x75, 0x6d, 0x66, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x02, 0x04, 0x18, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x6d, 0x0a, 0x00, 0x00, 0x73,
0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x0a, 0x00, 0x00, 0x27, 0x0b, 0x31, 0x0b, 0x00,
0x00, 0x43, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59,
0x0b, 0x00, 0x00, 0x63, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x0b, 0x98, 0x0b, 0x9b, 0x0b, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12,
0x15, 0x18, 0x1b, 0x1e, 0x21, 0x24, 0x27, 0x2a, 0x2d, 0x30, 0x33, 0x36, 0x39, 0x3c, 0x3f, 0x42,
0x45, 0xff, 0x72, 0x01, 0x7d, 0x01, 0x8b, 0x01, 0x99, 0x01, 0xa9, 0x01, 0xbf, 0x01, 0xd0, 0x01,
0xe4, 0x01, 0xf8, 0x01, 0x0f, 0x02, 0x1d, 0x02, 0x36, 0x02, 0x47, 0x02, 0x55, 0x02, 0x6e, 0x02,
0x81, 0x02, 0x97, 0x02, 0xb2, 0x02, 0xc3, 0x02, 0xd1, 0x02, 0xed, 0x02, 0xf8, 0x02, 0x09, 0x03,
0x24, 0x03, 0x34, 0x03, 0x44, 0x03, 0x60, 0x03, 0x6f, 0x03, 0x7c, 0x03, 0x98, 0x03, 0xa5, 0x03,
0xc3, 0x03, 0xed, 0x03, 0x13, 0x04, 0x34, 0x04, 0x66, 0x04, 0x7f, 0x04, 0x98, 0x04, 0xca, 0x04,
0xe3, 0x04, 0xf6, 0x04, 0x28, 0x05, 0x39, 0x05, 0x66, 0x05, 0xa1, 0x05, 0xca, 0x05, 0xf8, 0x05,
0x37, 0x06, 0x64, 0x06, 0x8d, 0x06, 0xcb, 0x06, 0xfb, 0x06, 0x29, 0x07, 0x67, 0x07, 0x91, 0x07,
0xab, 0x07, 0xe9, 0x07, 0x13, 0x08, 0x3d, 0x08, 0x86, 0x08, 0xb0, 0x08, 0xc3, 0x08, 0x86, 0x08,
0x01, 0x09, 0x1e, 0x09, 0x60, 0x09, 0x8a, 0x09, 0x9c, 0x09, 0xe1, 0x09, 0x0b, 0x0a, 0x11, 0x0a,
0x47, 0x0a, 0xf0, 0x18, 0xcf, 0xb1, 0x38, 0x74, 0xd3, 0xb1, 0x08, 0x76, 0x00, 0xf0, 0x18, 0xcf,
0xb1, 0x14, 0x74, 0xc0, 0xbb, 0x00, 0x46, 0xb1, 0x18, 0xd0, 0x00, 0xf0, 0x18, 0xcf, 0xb1, 0x34,
0x74, 0xd3, 0xb1, 0x08, 0x6c, 0xb1, 0x04, 0x73, 0x00, 0xb1, 0x24, 0xd0, 0xf0, 0x06, 0xcf, 0xb1,
0x08, 0x79, 0xb1, 0x0c, 0x79, 0xb1, 0x08, 0x76, 0x00, 0xf0, 0x02, 0xbb, 0x00, 0x53, 0xc6, 0xb1,
0x10, 0x6c, 0xbb, 0x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 0x74, 0xdc, 0x74, 0xd9, 0x74, 0x00, 0x00, 0x01, 0x00,
0x9f, 0x00, 0x00, 0x06, 0x0c, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x8e, 0x00,
0x00, 0x00, 0x8d, 0x01, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x01, 0x00, 0x00, 0x8c, 0x00,
0x00, 0x00, 0x8c, 0x01, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x80, 0x8c, 0xff, 0xff, 0x00, 0x8c, 0x00,
0x00, 0x00, 0x8c, 0x00, 0x00, 0x18, 0x20, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00,
0x8e, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00,
0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00,
0x8b, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00,
0x8b, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00,
0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00,
0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x03, 0x00, 0x00, 0x8a, 0x03, 0x00, 0x00,
0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0xfd, 0xff, 0x00, 0x8a, 0xfd, 0xff, 0x00,
0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x01, 0x02, 0x01, 0x1f, 0x00, 0x00, 0x00, 0x90, 0x00,
0x00, 0x03, 0x04, 0x01, 0x8f, 0x00, 0x01, 0x01, 0x8e, 0x40, 0x04, 0x01, 0x8e, 0xc0, 0x06, 0x00,
0x90, 0x00, 0x00, 0x03, 0x05, 0x09, 0x6f, 0x80, 0x00, 0x01, 0xcf, 0x20, 0x01, 0x01, 0x4e, 0xa0,
0xfe, 0x01, 0x4c, 0x40, 0x00, 0x81, 0x4c, 0x40, 0x00, 0x01, 0x02, 0x01, 0x1b, 0x00, 0x00, 0x00,
0x90, 0x00, 0x00, 0x06, 0x0c, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x8e, 0x00,
0x00, 0x00, 0x8d, 0x01, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x01, 0x00, 0x00, 0x8c, 0x00,
0x00, 0x00, 0x8c, 0x01, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x80, 0x8c, 0xff, 0xff, 0x00, 0x8c, 0x00,
0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00,
};
const uint8_t kino_sun[] MUSICMEM = {
0x50, 0x72, 0x6f, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x33, 0x2e, 0x35, 0x20, 0x63,
0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x4b, 0x55,
0x48, 0x4f, 0x2d, 0x33, 0x42, 0x45, 0x33, 0x44, 0x41, 0x20, 0x4e, 0x4f, 0x20, 0x55, 0x4d, 0x45,
0x48, 0x55, 0x20, 0x43, 0x4f, 0x2f, 0x21, 0x48, 0x55, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
0x79, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x2d, 0x6b, 0x59, 0x76, 0x27,
0x33, 0x75, 0x6d, 0x66, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x01, 0x06, 0x1a, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x55, 0x0c, 0x6b, 0x0c, 0xb9,
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x0c, 0xf1, 0x0c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x2b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x0e, 0x36, 0x0e, 0x3b, 0x0e, 0x40,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x45, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12,
0x12, 0x15, 0x18, 0x1b, 0x1e, 0x21, 0x24, 0x12, 0x12, 0x15, 0x27, 0x2a, 0x2d, 0x30, 0x33, 0x12,
0x12, 0x12, 0x36, 0xff, 0x56, 0x01, 0x6f, 0x01, 0x01, 0x02, 0x6c, 0x02, 0xa1, 0x02, 0x29, 0x03,
0x9a, 0x03, 0xcf, 0x03, 0x5a, 0x04, 0xcb, 0x04, 0xf9, 0x04, 0x84, 0x05, 0xef, 0x05, 0x16, 0x06,
0x5a, 0x04, 0xa3, 0x06, 0xdc, 0x06, 0x67, 0x07, 0xb3, 0x07, 0xf2, 0x07, 0x7b, 0x08, 0x56, 0x01,
0x6f, 0x01, 0xaa, 0x08, 0x18, 0x09, 0xa1, 0x02, 0x29, 0x03, 0x47, 0x09, 0xcf, 0x03, 0x5a, 0x04,
0x74, 0x09, 0xf9, 0x04, 0x84, 0x05, 0xa6, 0x09, 0x16, 0x06, 0x5a, 0x04, 0xd6, 0x09, 0xdc, 0x06,
0x12, 0x0a, 0x88, 0x0a, 0xf9, 0x04, 0x84, 0x05, 0xc2, 0x0a, 0x16, 0x06, 0x5a, 0x04, 0xf2, 0x0a,
0xf9, 0x04, 0x84, 0x05, 0x1f, 0x0b, 0x16, 0x06, 0x5a, 0x04, 0x4e, 0x0b, 0xdc, 0x06, 0x88, 0x0b,
0xb3, 0x07, 0xd1, 0x0b, 0x7b, 0x08, 0xb1, 0x05, 0xd0, 0xc7, 0xb1, 0x03, 0xd0, 0xc4, 0xb1, 0x02,
0xd0, 0xc3, 0xd0, 0xc1, 0xb1, 0x30, 0xd0, 0xf6, 0x12, 0xcf, 0xb1, 0x02, 0x80, 0x7f, 0x00, 0xf0,
0x02, 0xbb, 0x00, 0x48, 0xcf, 0xb1, 0x02, 0x7d, 0x1a, 0x00, 0x48, 0x2c, 0x7d, 0x10, 0x04, 0x74,
0x1a, 0x00, 0x48, 0x02, 0x80, 0xbb, 0x00, 0x48, 0x80, 0x1a, 0x00, 0x48, 0x2c, 0x7d, 0x10, 0x04,
0xb1, 0x04, 0x74, 0x1a, 0x00, 0x48, 0x02, 0xb1, 0x02, 0x80, 0x1a, 0x00, 0x48, 0x2c, 0x7d, 0x10,
0x04, 0x74, 0x1a, 0x00, 0x48, 0x02, 0x80, 0xbb, 0x00, 0x48, 0x80, 0x1a, 0x00, 0x48, 0x2c, 0x7d,
0x10, 0x04, 0xb1, 0x04, 0x74, 0x1a, 0x00, 0x48, 0x02, 0xb1, 0x02, 0x80, 0x1a, 0x00, 0x48, 0x2c,
0x7d, 0x10, 0x04, 0x74, 0x1a, 0x00, 0x48, 0x02, 0x80, 0xbb, 0x00, 0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x78, 0xd9, 0xcf, 0xb1, 0x02, 0x78, 0x79, 0xb1, 0x03, 0x7b, 0x7b,
0xb1, 0x02, 0x7b, 0xb1, 0x04, 0x7b, 0x7d, 0x78, 0xca, 0x78, 0x78, 0xcf, 0xb1, 0x02, 0x79, 0x78,
0x00, 0xf0, 0x02, 0xbb, 0x00, 0x48, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x74, 0x10, 0x04,
0x74, 0x18, 0x00, 0x48, 0x2c, 0x74, 0x1a, 0x00, 0x48, 0x02, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x74,
0x10, 0x04, 0x74, 0xe6, 0x74, 0x1a, 0x00, 0x48, 0x02, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x74, 0x10,
0x04, 0x74, 0x18, 0x00, 0x48, 0x2c, 0x74, 0x1a, 0x00, 0x48, 0x02, 0x80, 0x18, 0x00, 0x48, 0x2c,
0x74, 0x10, 0x04, 0x74, 0xe6, 0x74, 0x1a, 0x00, 0x3c, 0x02, 0x80, 0x18, 0x00, 0x3c, 0x2c, 0x74,
0x10, 0x04, 0x74, 0x18, 0x00, 0x3c, 0x2c, 0x74, 0x1a, 0x00, 0x3c, 0x02, 0x80, 0x18, 0x00, 0x3c,
0x2c, 0x74, 0x10, 0x04, 0x74, 0xe6, 0x74, 0x1a, 0x00, 0x3c, 0x02, 0x80, 0x18, 0x00, 0x3c, 0x2c,
0x74, 0x10, 0x04, 0x74, 0x18, 0x00, 0x3c, 0x2c, 0x74, 0x1a, 0x00, 0x3c, 0x02, 0x80, 0x18, 0x00,
0x3c, 0x2c, 0x74, 0x10, 0x04, 0x74, 0xe6, 0x74, 0x00, 0xf3, 0x1a, 0xce, 0xb1, 0x02, 0x7d, 0x7d,
0xb1, 0x01, 0x7d, 0xb1, 0x02, 0x7d, 0xb1, 0x01, 0x7d, 0xb1, 0x02, 0x7d, 0xb1, 0x01, 0x7d, 0xb1,
0x02, 0x7d, 0xb1, 0x01, 0x7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 0x10,
0x04, 0x74, 0x1a, 0x00, 0x35, 0x02, 0x80, 0xbb, 0x00, 0x35, 0x80, 0x18, 0x00, 0x35, 0x2c, 0x80,
0x10, 0x04, 0xb1, 0x04, 0x74, 0x1a, 0x00, 0x28, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x28, 0x2c,
0x80, 0x10, 0x04, 0x74, 0x1a, 0x00, 0x28, 0x02, 0x80, 0xbb, 0x00, 0x28, 0x80, 0x18, 0x00, 0x28,
0x2c, 0x80, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x1a, 0x00, 0x28, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00,
0x28, 0x2c, 0x80, 0x10, 0x04, 0x74, 0x1a, 0x00, 0x28, 0x02, 0x80, 0xbb, 0x00, 0x28, 0x80, 0x18,
0x00, 0x28, 0x2c, 0x80, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x00, 0xf3, 0x1a, 0xce, 0xb1, 0x02, 0x76,
0x76, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76,
0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0x76, 0x76, 0xb1, 0x02, 0x76, 0x76, 0xb1, 0x01, 0x76, 0xb1,
0x02, 0x76, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01,
0x76, 0x76, 0x76, 0x42, 0xb1, 0x02, 0x7b, 0x7b, 0xb1, 0x01, 0x7b, 0xb1, 0x02, 0x7b, 0xb1, 0x01,
0x7b, 0xb1, 0x02, 0x7b, 0xb1, 0x01, 0x7b, 0xb1, 0x02, 0x7b, 0xb1, 0x01, 0x7b, 0x7b, 0x7b, 0xb1,
0x02, 0x7b, 0x7b, 0xb1, 0x01, 0x7b, 0xb1, 0x02, 0x7b, 0xb1, 0x01, 0x7b, 0x7b, 0x7b, 0xb1, 0x02,
0x7b, 0xb1, 0x01, 0x7b, 0xb1, 0x02, 0x7b, 0xb1, 0x01, 0x7b, 0x00, 0xf0, 0x12, 0xcf, 0xb1, 0x02,
0x7d, 0x78, 0x78, 0x78, 0x78, 0x78, 0xb1, 0x04, 0x7b, 0x78, 0xce, 0xd0, 0xca, 0xd0, 0xcf, 0xb1,
0x02, 0x78, 0x79, 0xb1, 0x03, 0x7b, 0x7b, 0xb1, 0x02, 0x7b, 0xb1, 0x04, 0x7b, 0x7d, 0x78, 0xce,
0xd0, 0xca, 0xd0, 0xcf, 0xb1, 0x02, 0x79, 0x78, 0x00, 0xf0, 0x02, 0xbb, 0x00, 0x48, 0xcf, 0xb1,
0x02, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x80, 0x10, 0x04, 0x74, 0x1a, 0x00, 0x48, 0x02, 0x80, 0xbb,
0x00, 0x48, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x80, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x1a, 0x00, 0x48,
0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x80, 0x10, 0x04, 0x74, 0x1a, 0x00, 0x48, 0x02,
0x80, 0xbb, 0x00, 0x48, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x80, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x1a,
0x00, 0x3c, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x3c, 0x2c, 0x80, 0x10, 0x04, 0x74, 0x1a, 0x00,
0x3c, 0x02, 0x80, 0xbb, 0x00, 0x3c, 0x80, 0x18, 0x00, 0x3c, 0x2c, 0x80, 0x10, 0x04, 0xb1, 0x04,
0x74, 0x1a, 0x00, 0x3c, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x3c, 0x2c, 0x80, 0x10, 0x04, 0x74,
0x1a, 0x00, 0x3c, 0x02, 0x80, 0xbb, 0x00, 0x3c, 0x80, 0x18, 0x00, 0x3c, 0x2c, 0x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, 0xb1, 0x04, 0x74, 0x1a, 0x00, 0x35, 0x02, 0xb1, 0x02,
0x80, 0x18, 0x00, 0x35, 0x2c, 0x74, 0x10, 0x04, 0x74, 0x1a, 0x00, 0x35, 0x02, 0x80, 0xbb, 0x00,
0x35, 0x80, 0x18, 0x00, 0x35, 0x2c, 0x74, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x1a, 0x00, 0x28, 0x02,
0xb1, 0x02, 0x80, 0x18, 0x00, 0x28, 0x2c, 0x74, 0x10, 0x04, 0x74, 0x1a, 0x00, 0x28, 0x02, 0x80,
0xbb, 0x00, 0x28, 0x80, 0x18, 0x00, 0x28, 0x2c, 0x74, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x1a, 0x00,
0x28, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x28, 0x2c, 0x74, 0x10, 0x04, 0x74, 0x1a, 0x00, 0x28,
0x02, 0x80, 0xbb, 0x00, 0x28, 0x80, 0x18, 0x00, 0x28, 0x2c, 0x74, 0x10, 0x04, 0x74, 0xb1, 0x01,
0x74, 0x74, 0x00, 0xb0, 0x40, 0xcf, 0xb1, 0x02, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0xb1, 0x04,
0x74, 0x76, 0xce, 0xb1, 0x02, 0xd0, 0xcf, 0x76, 0x76, 0x76, 0xb1, 0x04, 0x7d, 0x78, 0xce, 0xb1,
0x02, 0xd0, 0xcf, 0xb1, 0x04, 0x71, 0xce, 0xd0, 0xca, 0xd0, 0xc9, 0xd0, 0xc8, 0xd0, 0xc6, 0xb1,
0x02, 0xd0, 0xb1, 0x01, 0x80, 0xc8, 0x82, 0xca, 0x84, 0xcc, 0x85, 0x00, 0xf0, 0x02, 0xbf, 0x00,
0x35, 0xcf, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x35, 0x2c, 0x74, 0x10, 0x04, 0x74, 0x1e, 0x00, 0x35,
0x02, 0x80, 0xbf, 0x00, 0x35, 0x80, 0x18, 0x00, 0x35, 0x2c, 0x74, 0x10, 0x04, 0xb1, 0x04, 0x74,
0x1e, 0x00, 0x35, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x35, 0x2c, 0x74, 0x10, 0x04, 0x74, 0x1e,
0x00, 0x35, 0x02, 0x80, 0xbf, 0x00, 0x35, 0x80, 0x18, 0x00, 0x35, 0x2c, 0x74, 0x10, 0x04, 0xb1,
0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x74, 0x10, 0x04,
0x74, 0x1e, 0x00, 0x48, 0x02, 0x80, 0xbf, 0x00, 0x48, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x74, 0x10,
0x04, 0xb1, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x48, 0x2c, 0x74,
0x10, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0x80, 0xbf, 0x00, 0x48, 0x80, 0x18, 0x00, 0x48, 0x2c,
0x74, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x00, 0xf3, 0x1a, 0xce, 0xb1, 0x02, 0x76, 0x76, 0xcd, 0xb1,
0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xcb, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0x76,
0xcc, 0xd0, 0x76, 0x76, 0x76, 0xca, 0xb1, 0x02, 0x76, 0x76, 0xc9, 0xb1, 0x01, 0x76, 0xb1, 0x02,
0x76, 0xb1, 0x01, 0x76, 0xc8, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0x76, 0xc7, 0xd0, 0x76, 0x76,
0x76, 0x42, 0xc6, 0xb1, 0x04, 0xd0, 0xc5, 0xd0, 0xc4, 0xd0, 0xc3, 0xd0, 0xc2, 0xd0, 0xc1, 0xb1,
0x0c, 0xd0, 0x00, 0xf0, 0x1a, 0xcd, 0xb1, 0x04, 0x84, 0xcc, 0xb1, 0x02, 0xd0, 0xcd, 0xb1, 0x04,
0x82, 0xcc, 0xd0, 0xcb, 0xd0, 0xca, 0xd0, 0xc9, 0xd0, 0xc8, 0xb1, 0x02, 0xd0, 0xc6, 0xb1, 0x01,
0x7d, 0xc8, 0x7f, 0xca, 0x80, 0xcc, 0x84, 0xcd, 0xb1, 0x04, 0x7f, 0xcc, 0xb1, 0x02, 0xd0, 0xcd,
0xb1, 0x04, 0x80, 0xcc, 0xd0, 0xcb, 0xd0, 0xca, 0xd0, 0xc9, 0xd0, 0xc8, 0xd0, 0xc7, 0xb1, 0x02,
0xd0, 0x00, 0xf0, 0x02, 0xbf, 0x00, 0x35, 0xcf, 0xb1, 0x02, 0x80, 0xbf, 0x00, 0x35, 0xd0, 0x10,
0x04, 0x74, 0x1e, 0x00, 0x35, 0x02, 0x80, 0xbf, 0x00, 0x35, 0x80, 0x18, 0x00, 0x35, 0x2c, 0x74,
0x10, 0x04, 0xb1, 0x04, 0x74, 0x1e, 0x00, 0x35, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x35, 0x2c,
0x74, 0x10, 0x04, 0x74, 0x1e, 0x00, 0x35, 0x02, 0x80, 0xbf, 0x00, 0x35, 0x80, 0xbf, 0x00, 0x35,
0xd0, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0xb1, 0x02, 0x80, 0x18, 0x00, 0x48,
0x2c, 0x74, 0x10, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0x80, 0xbf, 0x00, 0x48, 0x80, 0x18, 0x00,
0x48, 0x2c, 0x74, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0xb1, 0x02, 0x80, 0x18,
0x00, 0x48, 0x2c, 0x74, 0x10, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0x80, 0xbf, 0x00, 0x48, 0x80,
0x18, 0x00, 0x48, 0x2c, 0x74, 0x10, 0x04, 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0xd0, 0xcf, 0x76, 0x76, 0x76,
0xb1, 0x04, 0x7d, 0x78, 0xce, 0xb1, 0x02, 0xd0, 0xcf, 0xb1, 0x04, 0x71, 0xce, 0xd0, 0xca, 0xd0,
0xc9, 0xd0, 0xc8, 0xd0, 0xc6, 0xb1, 0x02, 0xd0, 0xb1, 0x01, 0x80, 0xc8, 0x82, 0xca, 0x84, 0xcc,
0x85, 0x00, 0xf3, 0x1a, 0xce, 0xb1, 0x02, 0x76, 0x76, 0xcd, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76,
0xb1, 0x01, 0x76, 0xcb, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0x76, 0xcc, 0xd0, 0x76, 0x76, 0x76,
0xca, 0xb1, 0x02, 0x76, 0x76, 0xc9, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xc8,
0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0x76, 0x76, 0x42, 0xb1,
0x02, 0x76, 0x76, 0xc5, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xc4, 0xb1, 0x02,
0x76, 0x76, 0xc3, 0xb1, 0x01, 0x76, 0x76, 0x76, 0x76, 0xc2, 0xd0, 0xb1, 0x02, 0x76, 0xb1, 0x01,
0x76, 0xc1, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xb1, 0x02,
0x76, 0xb1, 0x01, 0x76, 0xb1, 0x03, 0x76, 0x00, 0xf0, 0x12, 0xcf, 0xb1, 0x02, 0x7d, 0x78, 0x78,
0x78, 0x78, 0x78, 0xb1, 0x04, 0x7b, 0x78, 0xce, 0xb1, 0x02, 0xd0, 0xcd, 0xb1, 0x01, 0xd0, 0xcc,
0xd0, 0xca, 0xb1, 0x04, 0xd0, 0xcf, 0xb1, 0x02, 0x78, 0x79, 0xb1, 0x03, 0x7b, 0xb1, 0x05, 0x7b,
0xb1, 0x02, 0x7b, 0x7b, 0xb1, 0x04, 0x7d, 0x78, 0xce, 0xd0, 0xcd, 0xd0, 0xcf, 0xb1, 0x02, 0x79,
0x78, 0x00, 0xf0, 0x12, 0xcf, 0xb1, 0x04, 0x76, 0xb1, 0x02, 0x76, 0x76, 0x76, 0x76, 0xb1, 0x04,
0x78, 0x76, 0xce, 0xd0, 0xcd, 0xd0, 0xcf, 0xb1, 0x02, 0x76, 0x76, 0xb1, 0x04, 0x76, 0xb1, 0x02,
0x76, 0x76, 0x76, 0x76, 0xb1, 0x04, 0x78, 0x76, 0xce, 0xd0, 0xcd, 0xd0, 0xcf, 0xb1, 0x02, 0x80,
0x7f, 0x00, 0xf0, 0x12, 0xcf, 0xb1, 0x02, 0x7d, 0x78, 0x78, 0x78, 0x78, 0x78, 0x7b, 0x7b, 0xb1,
0x04, 0x78, 0xce, 0xd0, 0xca, 0xd0, 0xcf, 0xb1, 0x02, 0x78, 0x79, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
0x7b, 0xb1, 0x04, 0x7d, 0x78, 0xce, 0xd0, 0xca, 0xd0, 0xcf, 0xb1, 0x02, 0x79, 0x78, 0x00, 0xf0,
0x12, 0xcf, 0xb1, 0x02, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0xb1, 0x04, 0x78, 0x76, 0xce, 0xd0,
0xca, 0xd0, 0xcf, 0xb1, 0x02, 0x76, 0x76, 0x76, 0xb1, 0x04, 0x76, 0xb1, 0x02, 0x76, 0x76, 0x76,
0xb1, 0x04, 0x78, 0x76, 0xce, 0xd0, 0xcd, 0xd0, 0xcf, 0xb1, 0x02, 0x76, 0x76, 0x00, 0xb0, 0x40,
0xcf, 0xb1, 0x04, 0x76, 0xb1, 0x02, 0x76, 0x76, 0x76, 0x76, 0xb1, 0x04, 0x74, 0x76, 0xce, 0xb1,
0x02, 0xd0, 0xcf, 0x76, 0x76, 0x76, 0xb1, 0x04, 0x7d, 0x78, 0xce, 0xb1, 0x02, 0xd0, 0xcf, 0xb1,
0x04, 0x71, 0xce, 0xd0, 0xca, 0xd0, 0xc9, 0xd0, 0xc8, 0xd0, 0xc6, 0xb1, 0x02, 0xd0, 0xb1, 0x01,
0x80, 0xc8, 0x82, 0xca, 0x84, 0xcc, 0x85, 0x00, 0xf3, 0x1a, 0xce, 0xb1, 0x02, 0x76, 0x76, 0xcd,
0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0x76,
0xcc, 0xd0, 0x76, 0x76, 0x76, 0xb1, 0x02, 0x76, 0x76, 0xca, 0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76,
0xb1, 0x01, 0x76, 0xb1, 0x02, 0x76, 0xb1, 0x01, 0x76, 0x76, 0xc9, 0xd0, 0x76, 0x76, 0x76, 0x42,
0xc6, 0xb1, 0x04, 0xd0, 0xc5, 0xd0, 0xc4, 0xd0, 0xc3, 0xd0, 0xc2, 0xd0, 0xc1, 0xb1, 0x0c, 0xd0,
0x00, 0xf0, 0x02, 0xbf, 0x00, 0x35, 0xcf, 0xb1, 0x02, 0x80, 0xbf, 0x00, 0x35, 0xd0, 0x10, 0x04,
0x74, 0x1e, 0x00, 0x35, 0x02, 0x80, 0xbf, 0x00, 0x35, 0x80, 0x1e, 0x00, 0x35, 0x2c, 0x74, 0x10,
0x04, 0xb1, 0x04, 0x74, 0x1e, 0x00, 0x35, 0x02, 0xb1, 0x02, 0x80, 0x1e, 0x00, 0x35, 0x2c, 0x74,
0x10, 0x04, 0x74, 0x1e, 0x00, 0x35, 0x02, 0x80, 0xbf, 0x00, 0x35, 0x80, 0xbf, 0x00, 0x35, 0xd0,
0x10, 0x04, 0xb1, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0xb1, 0x02, 0x80, 0x1e, 0x00, 0x48, 0x2c,
0x74, 0x10, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x02, 0x80, 0xbf, 0x00, 0x48, 0x80, 0x1e, 0x00, 0x48,
0x2c, 0x74, 0x10, 0x04, 0xb1, 0x04, 0x74, 0x1e, 0x00, 0x48, 0x2c, 0xb1, 0x02, 0x80, 0xbf, 0x00,
0x48, 0x74, 0xb0, 0x74, 0xbf, 0x00, 0x48, 0x80, 0xbf, 0x00, 0x48, 0x80, 0xbf, 0x00, 0x48, 0x74,
0xb0, 0xb1, 0x04, 0xd0, 0x00, 0x04, 0x05, 0x01, 0x8f, 0x00, 0x02, 0x01, 0x8f, 0x00, 0x03, 0x01,
0x8e, 0x80, 0x04, 0x01, 0x8e, 0x80, 0x05, 0x00, 0x90, 0x00, 0x00, 0x12, 0x13, 0x0d, 0x0f, 0x40,
0x00, 0x0f, 0x0f, 0x80, 0x00, 0x11, 0x0e, 0xc0, 0x00, 0x11, 0x0e, 0x00, 0x01, 0x13, 0x0d, 0x1d,
0x01, 0x12, 0x0d, 0x54, 0x01, 0x13, 0x0c, 0x78, 0x01, 0x13, 0x0c, 0x93, 0x01, 0x11, 0x0b, 0xc5,
0x01, 0x0f, 0x0a, 0xfc, 0x01, 0x0d, 0x09, 0x1b, 0x02, 0x0b, 0x08, 0x2b, 0x02, 0x09, 0x07, 0x59,
0x02, 0x07, 0x06, 0x68, 0x02, 0x05, 0x05, 0x8d, 0x02, 0x03, 0x03, 0xad, 0x02, 0x01, 0x02, 0xce,
0x02, 0x01, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x0c, 0x00, 0x00, 0x01,
0x0c, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x01,
0x8a, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x01,
0x8a, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0x00,
0x00, 0x0d, 0x0e, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x8e, 0xff, 0xff, 0x00,
0x8d, 0xff, 0xff, 0x00, 0x8d, 0xfe, 0xff, 0x00, 0x8d, 0xfe, 0xff, 0x00, 0x8c, 0xff, 0xff, 0x00,
0x8c, 0xff, 0xff, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00,
0x8b, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x3f, 0x40, 0x00, 0x8f, 0x00,
0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8c, 0x00,
0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8b, 0x00,
0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00,
0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x89, 0x00,
0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x88, 0x00,
0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x87, 0x00,
0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x86, 0x00,
0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x85, 0x00,
0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x85, 0x00,
0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x84, 0x00,
0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x84, 0x00,
0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00,
0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00,
0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x83, 0x00,
0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x82, 0x00,
0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00,
0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x03, 0xfe, 0xff, 0x00, 0x00, 0x03, 0x00, 0x04, 0x07,
0x00, 0x03, 0x00, 0x03, 0x07, 0x02, 0x03, 0xfe, 0xff, 0x00,
};
| 94.814389
| 96
| 0.659648
|
vladpower
|
78fe5dc45140196b07ed73f2a3ba4ecf3f36982f
| 714
|
cpp
|
C++
|
Uva/424.cpp
|
w181496/OJ
|
67d1d32770376865eba8a9dd1767e97dae68989a
|
[
"MIT"
] | 9
|
2017-10-08T16:22:03.000Z
|
2021-08-20T09:32:17.000Z
|
Uva/424.cpp
|
w181496/OJ
|
67d1d32770376865eba8a9dd1767e97dae68989a
|
[
"MIT"
] | null | null | null |
Uva/424.cpp
|
w181496/OJ
|
67d1d32770376865eba8a9dd1767e97dae68989a
|
[
"MIT"
] | 2
|
2018-01-15T16:35:44.000Z
|
2019-03-21T18:30:04.000Z
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int>n;
string s;
cin>>s;
for(int i=s.size()-1;i>=0;--i)
n.push_back(s[i]-'0');
while(cin>>s)
{
if(s=="0")break;
for(int i=s.size()-1;i>=0;i--)
{
if(i>=n.size())n.push_back(0);
n[s.size()-i-1]+=s[i]-'0';
}
for(int i=0;i<n.size();i++)
{
if(n[i]>9)
{
if(i+1>=n.size())n.push_back(0);
n[i+1]++;
n[i]-=10;
}
}
}
for(int i=n.size()-1;i>=0;--i)
cout<<n[i];
cout<<endl;
return 0;
}
| 18.789474
| 48
| 0.390756
|
w181496
|
60039da5e680b3e77af3afc12497ffdf28fd121b
| 3,765
|
hpp
|
C++
|
ui_view.hpp
|
m-shibata/jfbview-dpkg
|
ddca68777bf60da01da8bbeb14f1d4ac5a6e4cf9
|
[
"Apache-1.1"
] | 1
|
2016-08-05T21:13:57.000Z
|
2016-08-05T21:13:57.000Z
|
ui_view.hpp
|
m-shibata/jfbview-dpkg
|
ddca68777bf60da01da8bbeb14f1d4ac5a6e4cf9
|
[
"Apache-1.1"
] | null | null | null |
ui_view.hpp
|
m-shibata/jfbview-dpkg
|
ddca68777bf60da01da8bbeb14f1d4ac5a6e4cf9
|
[
"Apache-1.1"
] | null | null | null |
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2012-2014 Chuan Ji <ji@chu4n.com> *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// This file defines the UIView class, a base class for NCURSES-based
// interactive full-screen UIs.
#ifndef UI_VIEW_HPP
#define UI_VIEW_HPP
#include <curses.h>
#include <functional>
#include <mutex>
#include <unordered_map>
// Base class for NCURSES-based interactive full-screen UIs. Implements
// - Static NCURSES window initialization on first construction of any derived
// instances;
// - Static NCURSES window clean up upon destruction on last destruction of
// any derived instances;
// - Main event loop.
class UIView {
public:
// A function that handles key events.
typedef std::function<void(int)> KeyProcessor;
// A map that maps key processing modes (as ints) to key processing methods.
typedef std::unordered_map<int, KeyProcessor> KeyProcessingModeMap;
// Statically initializes an NCURSES window on first construction of any
// derived instances.
explicit UIView(const KeyProcessingModeMap& key_processing_mode_map);
// Statically cleans up an NCURSES window upon last destruction of any derived
// instances.
virtual ~UIView();
protected:
// Renders the current UI. This should be implemented by derived classes.
virtual void Render() = 0;
// Starts the event loop. This will repeatedly call fetch the next keyboard
// event, invoke ProcessKey(), and Render(). Will exit the loop when
// ExitEventLoop() is invoked. initial_mode specifies the initial key
// processing mode.
void EventLoop(int initial_key_processing_mode);
// Causes the event loop to exit.
void ExitEventLoop();
// Switches key processing mode.
void SwitchKeyProcessingMode(int new_key_processing_mode);
// Returns the current key processing mode.
int GetKeyProcessingMode() const { return _key_processing_mode; }
// Returns the full-screen NCURSES window.
WINDOW* GetWindow() const;
private:
// A mutex protecting static members.
static std::mutex _mutex;
// Reference counter. This is the number of derived instances currently
// instantiated. Protected by _mutex.
static int _num_instances;
// The NCURSES WINDOW. Will be nullptr if uninitialized. Protected by _mutex.
static WINDOW* _window;
// Maps key processing modes to the actual handler.
const KeyProcessingModeMap _key_processing_mode_map;
// The current key processing mode.
int _key_processing_mode;
// Whether to exit the event loop.
bool _exit_event_loop;
};
#endif
| 43.275862
| 80
| 0.603984
|
m-shibata
|
6010b95bdec321da7a9fbc8d679a0a737118615b
| 913
|
cpp
|
C++
|
LeetCode/Longest String Chain/main.cpp
|
Code-With-Aagam/competitive-programming
|
610520cc396fb13a03c606b5fb6739cfd68cc444
|
[
"MIT"
] | 2
|
2022-02-08T12:37:41.000Z
|
2022-03-09T03:48:56.000Z
|
LeetCode/Longest String Chain/main.cpp
|
ShubhamJagtap2000/competitive-programming-1
|
3a9a2e3dd08f8fa8ab823f295cd020d08d3bff84
|
[
"MIT"
] | null | null | null |
LeetCode/Longest String Chain/main.cpp
|
ShubhamJagtap2000/competitive-programming-1
|
3a9a2e3dd08f8fa8ab823f295cd020d08d3bff84
|
[
"MIT"
] | null | null | null |
class Solution {
private:
bool isPredecessor(const string &x, const string &y) {
if (y.size() - x.size() != 1) return false;
if (y.substr(1) == x || y.substr(0, x.size()) == x) return true;
for (int i = 0; i < y.size() - 1; ++i) {
if (y.substr(0, i) + y.substr(i + 1) == x) return true;
}
return false;
}
public:
int longestStrChain(vector<string> &words) {
if (words.size() < 2) return words.size();
sort(words.begin(), words.end(), [](const string &x, const string &y) {
return x.size() < y.size();
});
vector<int> dp(words.size(), 1);
for (int i = 1; i < words.size(); ++i) {
for (int j = 0; j < i; ++j) {
if (isPredecessor(words[j], words[i])) dp[i] = max(dp[i], 1 + dp[j]);
}
}
return *max_element(dp.begin(), dp.end());
}
};
| 35.115385
| 85
| 0.468784
|
Code-With-Aagam
|
60113973edf1f923a1db67a452b8f660b0ed3979
| 30,780
|
hpp
|
C++
|
lsdtt_xtensor/include/liblas/index.hpp
|
LSDtopotools/lsdtopytools
|
9809cbd368fe46b5e483085fa55f3206e4d85183
|
[
"MIT"
] | 2
|
2020-05-04T14:32:34.000Z
|
2021-06-29T10:59:03.000Z
|
lsdtt_xtensor/include/liblas/index.hpp
|
LSDtopotools/lsdtopytools
|
9809cbd368fe46b5e483085fa55f3206e4d85183
|
[
"MIT"
] | 1
|
2020-01-30T14:03:00.000Z
|
2020-02-06T16:32:56.000Z
|
include/liblas/index.hpp
|
libLAS/libLAS-1.6
|
92b4c1370785481f212cc7fec9623637233c1418
|
[
"BSD-3-Clause"
] | 2
|
2021-05-17T02:09:16.000Z
|
2021-06-21T12:15:52.000Z
|
/******************************************************************************
* $Id$
*
* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
* Purpose: LAS index class
* Author: Gary Huber, gary@garyhuberart.com
*
******************************************************************************
* Copyright (c) 2010, Gary Huber, gary@garyhuberart.com
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the Martin Isenburg or Iowa Department
* of Natural Resources nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
****************************************************************************/
#ifndef LIBLAS_LASINDEX_HPP_INCLUDED
#define LIBLAS_LASINDEX_HPP_INCLUDED
#include <liblas/reader.hpp>
#include <liblas/header.hpp>
#include <liblas/bounds.hpp>
#include <liblas/variablerecord.hpp>
#include <liblas/detail/index/indexcell.hpp>
#include <liblas/export.hpp>
// std
#include <stdexcept> // std::out_of_range
#include <cstdio> // file io
#include <iostream> // file io
#include <cstdlib> // std::size_t
#include <vector> // std::vector
namespace liblas {
#define LIBLAS_INDEX_MAXMEMDEFAULT 10000000 // 10 megs default
#define LIBLAS_INDEX_MINMEMDEFAULT 1000000 // 1 meg at least has to be allowed
#define LIBLAS_INDEX_VERSIONMAJOR 1
#define LIBLAS_INDEX_VERSIONMINOR 2 // minor version 2 begins 11/15/10
#define LIBLAS_INDEX_MAXSTRLEN 512
#define LIBLAS_INDEX_MAXCELLS 250000
#define LIBLAS_INDEX_OPTPTSPERCELL 100
#define LIBLAS_INDEX_MAXPTSPERCELL 1000
#define LIBLAS_INDEX_RESERVEFILTERDEFAULT 1000000 // 1 million points will be reserved on large files for filter result
// define this in order to fix problem with last bytes of last VLR getting corrupted
// when saved and reloaded from index or las file.
#define LIBLAS_INDEX_PADLASTVLR
typedef std::vector<boost::uint8_t> IndexVLRData;
typedef std::vector<liblas::detail::IndexCell> IndexCellRow;
typedef std::vector<IndexCellRow> IndexCellDataBlock;
class LAS_DLL IndexData;
class LAS_DLL IndexIterator;
// Index class is the fundamental object for building and filtering a spatial index of points in an LAS file.
// An Index class doesn't do anything until it is configured with an IndexData object (see below).
// You instantiate an Index object first and then pass it an IndexData or you can construct the Index with an
// IndexData. Nothing happens until the Index is told what to do via the configuration with IndexData.
// For details on configuration options see IndexData below.
// Once an index exists and is configured, it can be used to filter the point set in the LAS file for which it
// was built. The points have to be what they were when the index was built. The index is not automatically
// updated if the point set is changed. The index becomes invalid if either the number of points is changed,
// the order of points is changed or the location of any points is changed. The Validate function is run to
// determine as best it can the validity of the stored index but it isn't perfect. It can only determine if
// the number of points has changed or the spatial extents of the file have changed.
// The user can constrain the memory used in building an index if that is believed to be an issue.
// The results will be the same but some efficiency may be lost in the index building process.
// Data stored in index header can be examined for determining suitability of index for desired purpose.
// 1) presence of z-dimensional cell structure is indicated by GetCellsZ() called on the Index.
// 2) Index author GetIndexAuthorStr() - provided by author at time of creation
// 3) Index comment GetIndexCommentStr() - provided by author at time of creation
// 4) Index creation date GetIndexDateStr() - provided by author at time of creation
// The latter fields are not validated in any way by the index building code and are just three fields
// which can be used as the user sees fit. Maximum length is LIBLAS_INDEX_MAXSTRLEN - 1.
// Obtaining a filtered set of points requires that a valid index exist (see above).
// The IndexData class is used again to pass the extents of the filter to the Index. By making any high/low
// bounds coordinate pair equal, that dimension is ignored for the purposes of filtering. Note that Z dimension
// discrimination is still available even if z-binning was not invoked during index creation. Filtering with
// the z dimension may be slower in that event but no less successful.
// A filter operation is invoked with the command:
// const std::vector<boost::uint32_t>& Filter(IndexData const& ParamSrc);
// The return value is a vector of point ID's. The points can be accessed from the LAS file in the standard way
// as the index in no way modifies them or their sequential order.
// Currently only one, two or three dimensional spatial window filters are supported. See IndexData below for
// more info on filtering.
class LAS_DLL Index
{
public:
Index();
Index(IndexData const& ParamSrc);
~Index();
// Blocked copying operations, declared but not defined.
/// Copy constructor.
Index(Index const& other);
/// Assignment operator.
Index& operator=(Index const& rhs);
private:
Reader *m_reader;
Reader *m_idxreader;
Header m_pointheader;
Header m_idxheader;
Bounds<double> m_bounds;
bool m_indexBuilt, m_tempFileStarted, m_readerCreated, m_readOnly, m_writestandaloneindex, m_forceNewIndex;
int m_debugOutputLevel;
boost::uint8_t m_versionMajor, m_versionMinor;
boost::uint32_t m_pointRecordsCount, m_maxMemoryUsage, m_cellsX, m_cellsY, m_cellsZ, m_totalCells,
m_DataVLR_ID;
liblas::detail::TempFileOffsetType m_tempFileWrittenBytes;
double m_rangeX, m_rangeY, m_rangeZ, m_cellSizeZ, m_cellSizeX, m_cellSizeY;
std::string m_tempFileName;
std::string m_indexAuthor;
std::string m_indexComment;
std::string m_indexDate;
std::vector<boost::uint32_t> m_filterResult;
std::ostream *m_ofs;
FILE *m_tempFile, *m_outputFile;
FILE *m_debugger;
void SetValues(void);
bool IndexInit(void);
void ClearOldIndex(void);
bool BuildIndex(void);
bool Validate(void);
boost::uint32_t GetDefaultReserve(void);
bool LoadIndexVLR(VariableRecord const& vlr);
void SetCellFilterBounds(IndexData & ParamSrc);
bool FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexData & ParamSrc, bool & VLRDone);
bool FilterPointSeries(boost::uint32_t & PointID, boost::uint32_t & PointsScanned,
boost::uint32_t const PointsToIgnore, boost::uint32_t const x, boost::uint32_t const y, boost::uint32_t const z,
liblas::detail::ConsecPtAccumulator const ConsecutivePts, IndexIterator *Iterator,
IndexData const& ParamSrc);
bool VLRInteresting(boost::int32_t MinCellX, boost::int32_t MinCellY, boost::int32_t MaxCellX, boost::int32_t MaxCellY,
IndexData const& ParamSrc);
bool CellInteresting(boost::int32_t x, boost::int32_t y, IndexData const& ParamSrc);
bool SubCellInteresting(boost::int32_t SubCellID, boost::int32_t XCellID, boost::int32_t YCellID, IndexData const& ParamSrc);
bool ZCellInteresting(boost::int32_t ZCellID, IndexData const& ParamSrc);
bool FilterOnePoint(boost::int32_t x, boost::int32_t y, boost::int32_t z, boost::int32_t PointID, boost::int32_t LastPointID, bool &LastPtRead,
IndexData const& ParamSrc);
// Determines what X/Y cell in the basic cell matrix a point falls in
bool IdentifyCell(Point const& CurPt, boost::uint32_t& CurCellX, boost::uint32_t& CurCellY) const;
// determines what Z cell a point falls in
bool IdentifyCellZ(Point const& CurPt, boost::uint32_t& CurCellZ) const;
// Determines what quadrant sub-cell a point falls in
bool IdentifySubCell(Point const& CurPt, boost::uint32_t x, boost::uint32_t y, boost::uint32_t& CurSubCell) const;
// Offloads binned cell data while building Index when cell data in memory exceeds maximum set by user
bool PurgePointsToTempFile(IndexCellDataBlock& CellBlock);
// Reloads and examines one cell of data from temp file
bool LoadCellFromTempFile(liblas::detail::IndexCell *CellBlock,
boost::uint32_t CurCellX, boost::uint32_t CurCellY);
// temp file is used to store sorted data while building index
FILE *OpenTempFile(void);
// closes and removes the temp file
void CloseTempFile(void);
// Creates a Writer from m_ofs and re-saves entire LAS input file with new index
// Current version does not save any data following the points
bool SaveIndexInLASFile(void);
// Creates a Writer from m_ofs and re-saves LAS header with new index, but not with data point records
bool SaveIndexInStandAloneFile(void);
// Calculate index bounds dimensions
void CalcRangeX(void) {m_rangeX = (m_bounds.max)(0) - (m_bounds.min)(0);}
void CalcRangeY(void) {m_rangeY = (m_bounds.max)(1) - (m_bounds.min)(1);}
void CalcRangeZ(void) {m_rangeZ = (m_bounds.max)(2) - (m_bounds.min)(2);}
// error messages
bool FileError(const char *Reporter);
bool InputFileError(const char *Reporter) const;
bool OutputFileError(const char *Reporter) const;
bool DebugOutputError(const char *Reporter) const;
bool PointCountError(const char *Reporter) const;
bool PointBoundsError(const char *Reporter) const;
bool MemoryError(const char *Reporter) const;
bool InitError(const char *Reporter) const;
bool InputBoundsError(const char *Reporter) const;
// debugging
bool OutputCellStats(IndexCellDataBlock& CellBlock) const;
bool OutputCellGraph(std::vector<boost::uint32_t> CellPopulation, boost::uint32_t MaxPointsPerCell) const;
public:
// IndexFailed and IndexReady can be used to tell if an Index is ready for a filter operation
bool IndexFailed(void) const {return (! m_indexBuilt);}
bool IndexReady(void) const {return (m_indexBuilt);}
// Prep takes the input data and initializes Index values and then either builds or examines the Index
bool Prep(IndexData const& ParamSrc);
// Filter performs a point filter using the bounds in ParamSrc
const std::vector<boost::uint32_t>& Filter(IndexData & ParamSrc);
IndexIterator* Filter(IndexData const& ParamSrc, boost::uint32_t ChunkSize);
IndexIterator* Filter(double LowFilterX, double HighFilterX, double LowFilterY, double HighFilterY,
double LowFilterZ, double HighFilterZ, boost::uint32_t ChunkSize);
IndexIterator* Filter(Bounds<double> const& BoundsSrc, boost::uint32_t ChunkSize);
// Return the bounds of the current Index
double GetMinX(void) const {return (m_bounds.min)(0);}
double GetMaxX(void) const {return (m_bounds.max)(0);}
double GetMinY(void) const {return (m_bounds.min)(1);}
double GetMaxY(void) const {return (m_bounds.max)(1);}
double GetMinZ(void) const {return (m_bounds.min)(2);}
double GetMaxZ(void) const {return (m_bounds.max)(2);}
// Ranges are updated when an index is built or the index header VLR read
double GetRangeX(void) const {return m_rangeX;}
double GetRangeY(void) const {return m_rangeY;}
double GetRangeZ(void) const {return m_rangeZ;}
Bounds<double> const& GetBounds(void) const {return m_bounds;}
// Return the number of points used to build the Index
boost::uint32_t GetPointRecordsCount(void) const {return m_pointRecordsCount;}
// Return the number of cells in the Index
boost::uint32_t GetCellsX(void) const {return m_cellsX;}
boost::uint32_t GetCellsY(void) const {return m_cellsY;}
// Return the number of Z-dimension cells in the Index. Value is 1 if no Z-cells were created during Index building
boost::uint32_t GetCellsZ(void) const {return m_cellsZ;}
// 42 is the ID for the Index header VLR and 43 is the normal ID for the Index data VLR's
// For future expansion, multiple indexes could assign data VLR ID's of their own choosing
boost::uint32_t GetDataVLR_ID(void) const {return m_DataVLR_ID;}
// Since the user can define a Z cell size it is useful to examine that for an existing index
double GetCellSizeZ(void) const {return m_cellSizeZ;}
// Return values used in building or examining index
FILE *GetDebugger(void) const {return m_debugger;}
bool GetReadOnly(void) const {return m_readOnly;}
bool GetStandaloneIndex(void) const {return m_writestandaloneindex;}
bool GetForceNewIndex(void) const {return m_forceNewIndex;}
boost::uint32_t GetMaxMemoryUsage(void) const {return m_maxMemoryUsage;}
int GetDebugOutputLevel(void) const {return m_debugOutputLevel;}
// Not sure if these are more useful than dangerous
Header *GetPointHeader(void) {return &m_pointheader;}
Header *GetIndexHeader(void) {return &m_idxheader;}
Reader *GetReader(void) const {return m_reader;}
Reader *GetIndexReader(void) const {return m_idxreader;}
const char *GetTempFileName(void) const {return m_tempFileName.c_str();}
// Returns the strings set in the index when built
const char *GetIndexAuthorStr(void) const;
const char *GetIndexCommentStr(void) const;
const char *GetIndexDateStr(void) const;
boost::uint8_t GetVersionMajor(void) const {return m_versionMajor;}
boost::uint8_t GetVersionMinor(void) const {return m_versionMinor;}
// Methods for setting values used when reading index from file to facilitate moving reading function into
// separate IndexInput object at a future time to provide symmetry with IndexOutput
void SetDataVLR_ID(boost::uint32_t DataVLR_ID) {m_DataVLR_ID = DataVLR_ID;}
void SetIndexAuthorStr(const char *ias) {m_indexAuthor = ias;}
void SetIndexCommentStr(const char *ics) {m_indexComment = ics;}
void SetIndexDateStr(const char *ids) {m_indexDate = ids;}
void SetMinX(double minX) {(m_bounds.min)(0, minX);}
void SetMaxX(double maxX) {(m_bounds.max)(0, maxX);}
void SetMinY(double minY) {(m_bounds.min)(1, minY);}
void SetMaxY(double maxY) {(m_bounds.max)(1, maxY);}
void SetMinZ(double minZ) {(m_bounds.min)(2, minZ);}
void SetMaxZ(double maxZ) {(m_bounds.max)(2, maxZ);}
void SetPointRecordsCount(boost::uint32_t prc) {m_pointRecordsCount = prc;}
void SetCellsX(boost::uint32_t cellsX) {m_cellsX = cellsX;}
void SetCellsY(boost::uint32_t cellsY) {m_cellsY = cellsY;}
void SetCellsZ(boost::uint32_t cellsZ) {m_cellsZ = cellsZ;}
};
// IndexData is used to pass attributes to and from the Index itself.
// How it is initialized determines what action is taken when an Index object is instantiated with the IndexData.
// The choices are:
// a) Build an index for an las file
// 1) std::ostream *ofs must be supplied as well as std::istream *ifs or Reader *reader and a full file path
// for writing a temp file, const char *tmpfilenme.
// b) Examine an index for an las file
// 1) std::istream *ifs or Reader *reader must be supplied for the LAS file containing the point data
// 2) if the index to be read is in a standalone file then Reader *idxreader must also be supplied
// Options for building are
// a) build a new index even if an old one exists, overwriting the old one
// 1) forcenewindex must be true
// 2) std::ostream *ofs must be a valid ostream where there is storage space for the desired output
// b) only build an index if none exists
// 1) forcenewindex must be false
// 2) std::ostream *ofs must be a valid ostream where there is storage space for the desired output
// c) do not build a new index under any circumstances
// 1) readonly must be true
// Location of the index can be specified
// a) build the index within the las file VLR structure
// 1) writestandaloneindex must be false
// 2) std::ostream *ofs must be a valid ostream where there is storage space for a full copy
// of the LAS file plus the new index which is typically less than 5% of the original file size
// b) build a stand-alone index outside the las file
// 1) writestandaloneindex must be true
// 2) std::ostream *ofs must be a valid ostream where there is storage space for the new index
// which is typically less than 5% of the original file size
// How the index is built is determined also by members of the IndexData class object.
// Options include:
// a) control the maximum memory used during the build process
// 1) pass a value for maxmem in bytes greater than 0. 0 resolves to default LIBLAS_INDEX_MAXMEMDEFAULT.
// b) debug messages generated during index creation or filtering. The higher the number, the more messages.
// 0) no debug reports
// 1) general info messages
// 2) status messages
// 3) cell statistics
// 4) progress status
// c) where debug messages are sent
// 1) default is stderr
// d) control the creation of z-dimensional cells and what z cell size to use
// 1) to turn on z-dimensional binning, use a value larger than 0 for zbinht
// e) data can be stored in index header for later use in recognizing the index.
// 1) Index author indexauthor - provided by author at time of creation
// 2) Index comment indexcomment - provided by author at time of creation
// 3) Index creation date indexdate - provided by author at time of creation
// The fields are not validated in any way by the index building code and are just three fields
// which can be used as the user sees fit. Maximum length is LIBLAS_INDEX_MAXSTRLEN - 1.
// Once an index is built, or if an index already exists, the IndexData can be configured
// to define the bounds of a filter operation. Any dimension whose bounds pair are equal will
// be disregarded for the purpose of filtering. Filtering on the Z axis can still be performed even if the
// index was not built with Z cell sorting. Bounds must be defined in the same units and coordinate
// system that a liblas::Header returns with the commands GetMin{X|Y|Z} and a liblas::Point returns with
// Get{X|Y|Z}
class LAS_DLL IndexData
{
friend class Index;
friend class IndexIterator;
public:
IndexData(void);
IndexData(Index const& index);
// use one of these methods to configure the IndexData with the values needed for specific tasks
// one comprehensive method to set all the values used in index initialization
bool SetInitialValues(std::istream *ifs = 0, Reader *reader = 0, std::ostream *ofs = 0, Reader *idxreader = 0,
const char *tmpfilenme = 0, const char *indexauthor = 0,
const char *indexcomment = 0, const char *indexdate = 0, double zbinht = 0.0,
boost::uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, bool readonly = 0,
bool writestandaloneindex = 0, bool forcenewindex = 0, FILE *debugger = 0);
// set the values needed for building an index embedded in existing las file, overriding any existing index
bool SetBuildEmbedValues(Reader *reader, std::ostream *ofs, const char *tmpfilenme, const char *indexauthor = 0,
const char *indexcomment = 0, const char *indexdate = 0, double zbinht = 0.0,
boost::uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, FILE *debugger = 0);
// set the values needed for building an index in a standalone file, overriding any existing index
bool SetBuildAloneValues(Reader *reader, std::ostream *ofs, const char *tmpfilenme, const char *indexauthor = 0,
const char *indexcomment = 0, const char *indexdate = 0, double zbinht = 0.0,
boost::uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, FILE *debugger = 0);
// set the values needed for filtering with an existing index in an las file
bool SetReadEmbedValues(Reader *reader, int debugoutputlevel = 0, FILE *debugger = 0);
// set the values needed for filtering with an existing index in a standalone file
bool SetReadAloneValues(Reader *reader, Reader *idxreader, int debugoutputlevel = 0, FILE *debugger = 0);
// set the values needed for building an index embedded in existing las file only if no index already exists
// otherwise, prepare the existing index for filtering
bool SetReadOrBuildEmbedValues(Reader *reader, std::ostream *ofs, const char *tmpfilenme, const char *indexauthor = 0,
const char *indexcomment = 0, const char *indexdate = 0, double zbinht = 0.0,
boost::uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, FILE *debugger = 0);
// set the values needed for building an index in a standalone file only if no index already exists in the las file
// otherwise, prepare the existing index for filtering
bool SetReadOrBuildAloneValues(Reader *reader, std::ostream *ofs, const char *tmpfilenme, const char *indexauthor = 0,
const char *indexcomment = 0, const char *indexdate = 0, double zbinht = 0.0,
boost::uint32_t maxmem = LIBLAS_INDEX_MAXMEMDEFAULT, int debugoutputlevel = 0, FILE *debugger = 0);
// set the bounds for use in filtering
bool SetFilterValues(double LowFilterX, double HighFilterX, double LowFilterY, double HighFilterY, double LowFilterZ, double HighFilterZ,
Index const& index);
bool SetFilterValues(Bounds<double> const& src, Index const& index);
/// Copy constructor.
IndexData(IndexData const& other);
/// Assignment operator.
IndexData& operator=(IndexData const& rhs);
private:
void SetValues(void);
bool CalcFilterEnablers(void);
void Copy(IndexData const& other);
protected:
Reader *m_reader;
Reader *m_idxreader;
IndexIterator *m_iterator;
Bounds<double> m_filter;
std::istream *m_ifs;
std::ostream *m_ofs;
const char *m_tempFileName;
const char *m_indexAuthor;
const char *m_indexComment;
const char *m_indexDate;
double m_cellSizeZ;
double m_LowXBorderPartCell, m_HighXBorderPartCell, m_LowYBorderPartCell, m_HighYBorderPartCell;
boost::int32_t m_LowXCellCompletelyIn, m_HighXCellCompletelyIn, m_LowYCellCompletelyIn, m_HighYCellCompletelyIn,
m_LowZCellCompletelyIn, m_HighZCellCompletelyIn;
boost::int32_t m_LowXBorderCell, m_HighXBorderCell, m_LowYBorderCell, m_HighYBorderCell,
m_LowZBorderCell, m_HighZBorderCell;
boost::uint32_t m_maxMemoryUsage;
int m_debugOutputLevel;
bool m_noFilterX, m_noFilterY, m_noFilterZ, m_readOnly, m_writestandaloneindex, m_forceNewIndex, m_indexValid;
FILE *m_debugger;
void SetIterator(IndexIterator *setIt) {m_iterator = setIt;}
IndexIterator *GetIterator(void) {return(m_iterator);}
public:
double GetCellSizeZ(void) const {return m_cellSizeZ;}
FILE *GetDebugger(void) const {return m_debugger;}
bool GetReadOnly(void) const {return m_readOnly;}
bool GetStandaloneIndex(void) const {return m_writestandaloneindex;}
bool GetForceNewIndex(void) const {return m_forceNewIndex;}
boost::uint32_t GetMaxMemoryUsage(void) const {return m_maxMemoryUsage;}
Reader *GetReader(void) const {return m_reader;}
int GetDebugOutputLevel(void) const {return m_debugOutputLevel;}
const char *GetTempFileName(void) const {return m_tempFileName;}
const char *GetIndexAuthorStr(void) const;
const char *GetIndexCommentStr(void) const;
const char *GetIndexDateStr(void) const;
double GetMinFilterX(void) const {return (m_filter.min)(0);}
double GetMaxFilterX(void) const {return (m_filter.max)(0);}
double GetMinFilterY(void) const {return (m_filter.min)(1);}
double GetMaxFilterY(void) const {return (m_filter.max)(1);}
double GetMinFilterZ(void) const {return (m_filter.min)(2);}
double GetMaxFilterZ(void) const {return (m_filter.max)(2);}
void ClampFilterBounds(Bounds<double> const& m_bounds);
void SetReader(Reader *reader) {m_reader = reader;}
void SetIStream(std::istream *ifs) {m_ifs = ifs;}
void SetOStream(std::ostream *ofs) {m_ofs = ofs;}
void SetTmpFileName(const char *tmpfilenme) {m_tempFileName = tmpfilenme;}
void SetIndexAuthor(const char *indexauthor) {m_indexAuthor = indexauthor;}
void SetIndexComment(const char *indexcomment) {m_indexComment = indexcomment;}
void SetIndexDate(const char *indexdate) {m_indexDate = indexdate;}
void SetCellSizeZ(double cellsizez) {m_cellSizeZ = cellsizez;}
void SetMaxMem(boost::uint32_t maxmem) {m_maxMemoryUsage = maxmem;}
void SetDebugOutputLevel(int debugoutputlevel) {m_debugOutputLevel = debugoutputlevel;}
void SetReadOnly(bool readonly) {m_readOnly = readonly;}
void SetStandaloneIndex(bool writestandaloneindex) {m_writestandaloneindex = writestandaloneindex;}
void SetDebugger(FILE *debugger) {m_debugger = debugger;}
};
class LAS_DLL IndexIterator
{
friend class Index;
protected:
IndexData m_indexData;
Index *m_index;
boost::uint32_t m_chunkSize, m_advance;
boost::uint32_t m_curVLR, m_curCellStartPos, m_curCellX, m_curCellY, m_totalPointsScanned, m_ptsScannedCurCell,
m_ptsScannedCurVLR;
boost::uint32_t m_conformingPtsFound;
public:
IndexIterator(Index *IndexSrc, double LowFilterX, double HighFilterX, double LowFilterY, double HighFilterY,
double LowFilterZ, double HighFilterZ, boost::uint32_t ChunkSize);
IndexIterator(Index *IndexSrc, IndexData const& IndexDataSrc, boost::uint32_t ChunkSize);
IndexIterator(Index *IndexSrc, Bounds<double> const& BoundsSrc, boost::uint32_t ChunkSize);
/// Copy constructor.
IndexIterator(IndexIterator const& other);
/// Assignment operator.
IndexIterator& operator=(IndexIterator const& rhs);
private:
void Copy(IndexIterator const& other);
void ResetPosition(void);
boost::uint8_t MinMajorVersion(void) {return(1);};
boost::uint8_t MinMinorVersion(void) {return(2);};
public:
/// n=0 or n=1 gives next sequence with no gap, n>1 skips n-1 filter-compliant points, n<0 jumps backwards n compliant points
const std::vector<boost::uint32_t>& advance(boost::int32_t n);
/// returns filter-compliant points as though the first point returned is element n in a zero-based array
const std::vector<boost::uint32_t>& operator()(boost::int32_t n);
/// returns next set of filter-compliant points with no skipped points
inline const std::vector<boost::uint32_t>& operator++() {return (advance(1));}
/// returns next set of filter-compliant points with no skipped points
inline const std::vector<boost::uint32_t>& operator++(int) {return (advance(1));}
/// returns set of filter-compliant points skipping backwards 1 from the end of the last set
inline const std::vector<boost::uint32_t>& operator--() {return (advance(-1));}
/// returns set of filter-compliant points skipping backwards 1 from the end of the last set
inline const std::vector<boost::uint32_t>& operator--(int) {return (advance(-1));}
/// returns next set of filter-compliant points with n-1 skipped points, for n<0 acts like -=()
inline const std::vector<boost::uint32_t>& operator+=(boost::int32_t n) {return (advance(n));}
/// returns next set of filter-compliant points with n-1 skipped points, for n<0 acts like -()
inline const std::vector<boost::uint32_t>& operator+(boost::int32_t n) {return (advance(n));}
/// returns set of filter-compliant points beginning n points backwards from the end of the last set, for n<0 acts like +=()
inline const std::vector<boost::uint32_t>& operator-=(boost::int32_t n) {return (advance(-n));}
/// returns set of filter-compliant points beginning n points backwards from the end of the last set, for n<0 acts like +()
inline const std::vector<boost::uint32_t>& operator-(boost::int32_t n) {return (advance(-n));}
/// returns filter-compliant points as though the first point returned is element n in a zero-based array
inline const std::vector<boost::uint32_t>& operator[](boost::int32_t n) {return ((*this)(n));}
/// tests viability of index for filtering with iterator
bool ValidateIndexVersion(boost::uint8_t VersionMajor, boost::uint8_t VersionMinor) {return (VersionMajor > MinMajorVersion() || (VersionMajor == MinMajorVersion() && VersionMinor >= MinMinorVersion()));};
};
template <typename T, typename Q>
inline void ReadVLRData_n(T& dest, IndexVLRData const& src, Q& pos)
{
// error if reading past array end
if (static_cast<size_t>(pos) + sizeof(T) > src.size())
throw std::out_of_range("liblas::detail::ReadVLRData_n: array index out of range");
// copy sizeof(T) bytes to destination
memcpy(&dest, &src[pos], sizeof(T));
// Fix little-endian
LIBLAS_SWAP_BYTES_N(dest, sizeof(T));
// increment the write position to end of written data
pos = pos + static_cast<Q>(sizeof(T));
}
template <typename T, typename Q>
inline void ReadVLRDataNoInc_n(T& dest, IndexVLRData const& src, Q const& pos)
{
// error if reading past array end
if (static_cast<size_t>(pos) + sizeof(T) > src.size())
throw std::out_of_range("liblas::detail::ReadVLRDataNoInc_n: array index out of range");
// copy sizeof(T) bytes to destination
memcpy(&dest, &src[pos], sizeof(T));
// Fix little-endian
LIBLAS_SWAP_BYTES_N(dest, sizeof(T));
}
template <typename T, typename Q>
inline void ReadeVLRData_str(char * dest, IndexVLRData const& src, T const srclen, Q& pos)
{
// error if reading past array end
if (static_cast<size_t>(pos) + static_cast<size_t>(srclen) > src.size())
throw std::out_of_range("liblas::detail::ReadeVLRData_str: array index out of range");
// copy srclen bytes to destination
memcpy(dest, &src[pos], srclen);
// increment the write position to end of written data
pos = pos + static_cast<Q>(srclen);
}
template <typename T, typename Q>
inline void ReadVLRDataNoInc_str(char * dest, IndexVLRData const& src, T const srclen, Q pos)
{
// error if reading past array end
if (static_cast<size_t>(pos) + static_cast<size_t>(srclen) > src.size())
throw std::out_of_range("liblas::detail::ReadVLRDataNoInc_str: array index out of range");
// copy srclen bytes to destination
std::memcpy(dest, &src[pos], srclen);
}
} // namespace liblas
#endif // LIBLAS_LASINDEX_HPP_INCLUDED
| 53.811189
| 206
| 0.752177
|
LSDtopotools
|
601188630d64a9e6b2cfa4bc770f0ffe10961168
| 14,615
|
hpp
|
C++
|
pecos/core/utils/scipy_loader.hpp
|
xeisberg/pecos
|
c9cf209676205dd000479861667351e724f0ba1c
|
[
"Apache-2.0"
] | 288
|
2021-04-26T21:34:12.000Z
|
2022-03-29T19:50:06.000Z
|
pecos/core/utils/scipy_loader.hpp
|
xeisberg/pecos
|
c9cf209676205dd000479861667351e724f0ba1c
|
[
"Apache-2.0"
] | 32
|
2021-04-29T23:58:23.000Z
|
2022-03-28T17:23:04.000Z
|
pecos/core/utils/scipy_loader.hpp
|
xeisberg/pecos
|
c9cf209676205dd000479861667351e724f0ba1c
|
[
"Apache-2.0"
] | 63
|
2021-04-28T20:12:59.000Z
|
2022-03-29T14:10:36.000Z
|
/*
* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
#ifndef __SCIPY_LOADER_H__
#define __SCIPY_LOADER_H__
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <vector>
#include "utils/file_util.hpp"
namespace pecos {
//https://numpy.org/devdocs/reference/generated/numpy.lib.format.html
template<typename T>
class NpyArray {
public:
typedef T value_type;
typedef std::vector<value_type> array_t;
typedef std::vector<uint64_t> shape_t;
shape_t shape;
array_t array;
size_t num_elements;
bool fortran_order;
NpyArray() {}
NpyArray(const std::string& filename, uint64_t offset=0) { load(filename, offset); }
NpyArray(const std::vector<uint64_t>& shape, value_type default_value=0) { resize(shape, default_value); }
/* load an NpyArry<T> starting from the `offset`-th byte in the file with `filename` */
NpyArray<T>& load(const std::string& filename, uint64_t offset=0) {
//https://numpy.org/devdocs/reference/generated/numpy.lib.format.html
FILE *fp = fopen(filename.c_str(), "rb");
fseek(fp, offset, SEEK_SET);
// check magic string
std::vector<uint8_t> magic = {0x93u, 'N', 'U', 'M', 'P', 'Y'};
for(size_t i = 0; i < magic.size(); i++) {
if (pecos::file_util::fget_one<uint8_t>(fp) != magic[i]) {
throw std::runtime_error("file is not a valid NpyFile");
}
}
// load version
uint8_t major_version = pecos::file_util::fget_one<uint8_t>(fp);
uint8_t minor_version = pecos::file_util::fget_one<uint8_t>(fp);
// load header len
uint64_t header_len;
if(major_version == 1) {
header_len = pecos::file_util::fget_one<uint16_t>(fp);
} else if (major_version == 2) {
header_len = pecos::file_util::fget_one<uint32_t>(fp);
} else {
throw std::runtime_error("unsupported NPY major version");
}
if(minor_version != 0) {
throw std::runtime_error("unsupported NPY minor version");
}
// load header
std::vector<char> header(header_len + 1, (char) 0);
pecos::file_util::fget_multiple<char>(&header[0], header_len, fp);
char endian_code, type_code;
uint32_t word_size;
std::string dtype;
this->parse_header(header, endian_code, type_code, word_size, dtype);
// load array content
this->load_content(fp, word_size, dtype);
fclose(fp);
return *this;
}
void resize(const std::vector<uint64_t>& new_shape, value_type default_value=value_type()) {
shape = new_shape;
size_t num_elements = 1;
for(auto& dim : shape) {
num_elements *= dim;
}
array.resize(num_elements);
std::fill(array.begin(), array.end(), default_value);
}
size_t ndim() const { return shape.size(); }
size_t size() const { return num_elements; }
value_type* data() { return &array[0]; }
value_type& at(size_t idx) { return array[idx]; }
const value_type& at(size_t idx) const { return array[idx]; }
value_type& operator[](size_t idx) { return array[idx]; }
const value_type& operator[](size_t idx) const { return array[idx]; }
private:
void parse_header(const std::vector<char>& header, char& endian_code, char& type_code, uint32_t& word_size, std::string& dtype) {
char value_buffer[1024] = {0};
const char* header_cstr = &header[0];
// parse descr in a str form
if(1 != sscanf(strstr(header_cstr, "'descr'"), "'descr': '%[^']' ", value_buffer)) {
throw std::runtime_error("invalid NPY header (descr)");
}
dtype = std::string(value_buffer);
if(3 != sscanf(value_buffer, "%c%c%u", &endian_code, &type_code, &word_size)) {
throw std::runtime_error("invalid NPY header (descr parse)");
}
// parse fortran_order in a boolean form [False, True]
if(1 != sscanf(strstr(header_cstr, "'fortran_order'"), "'fortran_order': %[FalseTrue] ", value_buffer)) {
throw std::runtime_error("invalid NPY header (fortran_order)");
}
this->fortran_order = std::string(value_buffer) == "True";
// parse shape in a tuple form
if (0 > sscanf(strstr(header_cstr, "'shape'"), "'shape': (%[^)]) ", value_buffer)) {
throw std::runtime_error("invalid NPY header (shape)");
}
char *ptr = &value_buffer[0];
int offset;
uint64_t dim;
num_elements = 1;
shape.clear();
while(sscanf(ptr, "%lu, %n", &dim, &offset) == 1) {
ptr += offset;
shape.push_back(dim);
num_elements *= dim;
}
// handle the case with single element case: shape=()
if(shape.size() == 0 && num_elements == 1) {
shape.push_back(1);
}
}
template<typename U=value_type, typename std::enable_if<std::is_arithmetic<U>::value, U>::type* = nullptr>
void load_content(FILE *fp, uint32_t& word_size, const std::string& dtype) {
array.resize(num_elements);
auto type_code = dtype.substr(1);
#define IF_CLAUSE_FOR(np_type_code, c_type) \
if(type_code == np_type_code) { \
bool byte_swap = pecos::file_util::different_from_runtime(dtype[0]); \
size_t batch_size = 32768; \
std::vector<c_type> batch(batch_size); \
for(size_t i = 0; i < num_elements; i += batch_size) { \
size_t num = std::min(batch_size, num_elements - i); \
pecos::file_util::fget_multiple<c_type>(batch.data(), num, fp, byte_swap); \
for(size_t b = 0; b < num; b++) { \
array[i + b] = static_cast<value_type>(batch[b]); \
} \
} \
}
IF_CLAUSE_FOR("f4", float)
else IF_CLAUSE_FOR("f8", double)
else IF_CLAUSE_FOR("f16", long double)
else IF_CLAUSE_FOR("i1", int8_t)
else IF_CLAUSE_FOR("i2", int16_t)
else IF_CLAUSE_FOR("i4", int32_t)
else IF_CLAUSE_FOR("i8", int64_t)
else IF_CLAUSE_FOR("u1", uint8_t)
else IF_CLAUSE_FOR("u2", uint16_t)
else IF_CLAUSE_FOR("u4", uint32_t)
else IF_CLAUSE_FOR("u8", uint64_t)
else IF_CLAUSE_FOR("b1", uint8_t)
#undef IF_CLAUSE_FOR
}
template<typename U=value_type, typename std::enable_if<std::is_same<value_type, std::basic_string<typename U::value_type>>::value, U>::type* = nullptr>
void load_content(FILE *fp, const uint32_t& word_size, const std::string& dtype) {
array.resize(num_elements);
auto type_code = dtype[1];
#define IF_CLAUSE_FOR(np_type_code, c_type, char_size) \
if(type_code == np_type_code) { \
std::vector<c_type> char_buffer(word_size); \
bool byte_swap = pecos::file_util::different_from_runtime(dtype[0]); \
for(size_t i = 0; i < num_elements; i++) { \
pecos::file_util::fget_multiple<c_type>(&char_buffer[0], word_size, fp, byte_swap); \
array[i] = value_type(reinterpret_cast<typename T::value_type*>(&char_buffer[0]), word_size * char_size); \
} \
}
// numpy uses UCS4 to encode unicode https://numpy.org/devdocs/reference/c-api/dtype.html?highlight=ucs4
IF_CLAUSE_FOR('U', char32_t, 4)
else IF_CLAUSE_FOR('S', char, 1)
#undef IF_CLAUSE_FOR
}
};
class ReadOnlyZipArchive {
private:
struct FileInfo {
std::string name;
uint64_t offset_of_content;
uint64_t offset_of_header;
uint64_t uncompressed_size;
uint64_t compressed_size;
uint16_t compression_method;
uint32_t signature;
uint16_t version;
uint16_t bit_flag;
uint16_t last_modified_time;
uint16_t last_modified_date;
uint32_t crc_32;
FileInfo() {}
static bool valid_start(FILE *fp) {
return pecos::file_util::fpeek<uint32_t>(fp) == 0x04034b50; // local header
}
// https://en.wikipedia.org/wiki/Zip_(file_format)#ZIP64
// https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
static FileInfo get_one_from(FILE *fp) {
// ReadOnlyZipArchive always uses little endian
bool byte_swap = pecos::file_util::different_from_runtime('<');
FileInfo info;
info.offset_of_header = ftell(fp);
info.signature = pecos::file_util::fget_one<uint32_t>(fp, byte_swap);
info.version = pecos::file_util::fget_one<uint16_t>(fp, byte_swap);
info.bit_flag = pecos::file_util::fget_one<uint16_t>(fp, byte_swap);
info.compression_method = pecos::file_util::fget_one<uint16_t>(fp, byte_swap);
info.last_modified_time = pecos::file_util::fget_one<uint16_t>(fp, byte_swap);
info.last_modified_date = pecos::file_util::fget_one<uint16_t>(fp, byte_swap);
info.crc_32 = pecos::file_util::fget_one<uint32_t>(fp, byte_swap);
if(info.compression_method != 0) {
throw std::runtime_error("only uncompressed zip archive is supported.");
}
info.compressed_size = pecos::file_util::fget_one<uint32_t>(fp, byte_swap);
info.uncompressed_size = pecos::file_util::fget_one<uint32_t>(fp, byte_swap);
auto filename_length = pecos::file_util::fget_one<uint16_t>(fp, byte_swap);
auto extra_field_length = pecos::file_util::fget_one<uint16_t>(fp, byte_swap);
std::vector<char> filename(filename_length, (char)0);
std::vector<char> extra_field(extra_field_length, (char)0);
pecos::file_util::fget_multiple<char>(&filename[0], filename_length, fp, byte_swap);
pecos::file_util::fget_multiple<char>(&extra_field[0], extra_field_length, fp, byte_swap);
info.name = std::string(&filename[0], filename_length);
info.offset_of_content = ftell(fp);
// handle zip64 extra field to obtain proper size information
uint64_t it = 0;
while(it < extra_field.size()) {
uint16_t header_id = *reinterpret_cast<uint16_t*>(&extra_field[it]);
it += sizeof(header_id);
uint16_t data_size = *reinterpret_cast<uint16_t*>(&extra_field[it]);
it += sizeof(data_size);
if(header_id == 0x0001) { // zip64 extended information in extra field
info.uncompressed_size = *reinterpret_cast<uint64_t*>(&extra_field[it]);
info.compressed_size = *reinterpret_cast<uint64_t*>(&extra_field[it + sizeof(info.uncompressed_size)]);
}
it += data_size;
}
// skip the actual content
fseek(fp, info.compressed_size, SEEK_CUR);
// skip the data descriptor if bit 3 of the general purpose bit flag is set
if (info.bit_flag & 8) {
fseek(fp, 12, SEEK_CUR);
}
return info;
}
};
std::vector<FileInfo> file_info_array;
std::unordered_map<std::string, FileInfo*> mapping;
public:
ReadOnlyZipArchive(const std::string& zip_name) {
FILE *fp = fopen(zip_name.c_str(), "rb");
while(FileInfo::valid_start(fp)) {
file_info_array.emplace_back(FileInfo::get_one_from(fp));
}
fclose(fp);
for(auto& file : file_info_array) {
mapping[file.name] = &file;
}
}
FileInfo& operator[](const std::string& name) { return *mapping.at(name); }
const FileInfo& operator[](const std::string& name) const { return *mapping.at(name); }
};
template<bool IsCsr, typename DataT, typename IndicesT = uint32_t, typename IndptrT = uint64_t, typename ShapeT = uint64_t>
struct ScipySparseNpz {
NpyArray<IndicesT> indices;
NpyArray<IndptrT> indptr;
NpyArray<DataT> data;
NpyArray<ShapeT> shape;
NpyArray<std::string> format;
ScipySparseNpz() {}
ScipySparseNpz(const std::string& npz_filepath) { load(npz_filepath); }
uint64_t size() const { return data.size(); }
uint64_t rows() const { return shape[0]; }
uint64_t cols() const { return shape[1]; }
uint64_t nnz() const { return data.size(); }
void load(const std::string& npz_filepath) {
auto npz = ReadOnlyZipArchive(npz_filepath);
format.load(npz_filepath, npz["format.npy"].offset_of_content);
if(IsCsr && format[0] != "csr") {
throw std::runtime_error(npz_filepath + " is not a valid scipy CSR npz");
} else if (!IsCsr && format[0] != "csc") {
throw std::runtime_error(npz_filepath + " is not a valid scipy CSC npz");
}
indices.load(npz_filepath, npz["indices.npy"].offset_of_content);
data.load(npz_filepath, npz["data.npy"].offset_of_content);
indptr.load(npz_filepath, npz["indptr.npy"].offset_of_content);
shape.load(npz_filepath, npz["shape.npy"].offset_of_content);
}
void fill_ones(size_t rows, size_t cols) {
shape.resize({2});
shape[0] = rows;
shape[1] = cols;
uint64_t nnz = rows * cols;
data.resize({nnz}, DataT(1));
indices.resize({nnz});
format.resize({1});
if(IsCsr) {
format[0] = "csr";
indptr.resize({rows + 1});
for(size_t r = 0; r < rows; r++) {
for(size_t c = 0; c < cols; c++) {
indices[r * cols + c] = c;
}
indptr[r + 1] = indptr[r] + cols;
}
} else {
format[0] = "csc";
indptr.resize({cols + 1});
for(size_t c = 0; c < cols; c++) {
for(size_t r = 0; r < rows; r++) {
indices[c * rows + r] = r;
}
indptr[c + 1] = indptr[c] + rows;
}
}
}
};
} // end namespace pecos
#endif // end of __SCIPY_LOADER_H__
| 38.766578
| 156
| 0.602395
|
xeisberg
|
6011f71730c5a91c5493b77d80c6e949dd86942f
| 996
|
cpp
|
C++
|
ChCppLibrary/CPP/ChModelLoader/ChModelLoader.cpp
|
Chronoss0518/GameLibrary
|
e6edcd1381be94c237c4527bfd8454ed9d6e8b52
|
[
"Zlib",
"MIT"
] | null | null | null |
ChCppLibrary/CPP/ChModelLoader/ChModelLoader.cpp
|
Chronoss0518/GameLibrary
|
e6edcd1381be94c237c4527bfd8454ed9d6e8b52
|
[
"Zlib",
"MIT"
] | 7
|
2022-01-13T11:00:30.000Z
|
2022-02-06T15:50:18.000Z
|
ChCppLibrary/CPP/ChModelLoader/ChModelLoader.cpp
|
Chronoss0518/GameLibrary
|
e6edcd1381be94c237c4527bfd8454ed9d6e8b52
|
[
"Zlib",
"MIT"
] | null | null | null |
#include"../../BaseIncluder/ChBase.h"
#include"../ChTextObject/ChTextObject.h"
#include"../ChModel/ChModelObject.h"
#include"ChModelLoader.h"
///////////////////////////////////////////////////////////////////////////////////////
//ChModelLoader Method//
///////////////////////////////////////////////////////////////////////////////////////
void ChCpp::ModelLoaderBase::Init(ModelObject* _model)
{
oModel = _model;
}
///////////////////////////////////////////////////////////////////////////////////////
void ChCpp::ModelLoaderBase::SetModel(ChPtr::Shared<ModelFrame> _models)
{
oModel->model = _models;
}
///////////////////////////////////////////////////////////////////////////////////////
std::string ChCpp::ModelLoaderBase::GetRoutePath(const std::string& _filePath)
{
if (_filePath.find("\\") == _filePath.find("/"))return "";
std::string tmpPath = ChStr::StrReplase(_filePath, "\\", "/");
unsigned long tmp = tmpPath.rfind("/");
return tmpPath.substr(0, tmp + 1);
}
| 26.210526
| 87
| 0.451807
|
Chronoss0518
|
601a43e8358bedf2ded7d654ed0974f2480b3fca
| 394
|
hpp
|
C++
|
RoboMan/CMD.hpp
|
paullohs/RoboMan
|
28014822766a558fa94127120142d081742c507a
|
[
"Unlicense"
] | null | null | null |
RoboMan/CMD.hpp
|
paullohs/RoboMan
|
28014822766a558fa94127120142d081742c507a
|
[
"Unlicense"
] | null | null | null |
RoboMan/CMD.hpp
|
paullohs/RoboMan
|
28014822766a558fa94127120142d081742c507a
|
[
"Unlicense"
] | null | null | null |
#pragma once
#include "VEC.hpp"
#include <deque>
class CMD;
typedef std::deque<CMD> CMD_DEQUE;
typedef int BOOL;
enum CMD_ENUM {
MOVE,
LASER,
WAIT
};
class __declspec(dllexport) CMD {
public:
CMD();
CMD(CMD &cpy);
CMD(CMD_ENUM &e, BOOL &b);
CMD(CMD_ENUM &e, VEC &v);
CMD(CMD_ENUM &e, NUM &n);
~CMD();
VEC coords;
CMD_ENUM command;
BOOL val;
NUM value;
private:
};
| 13.133333
| 34
| 0.639594
|
paullohs
|
601e39460d06a52934eede4b385fbbd9af244c81
| 25,384
|
hpp
|
C++
|
routing_algorithms/shortest_path.hpp
|
aaronbenz/osrm-backend
|
758d4023050d1f49971f919cea872a2276dafe14
|
[
"BSD-2-Clause"
] | 1
|
2021-03-06T05:07:44.000Z
|
2021-03-06T05:07:44.000Z
|
routing_algorithms/shortest_path.hpp
|
aaronbenz/osrm-backend
|
758d4023050d1f49971f919cea872a2276dafe14
|
[
"BSD-2-Clause"
] | null | null | null |
routing_algorithms/shortest_path.hpp
|
aaronbenz/osrm-backend
|
758d4023050d1f49971f919cea872a2276dafe14
|
[
"BSD-2-Clause"
] | null | null | null |
/*
Copyright (c) 2015, Project OSRM contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SHORTEST_PATH_HPP
#define SHORTEST_PATH_HPP
#include "../typedefs.h"
#include "routing_base.hpp"
#include "../data_structures/search_engine_data.hpp"
#include "../util/integer_range.hpp"
#include <boost/assert.hpp>
template <class DataFacadeT>
class ShortestPathRouting final
: public BasicRoutingInterface<DataFacadeT, ShortestPathRouting<DataFacadeT>>
{
using super = BasicRoutingInterface<DataFacadeT, ShortestPathRouting<DataFacadeT>>;
using QueryHeap = SearchEngineData::QueryHeap;
SearchEngineData &engine_working_data;
public:
ShortestPathRouting(DataFacadeT *facade, SearchEngineData &engine_working_data)
: super(facade), engine_working_data(engine_working_data)
{
}
~ShortestPathRouting() {}
// allows a uturn at the target_phantom
// searches source forward/reverse -> target forward/reverse
void SearchWithUTurn(QueryHeap &forward_heap,
QueryHeap &reverse_heap,
const bool search_from_forward_node,
const bool search_from_reverse_node,
const bool search_to_forward_node,
const bool search_to_reverse_node,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
const int total_distance_to_forward,
const int total_distance_to_reverse,
int &new_total_distance,
std::vector<NodeID> &leg_packed_path) const
{
forward_heap.Clear();
reverse_heap.Clear();
if (search_from_forward_node)
{
forward_heap.Insert(source_phantom.forward_node_id,
total_distance_to_forward -
source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
}
if (search_from_reverse_node)
{
forward_heap.Insert(source_phantom.reverse_node_id,
total_distance_to_reverse -
source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
}
if (search_to_forward_node)
{
reverse_heap.Insert(target_phantom.forward_node_id,
target_phantom.GetForwardWeightPlusOffset(),
target_phantom.forward_node_id);
}
if (search_to_reverse_node)
{
reverse_heap.Insert(target_phantom.reverse_node_id,
target_phantom.GetReverseWeightPlusOffset(),
target_phantom.reverse_node_id);
}
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
super::Search(forward_heap, reverse_heap, new_total_distance, leg_packed_path);
}
// If source and target are reverse on a oneway we need to find a path
// that connects the two. This is _not_ the shortest path in our model,
// as source and target are on the same edge based node.
// We force a detour by inserting "virtaul vias", which means we search a path
// from all nodes that are connected by outgoing edges to all nodes that are connected by
// incoming edges.
// ------^
// | ^source
// | ^
// | ^target
// ------^
void SearchLoop(QueryHeap &forward_heap,
QueryHeap &reverse_heap,
const bool search_forward_node,
const bool search_reverse_node,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
const int total_distance_to_forward,
const int total_distance_to_reverse,
int &new_total_distance_to_forward,
int &new_total_distance_to_reverse,
std::vector<NodeID> &leg_packed_path_forward,
std::vector<NodeID> &leg_packed_path_reverse) const
{
BOOST_ASSERT(source_phantom.forward_node_id == target_phantom.forward_node_id);
BOOST_ASSERT(source_phantom.reverse_node_id == target_phantom.reverse_node_id);
if (search_forward_node)
{
forward_heap.Clear();
reverse_heap.Clear();
auto node_id = source_phantom.forward_node_id;
for (const auto edge : super::facade->GetAdjacentEdgeRange(node_id))
{
const auto& data = super::facade->GetEdgeData(edge);
if (data.forward)
{
auto target = super::facade->GetTarget(edge);
auto offset = total_distance_to_forward + data.distance - source_phantom.GetForwardWeightPlusOffset();
forward_heap.Insert(target, offset, target);
}
if (data.backward)
{
auto target = super::facade->GetTarget(edge);
auto offset = data.distance + target_phantom.GetForwardWeightPlusOffset();
reverse_heap.Insert(target, offset, target);
}
}
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
super::Search(forward_heap, reverse_heap, new_total_distance_to_forward,
leg_packed_path_forward);
// insert node to both endpoints to close the leg
leg_packed_path_forward.push_back(node_id);
std::reverse(leg_packed_path_forward.begin(), leg_packed_path_forward.end());
leg_packed_path_forward.push_back(node_id);
std::reverse(leg_packed_path_forward.begin(), leg_packed_path_forward.end());
}
if (search_reverse_node)
{
forward_heap.Clear();
reverse_heap.Clear();
auto node_id = source_phantom.reverse_node_id;
for (const auto edge : super::facade->GetAdjacentEdgeRange(node_id))
{
const auto& data = super::facade->GetEdgeData(edge);
if (data.forward)
{
auto target = super::facade->GetTarget(edge);
auto offset = total_distance_to_reverse + data.distance - source_phantom.GetReverseWeightPlusOffset();
forward_heap.Insert(target, offset, target);
}
if (data.backward)
{
auto target = super::facade->GetTarget(edge);
auto offset = data.distance + target_phantom.GetReverseWeightPlusOffset();
reverse_heap.Insert(target, offset, target);
}
}
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
super::Search(forward_heap, reverse_heap, new_total_distance_to_reverse,
leg_packed_path_reverse);
// insert node to both endpoints to close the leg
leg_packed_path_reverse.push_back(node_id);
std::reverse(leg_packed_path_reverse.begin(), leg_packed_path_reverse.end());
leg_packed_path_reverse.push_back(node_id);
std::reverse(leg_packed_path_reverse.begin(), leg_packed_path_reverse.end());
}
}
// searches shortest path between:
// source forward/reverse -> target forward
// source forward/reverse -> target reverse
void Search(QueryHeap &forward_heap,
QueryHeap &reverse_heap,
const bool search_from_forward_node,
const bool search_from_reverse_node,
const bool search_to_forward_node,
const bool search_to_reverse_node,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
const int total_distance_to_forward,
const int total_distance_to_reverse,
int &new_total_distance_to_forward,
int &new_total_distance_to_reverse,
std::vector<NodeID> &leg_packed_path_forward,
std::vector<NodeID> &leg_packed_path_reverse) const
{
if (search_to_forward_node)
{
forward_heap.Clear();
reverse_heap.Clear();
reverse_heap.Insert(target_phantom.forward_node_id,
target_phantom.GetForwardWeightPlusOffset(),
target_phantom.forward_node_id);
if (search_from_forward_node)
{
forward_heap.Insert(source_phantom.forward_node_id,
total_distance_to_forward -
source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
}
if (search_from_reverse_node)
{
forward_heap.Insert(source_phantom.reverse_node_id,
total_distance_to_reverse -
source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
}
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
super::Search(forward_heap, reverse_heap, new_total_distance_to_forward,
leg_packed_path_forward);
}
if (search_to_reverse_node)
{
forward_heap.Clear();
reverse_heap.Clear();
reverse_heap.Insert(target_phantom.reverse_node_id,
target_phantom.GetReverseWeightPlusOffset(),
target_phantom.reverse_node_id);
if (search_from_forward_node)
{
forward_heap.Insert(source_phantom.forward_node_id,
total_distance_to_forward -
source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
}
if (search_from_reverse_node)
{
forward_heap.Insert(source_phantom.reverse_node_id,
total_distance_to_reverse -
source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
}
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
super::Search(forward_heap, reverse_heap, new_total_distance_to_reverse,
leg_packed_path_reverse);
}
}
void UnpackLegs(const std::vector<PhantomNodes> &phantom_nodes_vector,
const std::vector<NodeID> &total_packed_path,
const std::vector<std::size_t> &packed_leg_begin,
const int shortest_path_length,
InternalRouteResult &raw_route_data) const
{
raw_route_data.unpacked_path_segments.resize(packed_leg_begin.size() - 1);
raw_route_data.shortest_path_length = shortest_path_length;
for (const auto current_leg : osrm::irange<std::size_t>(0, packed_leg_begin.size() - 1))
{
auto leg_begin = total_packed_path.begin() + packed_leg_begin[current_leg];
auto leg_end = total_packed_path.begin() + packed_leg_begin[current_leg + 1];
const auto &unpack_phantom_node_pair = phantom_nodes_vector[current_leg];
super::UnpackPath(leg_begin, leg_end, unpack_phantom_node_pair,
raw_route_data.unpacked_path_segments[current_leg]);
raw_route_data.source_traversed_in_reverse.push_back(
(*leg_begin != phantom_nodes_vector[current_leg].source_phantom.forward_node_id));
raw_route_data.target_traversed_in_reverse.push_back(
(*std::prev(leg_end) !=
phantom_nodes_vector[current_leg].target_phantom.forward_node_id));
}
}
void operator()(const std::vector<PhantomNodes> &phantom_nodes_vector,
const std::vector<bool> &uturn_indicators,
InternalRouteResult &raw_route_data) const
{
BOOST_ASSERT(uturn_indicators.size() == phantom_nodes_vector.size() + 1);
engine_working_data.InitializeOrClearFirstThreadLocalStorage(
super::facade->GetNumberOfNodes());
QueryHeap &forward_heap = *(engine_working_data.forward_heap_1);
QueryHeap &reverse_heap = *(engine_working_data.reverse_heap_1);
int total_distance_to_forward = 0;
int total_distance_to_reverse = 0;
bool search_from_forward_node = phantom_nodes_vector.front().source_phantom.forward_node_id != SPECIAL_NODEID;
bool search_from_reverse_node = phantom_nodes_vector.front().source_phantom.reverse_node_id != SPECIAL_NODEID;
std::vector<NodeID> prev_packed_leg_to_forward;
std::vector<NodeID> prev_packed_leg_to_reverse;
std::vector<NodeID> total_packed_path_to_forward;
std::vector<std::size_t> packed_leg_to_forward_begin;
std::vector<NodeID> total_packed_path_to_reverse;
std::vector<std::size_t> packed_leg_to_reverse_begin;
std::size_t current_leg = 0;
// this implements a dynamic program that finds the shortest route through
// a list of vias
for (const auto &phantom_node_pair : phantom_nodes_vector)
{
int new_total_distance_to_forward = INVALID_EDGE_WEIGHT;
int new_total_distance_to_reverse = INVALID_EDGE_WEIGHT;
std::vector<NodeID> packed_leg_to_forward;
std::vector<NodeID> packed_leg_to_reverse;
const auto &source_phantom = phantom_node_pair.source_phantom;
const auto &target_phantom = phantom_node_pair.target_phantom;
BOOST_ASSERT(current_leg + 1 < uturn_indicators.size());
const bool allow_u_turn_at_via = uturn_indicators[current_leg + 1];
bool search_to_forward_node = target_phantom.forward_node_id != SPECIAL_NODEID;
bool search_to_reverse_node = target_phantom.reverse_node_id != SPECIAL_NODEID;
BOOST_ASSERT(!search_from_forward_node || source_phantom.forward_node_id != SPECIAL_NODEID);
BOOST_ASSERT(!search_from_reverse_node || source_phantom.reverse_node_id != SPECIAL_NODEID);
if (source_phantom.forward_node_id == target_phantom.forward_node_id &&
source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
{
search_to_forward_node = search_from_reverse_node;
}
if (source_phantom.reverse_node_id == target_phantom.reverse_node_id &&
source_phantom.GetReverseWeightPlusOffset() > target_phantom.GetReverseWeightPlusOffset())
{
search_to_reverse_node = search_from_forward_node;
}
BOOST_ASSERT(search_from_forward_node || search_from_reverse_node);
if(search_to_reverse_node || search_to_forward_node)
{
if (allow_u_turn_at_via)
{
SearchWithUTurn(forward_heap, reverse_heap, search_from_forward_node,
search_from_reverse_node, search_to_forward_node,
search_to_reverse_node, source_phantom, target_phantom,
total_distance_to_forward, total_distance_to_reverse,
new_total_distance_to_forward, packed_leg_to_forward);
// if only the reverse node is valid (e.g. when using the match plugin) we actually need to move
if (target_phantom.forward_node_id == SPECIAL_NODEID)
{
BOOST_ASSERT(target_phantom.reverse_node_id != SPECIAL_NODEID);
new_total_distance_to_reverse = new_total_distance_to_forward;
packed_leg_to_reverse = std::move(packed_leg_to_forward);
new_total_distance_to_forward = INVALID_EDGE_WEIGHT;
}
else if (target_phantom.reverse_node_id != SPECIAL_NODEID)
{
new_total_distance_to_reverse = new_total_distance_to_forward;
packed_leg_to_reverse = packed_leg_to_forward;
}
}
else
{
Search(forward_heap, reverse_heap, search_from_forward_node,
search_from_reverse_node, search_to_forward_node, search_to_reverse_node,
source_phantom, target_phantom, total_distance_to_forward,
total_distance_to_reverse, new_total_distance_to_forward,
new_total_distance_to_reverse, packed_leg_to_forward, packed_leg_to_reverse);
}
}
else
{
search_to_forward_node = target_phantom.forward_node_id != SPECIAL_NODEID;
search_to_reverse_node = target_phantom.reverse_node_id != SPECIAL_NODEID;
BOOST_ASSERT(search_from_reverse_node == search_to_reverse_node);
BOOST_ASSERT(search_from_forward_node == search_to_forward_node);
SearchLoop(forward_heap, reverse_heap, search_from_forward_node,
search_from_reverse_node, source_phantom, target_phantom, total_distance_to_forward,
total_distance_to_reverse, new_total_distance_to_forward,
new_total_distance_to_reverse, packed_leg_to_forward, packed_leg_to_reverse);
}
// No path found for both target nodes?
if ((INVALID_EDGE_WEIGHT == new_total_distance_to_forward) &&
(INVALID_EDGE_WEIGHT == new_total_distance_to_reverse))
{
raw_route_data.shortest_path_length = INVALID_EDGE_WEIGHT;
raw_route_data.alternative_path_length = INVALID_EDGE_WEIGHT;
return;
}
// we need to figure out how the new legs connect to the previous ones
if (current_leg > 0)
{
bool forward_to_forward =
(new_total_distance_to_forward != INVALID_EDGE_WEIGHT) &&
packed_leg_to_forward.front() == source_phantom.forward_node_id;
bool reverse_to_forward =
(new_total_distance_to_forward != INVALID_EDGE_WEIGHT) &&
packed_leg_to_forward.front() == source_phantom.reverse_node_id;
bool forward_to_reverse =
(new_total_distance_to_reverse != INVALID_EDGE_WEIGHT) &&
packed_leg_to_reverse.front() == source_phantom.forward_node_id;
bool reverse_to_reverse =
(new_total_distance_to_reverse != INVALID_EDGE_WEIGHT) &&
packed_leg_to_reverse.front() == source_phantom.reverse_node_id;
BOOST_ASSERT(!forward_to_forward || !reverse_to_forward);
BOOST_ASSERT(!forward_to_reverse || !reverse_to_reverse);
// in this case we always need to copy
if (forward_to_forward && forward_to_reverse)
{
// in this case we copy the path leading to the source forward node
// and change the case
total_packed_path_to_reverse = total_packed_path_to_forward;
packed_leg_to_reverse_begin = packed_leg_to_forward_begin;
forward_to_reverse = false;
reverse_to_reverse = true;
}
else if (reverse_to_forward && reverse_to_reverse)
{
total_packed_path_to_forward = total_packed_path_to_reverse;
packed_leg_to_forward_begin = packed_leg_to_reverse_begin;
reverse_to_forward = false;
forward_to_forward = true;
}
BOOST_ASSERT(!forward_to_forward || !forward_to_reverse);
BOOST_ASSERT(!reverse_to_forward || !reverse_to_reverse);
// in this case we just need to swap to regain the correct mapping
if (reverse_to_forward || forward_to_reverse)
{
total_packed_path_to_forward.swap(total_packed_path_to_reverse);
packed_leg_to_forward_begin.swap(packed_leg_to_reverse_begin);
}
}
if (new_total_distance_to_forward != INVALID_EDGE_WEIGHT)
{
BOOST_ASSERT(target_phantom.forward_node_id != SPECIAL_NODEID);
packed_leg_to_forward_begin.push_back(total_packed_path_to_forward.size());
total_packed_path_to_forward.insert(total_packed_path_to_forward.end(),
packed_leg_to_forward.begin(),
packed_leg_to_forward.end());
search_from_forward_node = true;
}
else
{
total_packed_path_to_forward.clear();
packed_leg_to_forward_begin.clear();
search_from_forward_node = false;
}
if (new_total_distance_to_reverse != INVALID_EDGE_WEIGHT)
{
BOOST_ASSERT(target_phantom.reverse_node_id != SPECIAL_NODEID);
packed_leg_to_reverse_begin.push_back(total_packed_path_to_reverse.size());
total_packed_path_to_reverse.insert(total_packed_path_to_reverse.end(),
packed_leg_to_reverse.begin(),
packed_leg_to_reverse.end());
search_from_reverse_node = true;
}
else
{
total_packed_path_to_reverse.clear();
packed_leg_to_reverse_begin.clear();
search_from_reverse_node = false;
}
prev_packed_leg_to_forward = std::move(packed_leg_to_forward);
prev_packed_leg_to_reverse = std::move(packed_leg_to_reverse);
total_distance_to_forward = new_total_distance_to_forward;
total_distance_to_reverse = new_total_distance_to_reverse;
++current_leg;
}
BOOST_ASSERT(total_distance_to_forward != INVALID_EDGE_WEIGHT ||
total_distance_to_reverse != INVALID_EDGE_WEIGHT);
// We make sure the fastest route is always in packed_legs_to_forward
if (total_distance_to_forward > total_distance_to_reverse)
{
// insert sentinel
packed_leg_to_reverse_begin.push_back(total_packed_path_to_reverse.size());
BOOST_ASSERT(packed_leg_to_reverse_begin.size() == phantom_nodes_vector.size() + 1);
UnpackLegs(phantom_nodes_vector, total_packed_path_to_reverse,
packed_leg_to_reverse_begin, total_distance_to_reverse, raw_route_data);
}
else
{
// insert sentinel
packed_leg_to_forward_begin.push_back(total_packed_path_to_forward.size());
BOOST_ASSERT(packed_leg_to_forward_begin.size() == phantom_nodes_vector.size() + 1);
UnpackLegs(phantom_nodes_vector, total_packed_path_to_forward,
packed_leg_to_forward_begin, total_distance_to_forward, raw_route_data);
}
}
};
#endif /* SHORTEST_PATH_HPP */
| 47.270019
| 122
| 0.612315
|
aaronbenz
|
e74563771f853c4874b8543f4ba8f99ba76c31cf
| 398
|
cpp
|
C++
|
src/img-processing/utils/matrix-ops.cpp
|
mdziekon/eiti-pobr-logo-recognition
|
02a20b2a8427249ac318f1865fa824ad1f28b46c
|
[
"MIT"
] | 1
|
2022-01-22T10:30:56.000Z
|
2022-01-22T10:30:56.000Z
|
src/img-processing/utils/matrix-ops.cpp
|
mdziekon/eiti-pobr-logo-recognition
|
02a20b2a8427249ac318f1865fa824ad1f28b46c
|
[
"MIT"
] | null | null | null |
src/img-processing/utils/matrix-ops.cpp
|
mdziekon/eiti-pobr-logo-recognition
|
02a20b2a8427249ac318f1865fa824ad1f28b46c
|
[
"MIT"
] | null | null | null |
#include "./matrix-ops.hpp"
namespace matrixOps = pobr::imgProcessing::utils::matrixOps;
const cv::Mat&
matrixOps::forEachPixel(
const cv::Mat& img,
const std::function<void(const uint64_t& x, const uint64_t& y)>& operation
)
{
for (uint64_t x = 0; x < img.cols; x++) {
for (uint64_t y = 0; y < img.rows; y++) {
operation(x, y);
}
}
return img;
}
| 20.947368
| 78
| 0.585427
|
mdziekon
|
e74850526a8d4da267370724dccabf5e807bce8a
| 4,849
|
cpp
|
C++
|
EXAMPLES/WebSnap/PhotoGallery/uploadpicturespg.cpp
|
earthsiege2/borland-cpp-ide
|
09bcecc811841444338e81b9c9930c0e686f9530
|
[
"Unlicense",
"FSFAP",
"Apache-1.1"
] | 1
|
2022-01-13T01:03:55.000Z
|
2022-01-13T01:03:55.000Z
|
EXAMPLES/WebSnap/PhotoGallery/uploadpicturespg.cpp
|
earthsiege2/borland-cpp-ide
|
09bcecc811841444338e81b9c9930c0e686f9530
|
[
"Unlicense",
"FSFAP",
"Apache-1.1"
] | null | null | null |
EXAMPLES/WebSnap/PhotoGallery/uploadpicturespg.cpp
|
earthsiege2/borland-cpp-ide
|
09bcecc811841444338e81b9c9930c0e686f9530
|
[
"Unlicense",
"FSFAP",
"Apache-1.1"
] | null | null | null |
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UploadPicturesPg.h"
#include "PhotoDataPg.h"
#include <WebInit.h>
#include <WebReq.hpp>
#include <WebCntxt.hpp>
#include <WebFact.hpp>
#include <Jpeg.hpp>
#include <IBQuery.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
USEADDITIONALFILES("*.html");
const char* rNoFilesUploaded = "No files uploaded - please select a file.";
const char* rRequiredImage = "Unsupported image. The supported image type is only jpeg.";
const char* rNoUploadFileFound = "No Upload File found! Did you select a file?";
const char* rUploadPageTitle = "Upload Pictures";
const char* rNoTitle = "(Untitled)";
const char* rNotLoggedIn = "Please login!";
TUploadPicturesPage *UploadPicturesPage()
{
return (TUploadPicturesPage*)WebContext()->FindModuleClass(__classid (TUploadPicturesPage));
}
static TWebPageAccess PageAccess;
static TWebPageInit WebInit(__classid(TUploadPicturesPage),
crOnDemand, caCache,
PageAccess << wpPublished << wpLoginRequired, ".html", "",
"Upload Pictures", "",
// Limit upload access to only user's and admin's
AnsiString(sUserRightStrings[urAdmin]) + ";" + AnsiString(sUserRightStrings[urUser]));
void __fastcall TUploadPicturesPage::UploadFileUploadFiles(TObject *Sender,
TUpdateFileList *Files)
{
try
{
TIBQuery *qryAddImage = PhotoData()->qryAddImage;
// the current user id is stored in the sessino
AnsiString sUserId = Session->Values[cUserId];
int nUserId = StrToInt(sUserId);
for (int i = 0; i < Files->Count; i++)
{
TDBImageType ImageType = itJpeg;
// Make sure that the file is jpeg content type
if (SameText(Files->Files[i]->ContentType, "image/jpeg") ||
SameText(Files->Files[i]->ContentType, "image/pjpeg"))
{
// Try to get the image width and height. An exception will be
// raised if it is an invalid image.
TJPEGImage *Jpeg = new TJPEGImage;
__try
{
Jpeg->LoadFromStream(Files->Files[i]->Stream);
qryAddImage->ParamByName(cImgWidth)->AsInteger =
Jpeg->Width;
qryAddImage->ParamByName(cImgHeight)->AsInteger =
Jpeg->Height;
}
__finally {
delete Jpeg;
}
Files->Files[i]->Stream->Position = 0;
// Save the file in the database
qryAddImage->ParamByName(cImgData)->SetBlobData(
((TMemoryStream*)Files->Files[i]->Stream)->Memory,
Files->Files[i]->Stream->Size);
qryAddImage->ParamByName(cImgSize)->AsInteger =
Files->Files[i]->Stream->Size;
}
/* TODO : You can add support for other image types here */
else
throw Exception(rRequiredImage);
// Fill in things common to all image types
qryAddImage->ParamByName(cImgType)->AsInteger = ImageType;
qryAddImage->ParamByName(cUserId)->AsInteger = nUserId;
if (Title->ActionValue)
qryAddImage->ParamByName(cImgTitle)->AsString = Title->ActionValue->Values[0];
else
qryAddImage->ParamByName(cImgTitle)->AsString = rNoTitle;
if (Description->ActionValue)
qryAddImage->ParamByName(cImgDescription)->AsString =
Description->ActionValue->Values[0];
else
qryAddImage->ParamByName(cImgDescription)->AsString = "";
if (Category->ActionValue)
qryAddImage->ParamByName(cCatId)->AsString = Category->ActionValue->Values[0];
qryAddImage->ExecSQL();
UploadedFiles->Strings->Values[ExtractFileName(Files->Files[i]->FileName)]
= IntToStr(Files->Files[i]->Stream->Size);
} // for loop
} // try
catch (Exception &e) {
UploadAdapter->Errors->AddError(&e, "");
}
}
//---------------------------------------------------------------------------
void __fastcall TUploadPicturesPage::UploadAdapterBeforeExecuteAction(
TObject *Sender, TObject *Action, TStrings *Params, bool &Handled)
{
if (Request->Files->Count <= 0)
UploadAdapter->Errors->AddError(rNoFilesUploaded);
}
//---------------------------------------------------------------------------
void __fastcall TUploadPicturesPage::UploadExecute(TObject *Sender,
TStrings *Params)
{
UploadAdapter->UpdateRecords(); // Causes the fields to be updated, and files to be accepted
}
//---------------------------------------------------------------------------
void __fastcall TUploadPicturesPage::WebPageModuleActivate(TObject *Sender)
{
UploadedFiles->Strings->Clear();
}
//---------------------------------------------------------------------------
| 35.918519
| 95
| 0.593524
|
earthsiege2
|
e749d1b3f9bfa835077078b06a42e982f9da4f6f
| 28,347
|
cpp
|
C++
|
main/gamewindow.cpp
|
jerrykeung666/20-21-zju-OOP-Project
|
22b9ee7fcdde969b676d4ffd48fcc71dfeb93fa5
|
[
"MIT"
] | 1
|
2021-09-16T05:17:52.000Z
|
2021-09-16T05:17:52.000Z
|
main/gamewindow.cpp
|
jerrykeung666/20-21-zju-OOP-Project
|
22b9ee7fcdde969b676d4ffd48fcc71dfeb93fa5
|
[
"MIT"
] | null | null | null |
main/gamewindow.cpp
|
jerrykeung666/20-21-zju-OOP-Project
|
22b9ee7fcdde969b676d4ffd48fcc71dfeb93fa5
|
[
"MIT"
] | null | null | null |
#include "gamewindow.h"
#include "cardgroups.h"
#include <algorithm>
#include <QPainter>
#include <QDebug>
#include <QPalette>
#include <QMessageBox>
const QSize GameWindow::gameWindowSize = QSize(1200, 800);
const int GameWindow::cardWidthSpace = 35;
const int GameWindow::cardHeightSpace = 20; //TODO
const int GameWindow::cardRemSpace = 180; //TODO
const int GameWindow::myCardWidthStartPos = 600; //TODO
const int GameWindow::myCardHeightStartPos = 650; //TODO
const int GameWindow::leftCardWidthStartPos = 10; //TODO
const int GameWindow::leftCardHeightStartPos = 100; //TODO
const int GameWindow::rightCardWidthStartPos = 1075; //TODO
const int GameWindow::rightCardHeightStartPos = 100; //TODO
const int GameWindow::remCardWidthStartPos = 350;//TODO
const int GameWindow::remCardHeightStartPos = 20;//TODO
const int GameWindow::betBtnWidthStartPos = 320; //TODO
const int GameWindow::betBtnHeightStartPos = 575; //TODO
const int GameWindow::betBtnWidthSpace = 140; //TODO
const int GameWindow::fontSize = 20;
const QPoint GameWindow::myBetInfoPos = QPoint(500, 375);
const QPoint GameWindow::leftPlayerBetInfoPos = QPoint(135, 50);
const QPoint GameWindow::rightPlayerBetInfoPos = QPoint(975, 50);
const int GameWindow::cardSelectedShift = 35;
const QPoint GameWindow::passBtnStartPos = QPoint(350, 575);
const QPoint GameWindow::playBtnStartPos = QPoint(700, 575);
const QPoint GameWindow::myCardZone = QPoint(600, 480);
const int GameWindow::myCardZoneWidthSpace = 40;
const QPoint GameWindow::rightCardZone = QPoint(925, 150);
const int GameWindow::rightCardZoneHeightSpace = 40;
const QPoint GameWindow::leftCardZone = QPoint(130, 150);
const int GameWindow::leftCardZoneHeightSpace = 40;
const QPoint GameWindow::myStatusPos = QPoint(925, 500);
const QPoint GameWindow::rightStatusPos = QPoint(925, 50);
const QPoint GameWindow::leftStatusPos = QPoint(130, 50);
const QPoint GameWindow::myLandLordPos = QPoint(50, 500);
GameWindow::GameWindow(QWidget *parent) : QMainWindow(parent)
{
setFixedSize(gameWindowSize);
setWindowTitle("Landlord: Welcome!");
setWindowIcon(QIcon("../picture/icon.jfif"));
gameControl = new GameControl(this);
gameControl->init();
cardSize = QSize(80, 105);
initCardWidgetMap();
initButtons();
initPlayerContext();
initInfoLabel();
initSignalsAndSlots();
qDebug() << "初始化牌";
}
void GameWindow::init(){
gameControl->initCards();
initLandLordCards();
}
void GameWindow::insertCardWidget(const Card &card, QString &path)
{
CardWidget *cardWidget = new CardWidget(this);
QPixmap pix = QPixmap(path);
cardWidget->hide();
cardWidget->setCard(card);
cardWidget->setPix(pix);
cardWidgetMap.insert(card, cardWidget);
connect(cardWidget, &CardWidget::notifySelected, this, &GameWindow::cardSelected);
}
void GameWindow::addLandLordCard(const Card &card)
{
CardWidget *cw = cardWidgetMap[card];
CardWidget *cardWidget = new CardWidget(this);
QPixmap pix = QPixmap(cw->getPix());
cardWidget->hide();
cardWidget->setCard(card);
cardWidget->setPix(pix);
restThreeCards.push_back(cardWidget);
}
void GameWindow::initCardWidgetMap()
{
QString prefix = ":/PokerImage/";
QString suitMap[] = {"poker_t_1_v_", "poker_t_2_v_", "poker_t_3_v_", "poker_t_4_v_"};
for (int st = Suit_Begin + 1; st < Suit_End; ++st) {
for (int pt = Card_Begin + 1; pt < Card_SJ; ++pt) {
Card card((CardPoint)pt, (CardSuit)st);
QString cardPath;
if(pt == 13)
cardPath = prefix + suitMap[st-1] + QString::number(1) + ".png";
else
cardPath = prefix + suitMap[st-1] + QString::number((pt+1)%14) + ".png";
insertCardWidget(card, cardPath);
}
}
Card card;
QString cardPath;
cardPath = prefix + "smalljoker.png";
card.point = Card_SJ;
insertCardWidget(card, cardPath);
card.point = Card_BJ;
cardPath = prefix + "bigjoker.png";
insertCardWidget(card, cardPath);
}
void GameWindow::initInfoLabel(){
QPalette palette = this->palette();
palette.setColor(QPalette::WindowText, Qt::red);
QFont font("Microsoft YaHei", fontSize, QFont::Bold);
myBetInfo = new QLabel();
myBetInfo->setParent(this);
myBetInfo->setPalette(palette);
myBetInfo->setFont(font);
myBetInfo->raise();
myBetInfo->move(myBetInfoPos);
myBetInfo->hide();
rightBetInfo = new QLabel();
rightBetInfo->setParent(this);
rightBetInfo->setPalette(palette);
rightBetInfo->setFont(font);
rightBetInfo->raise();
rightBetInfo->move(rightPlayerBetInfoPos);
rightBetInfo->hide();
leftBetInfo = new QLabel();
leftBetInfo->setParent(this);
leftBetInfo->setPalette(palette);
leftBetInfo->setFont(font);
leftBetInfo->raise();
leftBetInfo->move(leftPlayerBetInfoPos);
leftBetInfo->hide();
passInfo = new QLabel();
passInfo->setParent(this);
passInfo->setPalette(palette);
passInfo->setFont(font);
passInfo->raise();
passInfo->move(myBetInfoPos);
passInfo->hide();
playInfo = new QLabel();
playInfo->setParent(this);
playInfo->setPalette(palette);
playInfo->setFont(font);
playInfo->raise();
playInfo->move(myBetInfoPos);
playInfo->hide();
leftPassInfo = new QLabel();
leftPassInfo->setParent(this);
leftPassInfo->setPalette(palette);
leftPassInfo->setFont(font);
leftPassInfo->raise();
leftPassInfo->move(leftPlayerBetInfoPos);
leftPassInfo->hide();
rightPassInfo = new QLabel();
rightPassInfo->setParent(this);
rightPassInfo->setPalette(palette);
rightPassInfo->setFont(font);
rightPassInfo->raise();
rightPassInfo->move(rightPlayerBetInfoPos);
rightPassInfo->hide();
myStatusInfo = new QLabel();
myStatusInfo->setParent(this);
myStatusInfo->setPalette(palette);
myStatusInfo->setFont(font);
myStatusInfo->raise();
myStatusInfo->move(myStatusPos);
myStatusInfo->hide();
leftStatusInfo = new QLabel();
leftStatusInfo->setParent(this);
leftStatusInfo->setPalette(palette);
leftStatusInfo->setFont(font);
leftStatusInfo->raise();
leftStatusInfo->move(leftStatusPos);
leftStatusInfo->hide();
rightStatusInfo = new QLabel();
rightStatusInfo->setParent(this);
rightStatusInfo->setPalette(palette);
rightStatusInfo->setFont(font);
rightStatusInfo->raise();
rightStatusInfo->move(rightStatusPos);
rightStatusInfo->hide();
QFont font2("Microsoft YaHei", 10, QFont::Bold);
myLandLordInfo = new QLabel();
myLandLordInfo->setParent(this);
myLandLordInfo->setPalette(palette);
myLandLordInfo->setFont(font2);
myLandLordInfo->lower();
myLandLordInfo->move(myLandLordPos);
myLandLordInfo->setText("LandLord:\n everyone");
myLandLordInfo->show();
}
void GameWindow::initButtons()
{
startBtn = new MyPushButton("../picture/game_start.png", "开始游戏");
startBtn->setParent(this);
startBtn->move(this->width()*0.5-startBtn->width()*0.5, this->height()*0.5);
betNoBtn = new MyPushButton("../picture/No.png", "No!");
bet1Btn = new MyPushButton("../picture/OnePoint.png", "1 Point!");
bet2Btn = new MyPushButton("../picture/TwoPoints.png", "2 Points!");
bet3Btn = new MyPushButton("../picture/ThreePoints.png", "3 Points!");
betNoBtn->setParent(this);
bet1Btn->setParent(this);
bet2Btn->setParent(this);
bet3Btn->setParent(this);
betNoBtn->move(betBtnWidthStartPos, betBtnHeightStartPos);
bet1Btn->move(betBtnWidthStartPos + betBtnWidthSpace, betBtnHeightStartPos);
bet2Btn->move(betBtnWidthStartPos + 2*betBtnWidthSpace, betBtnHeightStartPos);
bet3Btn->move(betBtnWidthStartPos + 3*betBtnWidthSpace, betBtnHeightStartPos);
betNoBtn->hide();
bet1Btn->hide();
bet2Btn->hide();
bet3Btn->hide();
passBtn = new MyPushButton("../picture/Pass.png", "Pass!");
playBtn = new MyPushButton("../picture/Play.png", "Play!");
passBtn->setParent(this);
playBtn->setParent(this);
passBtn->move(passBtnStartPos);
playBtn->move(playBtnStartPos);
passBtn->hide();
playBtn->hide();
}
void GameWindow::initPlayerContext()
{
PlayerContext context;
context.cardsAlign = Vertical;
context.isFrontSide = false;
playerContextMap.insert(gameControl->getPlayerC(), context);
context.cardsAlign = Vertical;
context.isFrontSide = false;
playerContextMap.insert(gameControl->getPlayerB(), context);
context.cardsAlign = Horizontal;
context.isFrontSide = true;
playerContextMap.insert(gameControl->getPlayerA(), context);
for (auto &pcm : playerContextMap)
{
pcm.info = new QLabel(this);
pcm.info->resize(100, 50);
pcm.info->setObjectName("info");
pcm.info->hide();
pcm.rolePic = new QLabel(this);
pcm.rolePic->resize(84, 120);
pcm.rolePic->hide();
}
}
void GameWindow::initLandLordCards()
{
QVector<Card> cards = gameControl->getLandLordCards();
for (auto &card : cards) {
addLandLordCard(card);
}
}
void GameWindow::initSignalsAndSlots(){
connect(startBtn, &MyPushButton::clicked, this, &GameWindow::onStartBtnClicked);
connect(betNoBtn, &MyPushButton::clicked, this, &GameWindow::onBetNoBtnClicked);
connect(bet1Btn, &MyPushButton::clicked, this, &GameWindow::onBet1BtnClicked);
connect(bet2Btn, &MyPushButton::clicked, this, &GameWindow::onBet2BtnClicked);
connect(bet3Btn, &MyPushButton::clicked, this, &GameWindow::onBet3BtnClicked);
connect(passBtn, &MyPushButton::clicked, this, &GameWindow::passCards);
connect(playBtn, &MyPushButton::clicked, this, &GameWindow::playCards);
//
connect(gameControl, &GameControl::callGamewindowShowBets, this, &GameWindow::onBetPointsCall);
connect(gameControl, &GameControl::callGamewindowShowLandlord, this, [=](){
if (gameControl->getgamemodel() == 1){
if (gameControl->getPlayerA()->getIsLandLord()){
myLandLordInfo->setText("LandLord:\n me");
}else if (gameControl->getPlayerB()->getIsLandLord()){
myLandLordInfo->setText("LandLord:\n right");
}else{
myLandLordInfo->setText("LandLord:\n left");
}
myLandLordInfo->show();
}
showRemLandLordCard("show");
});
connect(gameControl, &GameControl::NotifyPlayerPlayHand, this, &GameWindow::otherPlayerShowCards);
connect(gameControl, &GameControl::NotifyPlayerbutton, this, &GameWindow::myPlayerShowButton);
connect(gameControl, &GameControl::NotifyPlayerStatus, this, &GameWindow::showEndStatus);
}
void GameWindow::onStartBtnClicked()
{
startBtn->hide();
showLandLordCard();
if (gameControl->getgamemodel() == 1){
call4Landlord();
}
else{
startGame();
}
qDebug() << "开始游戏";
}
void GameWindow::showLandLordCard(){
// gameControl->getPlayerA();
if(gameControl->getPlayerA()->getIsPerson()){
showMyCard(gameControl->getPlayerA());
showOtherPlayerCard(gameControl->getPlayerB(), "right");
showOtherPlayerCard(gameControl->getPlayerC(), "left");
}
else if(gameControl->getPlayerB()->getIsPerson()){
showMyCard(gameControl->getPlayerB());
showOtherPlayerCard(gameControl->getPlayerC(), "right");
showOtherPlayerCard(gameControl->getPlayerA(), "left");
}
else if(gameControl->getPlayerC()->getIsPerson()){
showMyCard(gameControl->getPlayerC());
showOtherPlayerCard(gameControl->getPlayerA(), "right");
showOtherPlayerCard(gameControl->getPlayerB(), "left");
}
showRemLandLordCard("hidden");
}
void GameWindow::showOtherPlayerCard(Player* otherPlayer, const QString status){
QVector<Card> myCards;
QVector<CardWidget*> myWidget;
myCards = otherPlayer->getHandCards();
for (int i=0; i < myCards.size(); i++) {
myWidget.push_back(cardWidgetMap[myCards.at(i)]);
myWidget.at(i)->raise();
if(status == "left"){
myWidget.at(i)->setFront(false);
myWidget.at(i)->move(leftCardWidthStartPos, leftCardHeightStartPos + i*cardHeightSpace);
}
else{
myWidget.at(i)->setFront(false);
myWidget.at(i)->move(rightCardWidthStartPos, rightCardHeightStartPos + i*cardHeightSpace);
}
myWidget.at(i)->show();
//qDebug() << myWidget.at(i)->getIsFront();
//qDebug() << myWidget.size();
}
}
void GameWindow::showMyCard(Player* myPlayer){
QVector<Card> myCards;
QVector<CardWidget*> myWidget;
myCards = myPlayer->getHandCards();
int len = myCards.size();
for (int i=0; i < len; i++) {
myWidget.push_back(cardWidgetMap[myCards.at(i)]);
myWidget.at(i)->setOwner(myPlayer);
myWidget.at(i)->raise();
myWidget.at(i)->move(myCardWidthStartPos + (i-len/2-1)*cardWidthSpace, myCardHeightStartPos);
myWidget.at(i)->show();
}
}
void GameWindow::showRemLandLordCard(QString status){
for (int i=0; i < restThreeCards.size(); i++) {
restThreeCards.at(i)->raise();
if (status == "hidden")
restThreeCards.at(i)->setFront(false);
else{
restThreeCards.at(i)->setFront(true);
if(gameControl->getPlayerA()->getIsLandLord())
showMyCard(gameControl->getPlayerA());
else if(gameControl->getPlayerB()->getIsLandLord())
showOtherPlayerCard(gameControl->getPlayerB(), "right");
else if(gameControl->getPlayerC()->getIsLandLord())
showOtherPlayerCard(gameControl->getPlayerC(), "left");
}
restThreeCards.at(i)->move(remCardWidthStartPos + i*cardRemSpace, remCardHeightStartPos);
restThreeCards.at(i)->show();
}
if (status == "show"){
QTimer::singleShot(1200, this, [=](){
myBetInfo->hide();
rightBetInfo->hide();
leftBetInfo->hide();
startGame();
});
}
}
void GameWindow::call4Landlord(){
betNoBtn->show();
bet1Btn->show();
bet2Btn->show();
bet3Btn->show();
}
void GameWindow::startGame(){//TODO
//qDebug() << (gameControl->getCurrentPlayer() == gameControl->getPlayerA());
//if(gameControl->getCurrentPlayer() == gameControl->getPlayerA()){
passBtn->show();
playBtn->show();
//}
}
void GameWindow::onBetNoBtnClicked(){
qDebug() << "my no bet";
if(gameControl->getPlayerA()->getIsPerson()){
gameControl->getPlayerA()->setBetPoints(0);
}
else if(gameControl->getPlayerB()->getIsPerson()){
gameControl->getPlayerB()->setBetPoints(0);
}
else if(gameControl->getPlayerC()->getIsPerson()){
gameControl->getPlayerC()->setBetPoints(0);
}
QTimer::singleShot(10, this, [=](){
betNoBtn->hide();
bet1Btn->hide();
bet2Btn->hide();
bet3Btn->hide();
gameControl->updateBetPoints(0);
});
qDebug() << "No bet!";
}
void GameWindow::onBet1BtnClicked(){
if(gameControl->getPlayerA()->getIsPerson()){
gameControl->getPlayerA()->setBetPoints(1);
}
else if(gameControl->getPlayerB()->getIsPerson()){
gameControl->getPlayerB()->setBetPoints(1);
}
else if(gameControl->getPlayerC()->getIsPerson()){
gameControl->getPlayerC()->setBetPoints(1);
}
QTimer::singleShot(10, this, [=](){
betNoBtn->hide();
bet1Btn->hide();
bet2Btn->hide();
bet3Btn->hide();
gameControl->updateBetPoints(1);
});
qDebug() << "1 Point!";
}
void GameWindow::onBet2BtnClicked(){
if(gameControl->getPlayerA()->getIsPerson()){
gameControl->getPlayerA()->setBetPoints(2);
}
else if(gameControl->getPlayerB()->getIsPerson()){
gameControl->getPlayerB()->setBetPoints(2);
}
else if(gameControl->getPlayerC()->getIsPerson()){
gameControl->getPlayerC()->setBetPoints(2);
}
QTimer::singleShot(10, this, [=](){
betNoBtn->hide();
bet1Btn->hide();
bet2Btn->hide();
bet3Btn->hide();
gameControl->updateBetPoints(2);
});
qDebug() << "2 Points!";
}
void GameWindow::onBet3BtnClicked(){
if(gameControl->getPlayerA()->getIsPerson()){
gameControl->getPlayerA()->setBetPoints(3);
}
else if(gameControl->getPlayerB()->getIsPerson()){
gameControl->getPlayerB()->setBetPoints(3);
}
else if(gameControl->getPlayerC()->getIsPerson()){
gameControl->getPlayerC()->setBetPoints(3);
}
QTimer::singleShot(10, this, [=](){
betNoBtn->hide();
bet1Btn->hide();
bet2Btn->hide();
bet3Btn->hide();
gameControl->updateBetPoints(3);
});
qDebug() << "3 Points!";
}
void GameWindow::cardSelected(Qt::MouseButton mouseButton){
CardWidget* cardWidget = (CardWidget*)sender();
Player* player = cardWidget->getOwner();
if(mouseButton == Qt::LeftButton){
cardWidget->setIsSelected(!cardWidget->getIsSelected()); // switch statu
if(player == gameControl->getPlayerA())
showMySelectedCard(player);
// int i;
// for(i=0; i < player->getSelectCards().size(); i++){
// if(player->getSelectCards().at(i) == cardWidget->getCard())
// break;
// }
// if(i < player->getSelectCards().size())
// player->getSelectCards().remove(i);
// else if(i == player->getSelectCards().size())
// player->getSelectCards().push_back(cardWidget->getCard());
}
}
void GameWindow::showMySelectedCard(Player* player){//TODO
CardWidget* selectedWidget;
for(int i=0; i < player->getHandCards().size(); i++){
selectedWidget = cardWidgetMap[player->getHandCards().at(i)];
if(selectedWidget->getIsSelected())
selectedWidget->move(selectedWidget->x(), myCardHeightStartPos - cardSelectedShift);
else
selectedWidget->move(selectedWidget->x(), myCardHeightStartPos);
}
}
void GameWindow::onBetPointsCall(Player* player){
if(player->getIsPerson()){
int betPoints = player->getBetPoints();
if (betPoints == 0)
myBetInfo->setText("No!");
else if(betPoints == 1)
myBetInfo->setText("1 Point!");
else
myBetInfo->setText(QString::number(betPoints) + " Points!");
myBetInfo->show();
}
else{
if(gameControl->getPlayerB() == player){
int betPoints = player->getBetPoints();
if (betPoints == 0)
rightBetInfo->setText("No!");
else if(betPoints == 1)
rightBetInfo->setText("1 Point!");
else
rightBetInfo->setText(QString::number(betPoints) + " Points!");
rightBetInfo->show();
}
else{
int betPoints = player->getBetPoints();
if (betPoints == 0)
leftBetInfo->setText("No!");
else if(betPoints == 1)
leftBetInfo->setText("1 Point!");
else
leftBetInfo->setText(QString::number(betPoints) + " Points!");
leftBetInfo->show();
}
}
qDebug() << "betInfo";
}
void GameWindow::playCards(){
QVector<Card> selectedCards;
QVector<Card> handCards;
QVector<int> idx;
CardWidget* cardWidget;
handCards = gameControl->getCurrentPlayer()->getHandCards();
qDebug() << handCards.size();
for(int i=0; i < handCards.size(); i++){
cardWidget = cardWidgetMap[handCards.at(i)];
if(cardWidget->getIsSelected()){
selectedCards.push_back(handCards.at(i));
idx.push_back(i);
}
}
for(int i=0; i < idx.size(); i++){
handCards.remove(idx.at(i) - i);
}
gameControl->getCurrentPlayer()->resetSelectCards(selectedCards);
//playerA->selectedCard()->checkali(gmctl->punchcard)
// wait bool: successful -> animation, failed -> error msgbox/qlabel
// slots: robot display
CardGroups cg = CardGroups(selectedCards);
qDebug() << gameControl->getCurrentCombo().getCards().size();
if(gameControl->getCurrentPlayer()->getSelectCards().canBeat(gameControl->getCurrentCombo())
|| gameControl->getCurrentPlayer() == gameControl->getEffectivePlayer()){ //pending: canBeat! You win in the last cycle!
qDebug() << gameControl->getCurrentCombo().getCards().size();
gameControl->getCurrentPlayer()->resetHandCards(handCards);
showPlayCard();
gameControl->onPlayerHand(gameControl->getCurrentPlayer(), cg);
}
else{
selectedCards.clear();
gameControl->getCurrentPlayer()->resetSelectCards(selectedCards);
playInfo->setText("Combo Invalid!");
playInfo->show();
showPlayCard();
QTimer::singleShot(600, this, [=](){
playInfo->hide();
});
}
}
void GameWindow::showPlayCard(){
qDebug() << "++++++++++++++++++++++++";
qDebug() << gameControl->getPlayerA()->getHandCards().size();
if(gameControl->getCurrentPlayer() == gameControl->getPlayerA()){
// check whether is empty
if(gameControl->getPlayerA()->getSelectCards().getCards().isEmpty()){
QVector<Card> handCards;
CardWidget* cardWidget;
handCards = gameControl->getCurrentPlayer()->getHandCards();
for(int i=0; i < handCards.size(); i++){
cardWidget = cardWidgetMap[handCards.at(i)];
cardWidget->setIsSelected(false);
}
showMyCard(gameControl->getPlayerA());
return;
}
else
showMyCard(gameControl->getPlayerA());
}
else if(gameControl->getCurrentPlayer() == gameControl->getPlayerB())
showOtherPlayerCard(gameControl->getCurrentPlayer(), "right");
else
showOtherPlayerCard(gameControl->getCurrentPlayer(), "left");
// show selected cards
Card selectCard;
CardWidget* cardWidget;
int len = gameControl->getCurrentPlayer()->getSelectCards().getCards().size();
for(int i=0; i < len; i++){
selectCard = gameControl->getCurrentPlayer()->getSelectCards().getCards().at(i);
cardWidget = cardWidgetMap[selectCard];
cardWidget->raise();
cardWidget->move(myCardZone.x() + (i-len/2-1)*myCardZoneWidthSpace, myCardZone.y());
cardWidget->show();
}
passBtn->hide();
playBtn->hide();
}
void GameWindow::passCards(){
QVector<Card> handCards;
CardWidget* cardWidget;
handCards = gameControl->getCurrentPlayer()->getHandCards();
for(int i=0; i < handCards.size(); i++){
cardWidget = cardWidgetMap[handCards.at(i)];
cardWidget->setIsSelected(false);
}
if(gameControl->getCurrentPlayer() == gameControl->getPlayerA())
showMyCard(gameControl->getPlayerA());
else if(gameControl->getCurrentPlayer() == gameControl->getPlayerB())
showOtherPlayerCard(gameControl->getCurrentPlayer(), "right");
else
showOtherPlayerCard(gameControl->getCurrentPlayer(), "left");
CardGroups cg;
gameControl->onPlayerHand(gameControl->getCurrentPlayer(),cg);
passInfo->setText("PASS!");
passInfo->show();
passBtn->hide();
playBtn->hide();
// QTimer::singleShot(600, this, [=](){
// passInfo->hide();
// });
}
void GameWindow::otherPlayerShowCards(Player* player, CardGroups cards){
if(player == gameControl->getPlayerB()){
showOtherPlayerCard(player, "right");
showOtherPlayerPlayCard(player, cards, "right");
}
else if(player == gameControl->getPlayerC()){
showOtherPlayerCard(player, "left");
showOtherPlayerPlayCard(player, cards, "left");
}
}
void GameWindow::showOtherPlayerPlayCard(Player* otherPlayer, CardGroups cards, const QString status){
//qDebug() << "666";
if(status == "right"){
if(cards.getCards().size() == 0){
rightPassInfo->setText("Pass!");
rightPassInfo->show();
}
else{
Card card;
CardWidget* cardWidget;
for(int i=0; i < cards.getCards().size(); i++){
card = cards.getCards().at(i);
cardWidget = cardWidgetMap[card];
cardWidget->setFront(true);
cardWidget->raise();
cardWidget->move(rightCardZone.x(), rightCardZone.y() + i*rightCardZoneHeightSpace);
cardWidget->show();
}
}
}
else{
if(cards.getCards().size() == 0){
leftPassInfo->setText("Pass!");
leftPassInfo->show();
}
else{
Card card;
CardWidget* cardWidget;
for(int i=0; i < cards.getCards().size(); i++){
card = cards.getCards().at(i);
cardWidget = cardWidgetMap[card];
cardWidget->setFront(true);
cardWidget->raise();
cardWidget->move(leftCardZone.x(), leftCardZone.y() + i*leftCardZoneHeightSpace);
cardWidget->show();
}
}
}
}
void GameWindow::myPlayerShowButton(Player* player){
qDebug() << "hide card";
//QTimer::singleShot(1000, this, [=](){
if(player == gameControl->getPlayerA()){
if (gameControl->getEffectivePlayer() != player)
passBtn->show();
playBtn->show();
}
CardGroups cardGroup = player->lastCards; //pending
if(cardGroup.getCards().size() == 0){
if(player == gameControl->getPlayerB())
rightPassInfo->hide();
else if(player == gameControl->getPlayerC()){
leftPassInfo->hide();
}
else{
passInfo->hide();
}
}
else{
Card card;
CardWidget* cardWidget;
for(int i=0; i < cardGroup.getCards().size(); i++){
card = cardGroup.getCards().at(i);
cardWidget = cardWidgetMap[card];
cardWidget->hide();
}
}
//});
}
void GameWindow::showEndStatus(Player* player){
playInfo->hide();
leftPassInfo->hide();
rightPassInfo->hide();
myStatusInfo->setText("Lose!");
leftStatusInfo->setText("Lose!");
rightStatusInfo->setText("Lose!");
if(player == gameControl->getPlayerA())
myStatusInfo->setText("Win!");
else if(player == gameControl->getPlayerB())
rightStatusInfo->setText("Win!");
else
leftStatusInfo->setText("Win!");
myStatusInfo->show();
leftStatusInfo->show();
rightStatusInfo->show();
QTimer::singleShot(100, this, [=](){
if(player == gameControl->getPlayerA())
QMessageBox::information(this, tr("Result"), QString("You Win!"));
else
QMessageBox::information(this, tr("Result"), QString("You Lose!"));
});
//startBtn->show();
}
void GameWindow::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QPixmap pix;
pix.load("../picture/game_scene.PNG");
painter.drawPixmap(0, 0, this->width(), this->height(), pix);
}
GameControl* GameWindow::getgameControl(){
return this->gameControl;
}
| 32.175936
| 133
| 0.606166
|
jerrykeung666
|
e74f5c452100786449b981bb7a60d8fe5217811b
| 18,918
|
cpp
|
C++
|
src/Utils/WebUtils.cpp
|
Christoffyw/beatleader-qmod
|
3a1747f0a582281f78ac4a2390349add0bfe22b6
|
[
"MIT"
] | null | null | null |
src/Utils/WebUtils.cpp
|
Christoffyw/beatleader-qmod
|
3a1747f0a582281f78ac4a2390349add0bfe22b6
|
[
"MIT"
] | null | null | null |
src/Utils/WebUtils.cpp
|
Christoffyw/beatleader-qmod
|
3a1747f0a582281f78ac4a2390349add0bfe22b6
|
[
"MIT"
] | null | null | null |
#include "main.hpp"
#include "Utils/WebUtils.hpp"
#include "libcurl/shared/curl.h"
#include "libcurl/shared/easy.h"
#include <filesystem>
#include <sstream>
#define TIMEOUT 10
#define USER_AGENT std::string(ID "/" VERSION " (BeatSaber/" + GameVersion + ") (Oculus)").c_str()
#define X_BSSB "X-BSSB: ✔"
namespace WebUtils {
std::string GameVersion = "Unknown";
//https://stackoverflow.com/a/55660581
std::string query_encode(const std::string& s)
{
std::string ret;
#define IS_BETWEEN(ch, low, high) (ch >= low && ch <= high)
#define IS_ALPHA(ch) (IS_BETWEEN(ch, 'A', 'Z') || IS_BETWEEN(ch, 'a', 'z'))
#define IS_DIGIT(ch) IS_BETWEEN(ch, '0', '9')
#define IS_HEXDIG(ch) (IS_DIGIT(ch) || IS_BETWEEN(ch, 'A', 'F') || IS_BETWEEN(ch, 'a', 'f'))
for(size_t i = 0; i < s.size();)
{
char ch = s[i++];
if (IS_ALPHA(ch) || IS_DIGIT(ch))
{
ret += ch;
}
else if ((ch == '%') && IS_HEXDIG(s[i+0]) && IS_HEXDIG(s[i+1]))
{
ret += s.substr(i-1, 3);
i += 2;
}
else
{
switch (ch)
{
case '-':
case '.':
case '_':
case '~':
case '!':
case '$':
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
case ';':
case '=':
case ':':
case '@':
case '/':
case '?':
case '[':
case ']':
ret += ch;
break;
default:
{
static const char hex[] = "0123456789ABCDEF";
char pct[] = "% ";
pct[1] = hex[(ch >> 4) & 0xF];
pct[2] = hex[ch & 0xF];
ret.append(pct, 3);
break;
}
}
}
}
return ret;
}
std::size_t CurlWrite_CallbackFunc_StdString(void *contents, std::size_t size, std::size_t nmemb, std::string *s)
{
std::size_t newLength = size * nmemb;
try {
s->append((char*)contents, newLength);
} catch(std::bad_alloc &e) {
//handle memory problem
getLogger().critical("Failed to allocate string of size: %lu", newLength);
return 0;
}
return newLength;
}
std::optional<rapidjson::Document> GetJSON(std::string url) {
std::string data;
Get(url, data);
rapidjson::Document document;
document.Parse(data);
if(document.HasParseError() || !document.IsObject())
return std::nullopt;
return document;
}
long Get(std::string url, std::string& val) {
return Get(url, TIMEOUT, val);
}
long Get(std::string url, long timeout, std::string& val) {
std::string directory = getDataDir(modInfo) + "cookies/";
std::filesystem::create_directories(directory);
std::string cookieFile = directory + "cookies.txt";
// Init curl
auto* curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: */*");
headers = curl_slist_append(headers, X_BSSB);
// Set headers
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, query_encode(url).c_str());
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookieFile.c_str());
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, cookieFile.c_str());
// Don't wait forever, time out after TIMEOUT seconds.
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
// Follow HTTP redirects if necessary.
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);
long httpCode(0);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, reinterpret_cast<void*>(&val));
curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
auto res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK) {
getLogger().critical("curl_easy_perform() failed: %u: %s", res, curl_easy_strerror(res));
}
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
return httpCode;
}
struct ProgressUpdateWrapper {
std::function<void(float)> progressUpdate;
long length;
};
void GetAsync(std::string url, std::function<void(long, std::string)> finished, std::function<void(float)> progressUpdate) {
GetAsync(url, TIMEOUT, finished, progressUpdate);
}
void GetAsync(std::string url, long timeout, std::function<void(long, std::string)> finished, std::function<void(float)> progressUpdate) {
std::thread t (
[url, timeout, progressUpdate, finished] {
std::string directory = getDataDir(modInfo) + "cookies/";
std::filesystem::create_directories(directory);
std::string cookieFile = directory + "cookies.txt";
std::string val;
// Init curl
auto* curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: */*");
headers = curl_slist_append(headers, X_BSSB);
// Set headers
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, query_encode(url).c_str());
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookieFile.c_str());
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, cookieFile.c_str());
// Don't wait forever, time out after TIMEOUT seconds.
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
// Follow HTTP redirects if necessary.
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);
ProgressUpdateWrapper* wrapper = new ProgressUpdateWrapper { progressUpdate };
if(progressUpdate) {
// Internal CURL progressmeter must be disabled if we provide our own callback
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, wrapper);
// Install the callback function
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION,
+[] (void* clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) {
float percentage = (float)dlnow / (float)dltotal * 100.0f;
if(isnan(percentage))
percentage = 0.0f;
reinterpret_cast<ProgressUpdateWrapper*>(clientp)->progressUpdate(percentage);
return 0;
}
);
}
long httpCode(0);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &val);
curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
auto res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK) {
getLogger().critical("curl_easy_perform() failed: %u: %s", res, curl_easy_strerror(res));
}
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
delete wrapper;
finished(httpCode, val);
}
);
t.detach();
}
void GetJSONAsync(std::string url, std::function<void(long, bool, rapidjson::Document&)> finished) {
GetAsync(url,
[finished] (long httpCode, std::string data) {
rapidjson::Document document;
document.Parse(data);
finished(httpCode, document.HasParseError() || !document.IsObject(), document);
}
);
}
void PostJSONAsync(std::string url, std::string data, std::function<void(long, std::string)> finished) {
PostJSONAsync(url, data, TIMEOUT, finished);
}
void PostJSONAsync(std::string url, std::string data, long timeout, std::function<void(long, std::string)> finished) {
std::thread t(
[url, timeout, data, finished] {
std::string val;
// Init curl
auto* curl = curl_easy_init();
//auto form = curl_mime_init(curl);
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Accept: */*");
headers = curl_slist_append(headers, X_BSSB);
headers = curl_slist_append(headers, "Content-Type: application/json");
// Set headers
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, query_encode(url).c_str());
// Don't wait forever, time out after TIMEOUT seconds.
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
// Follow HTTP redirects if necessary.
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);
long httpCode(0);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &val);
curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, &data);
CURLcode res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK) {
getLogger().critical("curl_easy_perform() failed: %u: %s", res, curl_easy_strerror(res));
}
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
//curl_mime_free(form);
finished(httpCode, val);
}
);
t.detach();
}
void PostFormAsync(std::string url, std::string action, std::string login, std::string password, std::function<void(long, std::string)> finished) {
std::thread t(
[url, action, login, password, finished] {
long timeout = TIMEOUT;
std::string directory = getDataDir(modInfo) + "cookies/";
std::filesystem::create_directories(directory);
std::string cookieFile = directory + "cookies.txt";
std::string val;
// Init curl
auto* curl = curl_easy_init();
//auto form = curl_mime_init(curl);
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Accept: */*");
headers = curl_slist_append(headers, X_BSSB);
headers = curl_slist_append(headers, "Content-Type: multipart/form-data");
// Set headers
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, query_encode(url).c_str());
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookieFile.c_str());
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, cookieFile.c_str());
// Don't wait forever, time out after TIMEOUT seconds.
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
// Follow HTTP redirects if necessary.
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);
struct curl_httppost *formpost=NULL;
struct curl_httppost *lastptr=NULL;
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "action",
CURLFORM_COPYCONTENTS, action.c_str(),
CURLFORM_END);
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "login",
CURLFORM_COPYCONTENTS, login.c_str(),
CURLFORM_END);
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "password",
CURLFORM_COPYCONTENTS, password.c_str(),
CURLFORM_END);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
long httpCode(0);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &val);
curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
CURLcode res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK) {
getLogger().critical("curl_easy_perform() failed: %u: %s", res, curl_easy_strerror(res));
}
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
curl_formfree(formpost);
//curl_mime_free(form);
finished(httpCode, val);
}
);
t.detach();
}
struct input {
FILE *in;
size_t bytes_read; /* count up */
CURL *hnd;
};
static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
{
struct input *i = (struct input *)userp;
size_t retcode = fread(ptr, size, nmemb, i->in);
i->bytes_read += retcode;
return retcode;
}
void PostFileAsync(std::string url, FILE* data, long length, long timeout, std::function<void(long, std::string)> finished, std::function<void(float)> progressUpdate) {
std::thread t(
[url, timeout, data, finished, length, progressUpdate] {
std::string val;
std::string directory = getDataDir(modInfo) + "cookies/";
std::filesystem::create_directories(directory);
std::string cookieFile = directory + "cookies.txt";
// Init curl
auto* curl = curl_easy_init();
struct input i;
i.in = data;
i.hnd = curl;
//auto form = curl_mime_init(curl);
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Accept: */*");
headers = curl_slist_append(headers, X_BSSB);
headers = curl_slist_append(headers, "Content-Type: application/octet-stream");
// Set headers
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, query_encode(url).c_str());
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookieFile.c_str());
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, cookieFile.c_str());
// Don't wait forever, time out after TIMEOUT seconds.
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
ProgressUpdateWrapper* wrapper = new ProgressUpdateWrapper { progressUpdate, length };
if (progressUpdate) {
// Internal CURL progressmeter must be disabled if we provide our own callback
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, wrapper);
// Install the callback function
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION,
+[] (void* clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) {
float percentage = (ulnow / (float)reinterpret_cast<ProgressUpdateWrapper*>(clientp)->length) * 100.0f;
if(isnan(percentage))
percentage = 0.0f;
reinterpret_cast<ProgressUpdateWrapper*>(clientp)->progressUpdate(percentage);
return 0;
}
);
}
// Follow HTTP redirects if necessary.
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);
long httpCode(0);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &val);
curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* size of the POST data */
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, length);
/* binary data */
curl_easy_setopt(curl, CURLOPT_READDATA, &i);
CURLcode res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK) {
getLogger().critical("curl_easy_perform() failed: %u: %s", res, curl_easy_strerror(res));
}
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
//curl_mime_free(form);
finished(httpCode, val);
}
);
t.detach();
}
}
| 40.683871
| 172
| 0.540332
|
Christoffyw
|
e750331b1784db31cfa7d7ab6f03ac4554927de1
| 1,384
|
cpp
|
C++
|
Loong/LoongEditor/src/widget/LoongEditorTreeNodeWidget.cpp
|
carlcc/Loong
|
577e89b436eb0e5899295c95ee4587c0270cea94
|
[
"Apache-2.0"
] | 9
|
2020-08-14T02:01:02.000Z
|
2022-01-28T08:51:12.000Z
|
Loong/LoongEditor/src/widget/LoongEditorTreeNodeWidget.cpp
|
carlcc/Loong
|
577e89b436eb0e5899295c95ee4587c0270cea94
|
[
"Apache-2.0"
] | null | null | null |
Loong/LoongEditor/src/widget/LoongEditorTreeNodeWidget.cpp
|
carlcc/Loong
|
577e89b436eb0e5899295c95ee4587c0270cea94
|
[
"Apache-2.0"
] | null | null | null |
//
// Copyright (c) 2020 Carl Chen. All rights reserved.
//
#include "LoongEditorTreeNodeWidget.h"
#include <imgui.h>
namespace Loong::Editor {
void EditorTreeNodeWidget::DrawImpl()
{
bool prevOpened = isOpened_;
if (shouldOpen_) {
ImGui::SetNextTreeNodeOpen(true);
shouldOpen_ = false;
} else if (shouldClose_) {
ImGui::SetNextTreeNodeOpen(false);
shouldClose_ = false;
}
// clang-format off
ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags_None;
if (arrowClickToOpen_) flags |= ImGuiTreeNodeFlags_OpenOnArrow;
if (isSelected_) flags |= ImGuiTreeNodeFlags_Selected;
if (isLeaf_) flags |= ImGuiTreeNodeFlags_Leaf;
// clang-format on
bool opened = ImGui::TreeNodeEx((name_ + widgetId_).c_str(), flags);
if (ImGui::IsItemClicked() && (ImGui::GetMousePos().x - ImGui::GetItemRectMin().x) > ImGui::GetTreeNodeToLabelSpacing()) {
OnClickSignal_.emit(this);
}
if (opened) {
if (!prevOpened) {
OnExpandSignal_.emit(this);
}
isOpened_ = true;
for (auto& widget : children_) {
widget->Draw();
}
ImGui::TreePop();
} else {
if (prevOpened) {
OnCollapseSignal_.emit(this);
}
isOpened_ = false;
}
}
}
| 24.714286
| 127
| 0.580202
|
carlcc
|
e7533f623c7a03304bfcc47ea6355f12169c5b37
| 17,227
|
cpp
|
C++
|
src/modules/processes/Global/ColorManagementSetupInstance.cpp
|
fmeschia/pixinsight-class-library
|
11b956e27d6eee3e119a7b1c337d090d7a03f436
|
[
"JasPer-2.0",
"libtiff"
] | null | null | null |
src/modules/processes/Global/ColorManagementSetupInstance.cpp
|
fmeschia/pixinsight-class-library
|
11b956e27d6eee3e119a7b1c337d090d7a03f436
|
[
"JasPer-2.0",
"libtiff"
] | null | null | null |
src/modules/processes/Global/ColorManagementSetupInstance.cpp
|
fmeschia/pixinsight-class-library
|
11b956e27d6eee3e119a7b1c337d090d7a03f436
|
[
"JasPer-2.0",
"libtiff"
] | null | null | null |
// ____ ______ __
// / __ \ / ____// /
// / /_/ // / / /
// / ____// /___ / /___ PixInsight Class Library
// /_/ \____//_____/ PCL 2.4.9
// ----------------------------------------------------------------------------
// Standard Global Process Module Version 1.3.0
// ----------------------------------------------------------------------------
// ColorManagementSetupInstance.cpp - Released 2021-04-09T19:41:48Z
// ----------------------------------------------------------------------------
// This file is part of the standard Global PixInsight module.
//
// Copyright (c) 2003-2021 Pleiades Astrophoto S.L. All Rights Reserved.
//
// Redistribution and use in both source and binary forms, with or without
// modification, is permitted provided that the following conditions are met:
//
// 1. All redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. All redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
// of their contributors, may be used to endorse or promote products derived
// from this software without specific prior written permission. For written
// permission, please contact info@pixinsight.com.
//
// 4. All products derived from this software, in any form whatsoever, must
// reproduce the following acknowledgment in the end-user documentation
// and/or other materials provided with the product:
//
// "This product is based on software from the PixInsight project, developed
// by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
//
// Alternatively, if that is where third-party acknowledgments normally
// appear, this acknowledgment must be reproduced in the product itself.
//
// THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
// INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
// DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// ----------------------------------------------------------------------------
#include "ColorManagementSetupInstance.h"
#include "ColorManagementSetupParameters.h"
#include <pcl/GlobalSettings.h>
#include <pcl/MetaModule.h>
namespace pcl
{
// ----------------------------------------------------------------------------
ColorManagementSetupInstance::ColorManagementSetupInstance( const MetaProcess* p )
: ProcessImplementation( p )
, p_enabled( TheCMSEnabledParameter->DefaultValue() )
, p_detectMonitorProfile( TheCMSDetectMonitorProfileParameter->DefaultValue() )
, p_defaultRenderingIntent( CMSRenderingIntent::DefaultForScreen )
, p_onProfileMismatch( CMSOnProfileMismatch::Default )
, p_onMissingProfile( CMSOnMissingProfile::Default )
, p_defaultEmbedProfilesInRGBImages( TheCMSDefaultEmbedProfilesInRGBImagesParameter->DefaultValue() )
, p_defaultEmbedProfilesInGrayscaleImages( TheCMSDefaultEmbedProfilesInGrayscaleImagesParameter->DefaultValue() )
, p_useLowResolutionCLUTs( TheCMSUseLowResolutionCLUTsParameter->DefaultValue() )
, p_proofingIntent( CMSRenderingIntent::DefaultForProofing )
, p_useProofingBPC( TheCMSUseProofingBPCParameter->DefaultValue() )
, p_defaultProofingEnabled( TheCMSDefaultProofingEnabledParameter->DefaultValue() )
, p_defaultGamutCheckEnabled( TheCMSDefaultGamutCheckEnabledParameter->DefaultValue() )
, p_gamutWarningColor( TheCMSGamutWarningColorParameter->DefaultValue() )
{
/*
* The default sRGB profile is system/platform dependent. It is detected
* automatically upon application startup.
*
* N.B.: We cannot call PixInsightSettings::GlobalString() if the module has
* not been installed, because it requires communication with the core
* application. The interface class will have to initialize its instance
* member in its reimplementation of Initialize().
*/
if ( Module->IsInstalled() )
{
String sRGBProfilePath = PixInsightSettings::GlobalString( "ColorManagement/SRGBProfilePath" );
if ( !sRGBProfilePath.IsEmpty() )
{
ICCProfile icc( sRGBProfilePath );
if ( icc.IsProfile() )
p_defaultRGBProfile = p_defaultGrayscaleProfile = p_proofingProfile = icc.Description();
}
}
}
// ----------------------------------------------------------------------------
ColorManagementSetupInstance::ColorManagementSetupInstance( const ColorManagementSetupInstance& x )
: ProcessImplementation( x )
{
Assign( x );
}
// ----------------------------------------------------------------------------
void ColorManagementSetupInstance::Assign( const ProcessImplementation& p )
{
const ColorManagementSetupInstance* x = dynamic_cast<const ColorManagementSetupInstance*>( &p );
if ( x != nullptr )
{
p_enabled = x->p_enabled;
p_detectMonitorProfile = x->p_detectMonitorProfile;
p_updateMonitorProfile = x->p_updateMonitorProfile;
p_defaultRGBProfile = x->p_defaultRGBProfile;
p_defaultGrayscaleProfile = x->p_defaultGrayscaleProfile;
p_defaultRenderingIntent = x->p_defaultRenderingIntent;
p_onProfileMismatch = x->p_onProfileMismatch;
p_onMissingProfile = x->p_onMissingProfile;
p_defaultEmbedProfilesInRGBImages = x->p_defaultEmbedProfilesInRGBImages;
p_defaultEmbedProfilesInGrayscaleImages = x->p_defaultEmbedProfilesInGrayscaleImages;
p_useLowResolutionCLUTs = x->p_useLowResolutionCLUTs;
p_proofingProfile = x->p_proofingProfile;
p_proofingIntent = x->p_proofingIntent;
p_useProofingBPC = x->p_useProofingBPC;
p_defaultProofingEnabled = x->p_defaultProofingEnabled;
p_defaultGamutCheckEnabled = x->p_defaultGamutCheckEnabled;
p_gamutWarningColor = x->p_gamutWarningColor;
}
}
// ----------------------------------------------------------------------------
bool ColorManagementSetupInstance::CanExecuteOn( const View&, pcl::String& whyNot ) const
{
whyNot = "ColorManagementSetup can only be executed in the global context.";
return false;
}
// ----------------------------------------------------------------------------
bool ColorManagementSetupInstance::CanExecuteGlobal( pcl::String& whyNot ) const
{
return true;
}
// ----------------------------------------------------------------------------
bool ColorManagementSetupInstance::ExecuteGlobal()
{
/*
* Find all installed ICC profiles
*/
StringList all = ICCProfile::FindProfiles();
/*
* Find the default RGB profile
*/
StringList descriptions;
StringList paths;
ICCProfile::ExtractProfileList( descriptions,
paths,
all,
ICCColorSpace::RGB );
StringList::const_iterator i = descriptions.Search( p_defaultRGBProfile );
if ( i == descriptions.End() )
throw Error( "Couldn't find the '" + p_defaultRGBProfile + "' profile.\n"
"Either it has not been installed, it is not a valid RGB profile,\n"
"or the corresponding disk file has been removed." );
String rgbPath = paths[i - descriptions.Begin()];
/*
* Find the default grayscale profile
*/
descriptions.Clear();
paths.Clear();
ICCProfile::ExtractProfileList( descriptions,
paths,
all,
ICCColorSpace::RGB|ICCColorSpace::Gray );
i = descriptions.Search( p_defaultGrayscaleProfile );
if ( i == descriptions.End() )
throw Error( "Couldn't find the '" + p_defaultGrayscaleProfile + "' profile.\n"
"Either it has not been installed, or the corresponding disk file has been removed." );
String grayPath = paths[i - descriptions.Begin()];
/*
* Find the proofing profile
*/
descriptions.Clear();
paths.Clear();
ICCProfile::ExtractProfileList( descriptions,
paths,
all ); // all color spaces are valid for proofing
i = descriptions.Search( p_proofingProfile );
if ( i == descriptions.End() )
throw Error( "Couldn't find the '" + p_proofingProfile + "' profile.\n"
"Either it has not been installed, or the corresponding disk file has been removed." );
String proofingPath = paths[i - descriptions.Begin()];
/*
* Perform global settings update
*/
PixInsightSettings::BeginUpdate();
try
{
PixInsightSettings::SetGlobalFlag( "ColorManagement/IsEnabled", p_enabled );
PixInsightSettings::SetGlobalFlag( "ColorManagement/DetectMonitorProfile", p_detectMonitorProfile );
if ( !p_updateMonitorProfile.IsEmpty() )
PixInsightSettings::SetGlobalString( "ColorManagement/UpdateMonitorProfile", p_updateMonitorProfile );
PixInsightSettings::SetGlobalString( "ColorManagement/DefaultRGBProfilePath", rgbPath );
PixInsightSettings::SetGlobalString( "ColorManagement/DefaultGrayscaleProfilePath", grayPath );
PixInsightSettings::SetGlobalInteger( "ColorManagement/DefaultRenderingIntent", p_defaultRenderingIntent );
PixInsightSettings::SetGlobalInteger( "ColorManagement/OnProfileMismatch", p_onProfileMismatch );
PixInsightSettings::SetGlobalInteger( "ColorManagement/OnMissingProfile", p_onMissingProfile );
PixInsightSettings::SetGlobalFlag( "ColorManagement/DefaultEmbedProfilesInRGBImages", p_defaultEmbedProfilesInRGBImages );
PixInsightSettings::SetGlobalFlag( "ColorManagement/DefaultEmbedProfilesInGrayscaleImages", p_defaultEmbedProfilesInGrayscaleImages );
PixInsightSettings::SetGlobalFlag( "ColorManagement/UseLowResolutionCLUTs", p_useLowResolutionCLUTs );
PixInsightSettings::SetGlobalString( "ColorManagement/ProofingProfilePath", proofingPath );
PixInsightSettings::SetGlobalInteger( "ColorManagement/ProofingIntent", p_proofingIntent );
PixInsightSettings::SetGlobalFlag( "ColorManagement/UseProofingBPC", p_useProofingBPC );
PixInsightSettings::SetGlobalFlag( "ColorManagement/DefaultProofingEnabled", p_defaultProofingEnabled );
PixInsightSettings::SetGlobalFlag( "ColorManagement/DefaultGamutCheckEnabled", p_defaultGamutCheckEnabled );
PixInsightSettings::SetGlobalColor( "ColorManagement/GamutWarningColor", p_gamutWarningColor );
PixInsightSettings::EndUpdate();
return true;
}
catch ( ... )
{
// ### Warning: Don't forget to do this, or the core will bite you!
PixInsightSettings::CancelUpdate();
throw;
}
}
// ----------------------------------------------------------------------------
void* ColorManagementSetupInstance::LockParameter( const MetaParameter* p, size_type /*tableRow*/ )
{
if ( p == TheCMSEnabledParameter )
return &p_enabled;
if ( p == TheCMSDetectMonitorProfileParameter )
return &p_detectMonitorProfile;
if ( p == TheCMSUpdateMonitorProfileParameter )
return p_updateMonitorProfile.Begin();
if ( p == TheCMSDefaultRGBProfileParameter )
return p_defaultRGBProfile.Begin();
if ( p == TheCMSDefaultGrayProfileParameter )
return p_defaultGrayscaleProfile.Begin();
if ( p == TheCMSDefaultRenderingIntentParameter )
return &p_defaultRenderingIntent;
if ( p == TheCMSOnProfileMismatchParameter )
return &p_onProfileMismatch;
if ( p == TheCMSOnMissingProfileParameter )
return &p_onMissingProfile;
if ( p == TheCMSDefaultEmbedProfilesInRGBImagesParameter )
return &p_defaultEmbedProfilesInRGBImages;
if ( p == TheCMSDefaultEmbedProfilesInGrayscaleImagesParameter )
return &p_defaultEmbedProfilesInGrayscaleImages;
if ( p == TheCMSUseLowResolutionCLUTsParameter )
return &p_useLowResolutionCLUTs;
if ( p == TheCMSProofingProfileParameter )
return p_proofingProfile.Begin();
if ( p == TheCMSProofingIntentParameter )
return &p_proofingIntent;
if ( p == TheCMSUseProofingBPCParameter )
return &p_useProofingBPC;
if ( p == TheCMSDefaultProofingEnabledParameter )
return &p_defaultProofingEnabled;
if ( p == TheCMSDefaultGamutCheckEnabledParameter )
return &p_defaultGamutCheckEnabled;
if ( p == TheCMSGamutWarningColorParameter )
return &p_gamutWarningColor;
return nullptr;
}
// ----------------------------------------------------------------------------
bool ColorManagementSetupInstance::AllocateParameter( size_type sizeOrLength, const MetaParameter* p, size_type /*tableRow*/ )
{
if ( p == TheCMSDefaultRGBProfileParameter )
{
p_defaultRGBProfile.Clear();
if ( sizeOrLength != 0 )
p_defaultRGBProfile.SetLength( sizeOrLength );
}
else if ( p == TheCMSDefaultGrayProfileParameter )
{
p_defaultGrayscaleProfile.Clear();
if ( sizeOrLength != 0 )
p_defaultGrayscaleProfile.SetLength( sizeOrLength );
}
else if ( p == TheCMSProofingProfileParameter )
{
p_proofingProfile.Clear();
if ( sizeOrLength != 0 )
p_proofingProfile.SetLength( sizeOrLength );
}
else if ( p == TheCMSUpdateMonitorProfileParameter )
{
p_updateMonitorProfile.Clear();
if ( sizeOrLength != 0 )
p_updateMonitorProfile.SetLength( sizeOrLength );
}
else
return false;
return true;
}
// ----------------------------------------------------------------------------
size_type ColorManagementSetupInstance::ParameterLength( const MetaParameter* p, size_type /*tableRow*/ ) const
{
if ( p == TheCMSDefaultRGBProfileParameter )
return p_defaultRGBProfile.Length();
if ( p == TheCMSDefaultGrayProfileParameter )
return p_defaultGrayscaleProfile.Length();
if ( p == TheCMSProofingProfileParameter )
return p_proofingProfile.Length();
if ( p == TheCMSUpdateMonitorProfileParameter )
return p_updateMonitorProfile.Length();
return 0;
}
// ----------------------------------------------------------------------------
void ColorManagementSetupInstance::LoadCurrentSettings()
{
p_enabled = PixInsightSettings::GlobalFlag( "ColorManagement/IsEnabled" );
p_detectMonitorProfile = PixInsightSettings::GlobalFlag( "ColorManagement/DetectMonitorProfile" );
p_defaultRGBProfile = ICCProfile( PixInsightSettings::GlobalString( "ColorManagement/DefaultRGBProfilePath" ) ).Description();
p_defaultGrayscaleProfile = ICCProfile( PixInsightSettings::GlobalString( "ColorManagement/DefaultGrayscaleProfilePath" ) ).Description();
p_defaultRenderingIntent = PixInsightSettings::GlobalInteger( "ColorManagement/DefaultRenderingIntent" );
p_onProfileMismatch = PixInsightSettings::GlobalInteger( "ColorManagement/OnProfileMismatch" );
p_onMissingProfile = PixInsightSettings::GlobalInteger( "ColorManagement/OnMissingProfile" );
p_defaultEmbedProfilesInRGBImages = PixInsightSettings::GlobalFlag( "ColorManagement/DefaultEmbedProfilesInRGBImages" );
p_defaultEmbedProfilesInGrayscaleImages = PixInsightSettings::GlobalFlag( "ColorManagement/DefaultEmbedProfilesInGrayscaleImages" );
p_useLowResolutionCLUTs = PixInsightSettings::GlobalFlag( "ColorManagement/UseLowResolutionCLUTs" );
p_proofingProfile = ICCProfile( PixInsightSettings::GlobalString( "ColorManagement/ProofingProfilePath" ) ).Description();
p_proofingIntent = PixInsightSettings::GlobalInteger( "ColorManagement/ProofingIntent" );
p_useProofingBPC = PixInsightSettings::GlobalFlag( "ColorManagement/UseProofingBPC" );
p_defaultProofingEnabled = PixInsightSettings::GlobalFlag( "ColorManagement/DefaultProofingEnabled" );
p_defaultGamutCheckEnabled = PixInsightSettings::GlobalFlag( "ColorManagement/DefaultGamutCheckEnabled" );
p_gamutWarningColor = PixInsightSettings::GlobalColor( "ColorManagement/GamutWarningColor" );
}
// ----------------------------------------------------------------------------
} // pcl
// ----------------------------------------------------------------------------
// EOF ColorManagementSetupInstance.cpp - Released 2021-04-09T19:41:48Z
| 46.8125
| 142
| 0.66477
|
fmeschia
|
e755ab2b68d7b1cb169e62ed490f9cbc0275fbbe
| 4,850
|
cpp
|
C++
|
src/LightBulbApp/TrainingPlans/Preferences/PredefinedPreferenceGroups/Supervised/GradientDescentLearningRulePreferenceGroup.cpp
|
domin1101/ANNHelper
|
50acb5746d6dad6777532e4c7da4983a7683efe0
|
[
"Zlib"
] | 5
|
2016-02-04T06:14:42.000Z
|
2017-02-06T02:21:43.000Z
|
src/LightBulbApp/TrainingPlans/Preferences/PredefinedPreferenceGroups/Supervised/GradientDescentLearningRulePreferenceGroup.cpp
|
domin1101/ANNHelper
|
50acb5746d6dad6777532e4c7da4983a7683efe0
|
[
"Zlib"
] | 41
|
2015-04-15T21:05:45.000Z
|
2015-07-09T12:59:02.000Z
|
src/LightBulbApp/TrainingPlans/Preferences/PredefinedPreferenceGroups/Supervised/GradientDescentLearningRulePreferenceGroup.cpp
|
domin1101/LightBulb
|
50acb5746d6dad6777532e4c7da4983a7683efe0
|
[
"Zlib"
] | null | null | null |
// Includes
#include "LightBulbApp/TrainingPlans/Preferences/PredefinedPreferenceGroups/Supervised/GradientDescentLearningRulePreferenceGroup.hpp"
#include "LightBulbApp/TrainingPlans/Preferences/ChoicePreference.hpp"
#include "LightBulbApp/TrainingPlans/Preferences/PredefinedPreferenceGroups/Supervised/GradientDescentAlgorithms/SimpleGradientDescentPreferenceGroup.hpp"
#include "LightBulbApp/TrainingPlans/Preferences/PredefinedPreferenceGroups/Supervised/GradientDescentAlgorithms/ResilientLearningRatePreferenceGroup.hpp"
#include "LightBulbApp/TrainingPlans/Preferences/PredefinedPreferenceGroups/Supervised/GradientCalculation/BackpropagationPreferenceGroup.hpp"
#include "LightBulb/Learning/Supervised/GradientDescentLearningRule.hpp"
#include "LightBulb/Learning/Supervised/GradientDescentAlgorithms/SimpleGradientDescent.hpp"
#include "LightBulb/Learning/Supervised/GradientDescentAlgorithms/ResilientLearningRate.hpp"
#include "LightBulb/Learning/Supervised/GradientCalculation/Backpropagation.hpp"
namespace LightBulb
{
#define PREFERENCE_GRADIENT_DECENT_ALGORITHM "Gradient decent algorithm"
#define CHOICE_SIMPLE_GRADIENT_DESCENT "Simple gradient descent"
#define CHOICE_RESILIENT_LEARNING_RATE "Resilient learning rate"
GradientDescentLearningRulePreferenceGroup::GradientDescentLearningRulePreferenceGroup(bool skipGradientDescentAlgorithm, const std::string& name)
:AbstractSupervisedLearningRulePreferenceGroup(name)
{
GradientDescentLearningRuleOptions options;
SimpleGradientDescentOptions simpleGradientDescentOptions;
ResilientLearningRateOptions resilientLearningRateOptions;
initialize(skipGradientDescentAlgorithm, options, simpleGradientDescentOptions, resilientLearningRateOptions);
}
GradientDescentLearningRulePreferenceGroup::GradientDescentLearningRulePreferenceGroup(const GradientDescentLearningRuleOptions& options, bool skipGradientDescentAlgorithm, const std::string& name)
:AbstractSupervisedLearningRulePreferenceGroup(options, name)
{
SimpleGradientDescentOptions simpleGradientDescentOptions;
ResilientLearningRateOptions resilientLearningRateOptions;
initialize(skipGradientDescentAlgorithm, options, simpleGradientDescentOptions, resilientLearningRateOptions);
}
GradientDescentLearningRulePreferenceGroup::GradientDescentLearningRulePreferenceGroup(const GradientDescentLearningRuleOptions& options, const SimpleGradientDescentOptions& simpleGradientDescentOptions, const ResilientLearningRateOptions& resilientLearningRateOptions, const std::string& name)
{
initialize(false, options, simpleGradientDescentOptions, resilientLearningRateOptions);
}
void GradientDescentLearningRulePreferenceGroup::initialize(bool skipGradientDescentAlgorithm, const GradientDescentLearningRuleOptions& options, const SimpleGradientDescentOptions& simpleGradientDescentOptions, const ResilientLearningRateOptions& resilientLearningRateOptions)
{
AbstractSupervisedLearningRulePreferenceGroup::initialize(options);
if (!skipGradientDescentAlgorithm) {
ChoicePreference* choicePreference = new ChoicePreference(PREFERENCE_GRADIENT_DECENT_ALGORITHM, CHOICE_SIMPLE_GRADIENT_DESCENT);
choicePreference->addChoice(CHOICE_SIMPLE_GRADIENT_DESCENT);
choicePreference->addChoice(CHOICE_RESILIENT_LEARNING_RATE);
addPreference(choicePreference);
addPreference(new SimpleGradientDescentPreferenceGroup(simpleGradientDescentOptions));
addPreference(new ResilientLearningRatePreferenceGroup(resilientLearningRateOptions));
}
addPreference(new BackpropagationPreferenceGroup());
}
GradientDescentLearningRuleOptions GradientDescentLearningRulePreferenceGroup::create() const
{
GradientDescentLearningRuleOptions options;
fillOptions(options);
std::string gradientDescentAlgorithm = "";
try {
gradientDescentAlgorithm = getChoicePreference(PREFERENCE_GRADIENT_DECENT_ALGORITHM);
} catch(std::exception e) {
gradientDescentAlgorithm = "";
}
if (gradientDescentAlgorithm == CHOICE_SIMPLE_GRADIENT_DESCENT)
{
SimpleGradientDescentOptions gradientDescentOptions = createFromGroup<SimpleGradientDescentOptions, SimpleGradientDescentPreferenceGroup>();
options.gradientDescentAlgorithm = new SimpleGradientDescent(gradientDescentOptions);
}
else if (gradientDescentAlgorithm == CHOICE_RESILIENT_LEARNING_RATE)
{
ResilientLearningRateOptions resilientLearningRateOptions = createFromGroup<ResilientLearningRateOptions, ResilientLearningRatePreferenceGroup>();
options.gradientDescentAlgorithm = new ResilientLearningRate(resilientLearningRateOptions);
}
options.gradientCalculation = createFromGroup<Backpropagation*, BackpropagationPreferenceGroup>();
return options;
}
AbstractCloneable* GradientDescentLearningRulePreferenceGroup::clone() const
{
return new GradientDescentLearningRulePreferenceGroup(*this);
}
}
| 55.113636
| 295
| 0.869897
|
domin1101
|
e757974594b2b11a430eb98e498866af6074b5df
| 157
|
hpp
|
C++
|
Engine/Src/Runtime/Core/Public/Core/Serialization/ISerializable.hpp
|
Septus10/Fade-Engine
|
285a2a1cf14a4e9c3eb8f6d30785d1239cef10b6
|
[
"MIT"
] | null | null | null |
Engine/Src/Runtime/Core/Public/Core/Serialization/ISerializable.hpp
|
Septus10/Fade-Engine
|
285a2a1cf14a4e9c3eb8f6d30785d1239cef10b6
|
[
"MIT"
] | null | null | null |
Engine/Src/Runtime/Core/Public/Core/Serialization/ISerializable.hpp
|
Septus10/Fade-Engine
|
285a2a1cf14a4e9c3eb8f6d30785d1239cef10b6
|
[
"MIT"
] | null | null | null |
#pragma once
namespace Fade {
class ISerializable
{
//virtual void Deserialize(FArchive& a_Archive);
//virtual void Serialize(FArchive& a_Archive);
};
}
| 14.272727
| 49
| 0.745223
|
Septus10
|
e75ee56a20761b1c08724a624b28db3f0864eb6d
| 2,976
|
cpp
|
C++
|
SPOJ/MIXTURES - Mixtures.cpp
|
ravirathee/Competitive-Programming
|
20a0bfda9f04ed186e2f475644e44f14f934b533
|
[
"Unlicense"
] | 6
|
2018-11-26T02:38:07.000Z
|
2021-07-28T00:16:41.000Z
|
SPOJ/MIXTURES - Mixtures.cpp
|
ravirathee/Competitive-Programming
|
20a0bfda9f04ed186e2f475644e44f14f934b533
|
[
"Unlicense"
] | 1
|
2021-05-30T09:25:53.000Z
|
2021-06-05T08:33:56.000Z
|
SPOJ/MIXTURES - Mixtures.cpp
|
ravirathee/Competitive-Programming
|
20a0bfda9f04ed186e2f475644e44f14f934b533
|
[
"Unlicense"
] | 4
|
2020-04-16T07:15:01.000Z
|
2020-12-04T06:26:07.000Z
|
/*MIXTURES - Mixtures
#dynamic-programming
Harry Potter has n mixtures in front of him, arranged in a row. Each mixture has one of 100 different colors (colors have numbers from 0 to 99).
He wants to mix all these mixtures together. At each step, he is going to take two mixtures that stand next to each other and mix them together, and put the resulting mixture in their place.
When mixing two mixtures of colors a and b, the resulting mixture will have the color (a+b) mod 100.
Also, there will be some smoke in the process. The amount of smoke generated when mixing two mixtures of colors a and b is a*b.
Find out what is the minimum amount of smoke that Harry can get when mixing all the mixtures together.
Input
There will be a number of test cases in the input.
The first line of each test case will contain n, the number of mixtures, 1 <= n <= 100.
The second line will contain n integers between 0 and 99 - the initial colors of the mixtures.
Output
For each test case, output the minimum amount of smoke.
Example
Input:
2
18 19
3
40 60 20
Output:
342
2400
In the second test case, there are two possibilities:
first mix 40 and 60 (smoke: 2400), getting 0, then mix 0 and 20 (smoke: 0); total amount of smoke is 2400
first mix 60 and 20 (smoke: 1200), getting 80, then mix 40 and 80 (smoke: 3200); total amount of smoke is 4400
The first scenario is a much better way to proceed. */
#include <algorithm>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <vector>
long solve(const int i,
const int j,
const std::vector<int>& arr,
std::vector<std::vector<int>>& dp)
{
if (i >= j)
return 0;
else if (dp[i][j] != -1)
return dp[i][j];
else
{
long res = std::numeric_limits<int>::max();
for (int k = i; k < j; ++k)
{
static auto sum_mod = [](int a, int b){return (a + b) % 100;};
int csum1 = std::accumulate(std::begin(arr)+i,
std::begin(arr)+k+1,
0,
sum_mod);
int csum2 = std::accumulate(std::begin(arr)+k+1,
std::begin(arr)+j+1,
0,
sum_mod);
res = std::min(res, solve(i, k, arr, dp) + solve(k+1, j, arr, dp) + (csum1*csum2));
}
dp[i][j] = res;
return res;
}
}
int main()
{
std::ios_base::sync_with_stdio(false);
int n;
while (std::cin >> n)
{
std::vector<int> arr (n);
std::vector<std::vector<int>> dp (n, std::vector<int>(n, -1));
std::copy_n(std::istream_iterator<int>(std::cin), n, std::begin(arr));
std::cout << solve(0, n-1, arr, dp) << std::endl;
}
return 0;
}
| 29.465347
| 190
| 0.569556
|
ravirathee
|
e765bf4fd1639e118830c141a0ffb5137baf28e3
| 732
|
hpp
|
C++
|
Framework/Common/MemoryManager.hpp
|
lishaojiang/GameEngineFromScratch
|
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
|
[
"MIT"
] | 1,217
|
2017-08-18T02:41:11.000Z
|
2022-03-30T01:48:46.000Z
|
Framework/Common/MemoryManager.hpp
|
lishaojiang/GameEngineFromScratch
|
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
|
[
"MIT"
] | 16
|
2017-09-05T15:04:37.000Z
|
2021-09-09T13:59:38.000Z
|
Framework/Common/MemoryManager.hpp
|
lishaojiang/GameEngineFromScratch
|
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
|
[
"MIT"
] | 285
|
2017-08-18T04:53:55.000Z
|
2022-03-30T00:02:15.000Z
|
#pragma once
#include <map>
#include <new>
#include <ostream>
#include "IMemoryManager.hpp"
#include "portable.hpp"
namespace My {
ENUM(MemoryType){CPU = "CPU"_i32, GPU = "GPU"_i32};
std::ostream& operator<<(std::ostream& out, MemoryType type);
class MemoryManager : _implements_ IMemoryManager {
public:
~MemoryManager() override = default;
int Initialize() override;
void Finalize() override;
void Tick() override;
void* AllocatePage(size_t size) override;
void FreePage(void* p) override;
protected:
struct MemoryAllocationInfo {
size_t PageSize;
MemoryType PageMemoryType;
};
std::map<void*, MemoryAllocationInfo> m_mapMemoryAllocationInfo;
};
} // namespace My
| 22.181818
| 68
| 0.695355
|
lishaojiang
|
e76c507453a5e146bbc868a0816ff3dffce74df2
| 10,074
|
cpp
|
C++
|
source/Irrlicht/CGUIWindow.cpp
|
arch-jslin/Irrlicht
|
56121a167cacf1131182616b6d9a41ce825f9402
|
[
"IJG"
] | 2
|
2018-06-18T16:49:10.000Z
|
2021-03-10T11:10:47.000Z
|
source/Irrlicht/CGUIWindow.cpp
|
arch-jslin/Irrlicht
|
56121a167cacf1131182616b6d9a41ce825f9402
|
[
"IJG"
] | null | null | null |
source/Irrlicht/CGUIWindow.cpp
|
arch-jslin/Irrlicht
|
56121a167cacf1131182616b6d9a41ce825f9402
|
[
"IJG"
] | null | null | null |
// Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CGUIWindow.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUISkin.h"
#include "IGUIEnvironment.h"
#include "IVideoDriver.h"
#include "IGUIButton.h"
#include "IGUIFont.h"
#include "IGUIFontBitmap.h"
namespace irr
{
namespace gui
{
//! constructor
CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIWindow(environment, parent, id, rectangle), Dragging(false), IsDraggable(true), DrawBackground(true), DrawTitlebar(true), IsActive(false)
{
#ifdef _DEBUG
setDebugName("CGUIWindow");
#endif
IGUISkin* skin = 0;
if (environment)
skin = environment->getSkin();
IGUISpriteBank* sprites = 0;
video::SColor color(255,255,255,255);
s32 buttonw = 15;
if (skin)
{
buttonw = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
sprites = skin->getSpriteBank();
color = skin->getColor(EGDC_WINDOW_SYMBOL);
}
s32 posx = RelativeRect.getWidth() - buttonw - 4;
CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close" );
CloseButton->setSubElement(true);
CloseButton->setTabStop(false);
CloseButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
CloseButton->setSpriteBank(sprites);
CloseButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_CLOSE), color);
CloseButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_CLOSE), color);
}
posx -= buttonw + 2;
RestoreButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_RESTORE) : L"Restore" );
RestoreButton->setVisible(false);
RestoreButton->setSubElement(true);
RestoreButton->setTabStop(false);
RestoreButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
RestoreButton->setSpriteBank(sprites);
RestoreButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_RESTORE), color);
RestoreButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_RESTORE), color);
}
posx -= buttonw + 2;
MinButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_MINIMIZE) : L"Minimize" );
MinButton->setVisible(false);
MinButton->setSubElement(true);
MinButton->setTabStop(false);
MinButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
MinButton->setSpriteBank(sprites);
MinButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_MINIMIZE), color);
MinButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_MINIMIZE), color);
}
MinButton->grab();
RestoreButton->grab();
CloseButton->grab();
// this element is a tab group
setTabGroup(true);
setTabStop(true);
setTabOrder(-1);
updateClientRect();
}
//! destructor
CGUIWindow::~CGUIWindow()
{
if (MinButton)
MinButton->drop();
if (RestoreButton)
RestoreButton->drop();
if (CloseButton)
CloseButton->drop();
}
//! called if an event happened.
bool CGUIWindow::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
case EET_GUI_EVENT:
if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST)
{
Dragging = false;
IsActive = false;
}
else
if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUSED)
{
if (Parent && ((event.GUIEvent.Caller == this) || isMyChild(event.GUIEvent.Caller)))
{
Parent->bringToFront(this);
IsActive = true;
}
else
{
IsActive = false;
}
}
else
if (event.GUIEvent.EventType == EGET_BUTTON_CLICKED)
{
if (event.GUIEvent.Caller == CloseButton)
{
if (Parent)
{
// send close event to parent
SEvent e;
e.EventType = EET_GUI_EVENT;
e.GUIEvent.Caller = this;
e.GUIEvent.Element = 0;
e.GUIEvent.EventType = EGET_ELEMENT_CLOSED;
// if the event was not absorbed
if (!Parent->OnEvent(e))
remove();
return true;
}
else
{
remove();
return true;
}
}
}
break;
case EET_MOUSE_INPUT_EVENT:
switch(event.MouseInput.Event)
{
case EMIE_LMOUSE_PRESSED_DOWN:
DragStart.X = event.MouseInput.X;
DragStart.Y = event.MouseInput.Y;
Dragging = IsDraggable;
if (Parent)
Parent->bringToFront(this);
return true;
case EMIE_LMOUSE_LEFT_UP:
Dragging = false;
return true;
case EMIE_MOUSE_MOVED:
if (!event.MouseInput.isLeftPressed())
Dragging = false;
if (Dragging)
{
// gui window should not be dragged outside its parent
if (Parent &&
(event.MouseInput.X < Parent->getAbsolutePosition().UpperLeftCorner.X +1 ||
event.MouseInput.Y < Parent->getAbsolutePosition().UpperLeftCorner.Y +1 ||
event.MouseInput.X > Parent->getAbsolutePosition().LowerRightCorner.X -1 ||
event.MouseInput.Y > Parent->getAbsolutePosition().LowerRightCorner.Y -1))
return true;
move(core::position2d<s32>(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y));
DragStart.X = event.MouseInput.X;
DragStart.Y = event.MouseInput.Y;
return true;
}
break;
default:
break;
}
default:
break;
}
}
return IGUIElement::OnEvent(event);
}
//! Updates the absolute position.
void CGUIWindow::updateAbsolutePosition()
{
IGUIElement::updateAbsolutePosition();
}
//! draws the element and its children
void CGUIWindow::draw()
{
if (IsVisible)
{
IGUISkin* skin = Environment->getSkin();
// update each time because the skin is allowed to change this always.
updateClientRect();
core::rect<s32> rect = AbsoluteRect;
// draw body fast
if (DrawBackground)
{
rect = skin->draw3DWindowBackground(this, DrawTitlebar,
skin->getColor(IsActive ? EGDC_ACTIVE_BORDER : EGDC_INACTIVE_BORDER),
AbsoluteRect, &AbsoluteClippingRect);
if (DrawTitlebar && Text.size())
{
rect.UpperLeftCorner.X += skin->getSize(EGDS_TITLEBARTEXT_DISTANCE_X);
rect.UpperLeftCorner.Y += skin->getSize(EGDS_TITLEBARTEXT_DISTANCE_Y);
rect.LowerRightCorner.X -= skin->getSize(EGDS_WINDOW_BUTTON_WIDTH) + 5;
IGUIFont* font = skin->getFont(EGDF_WINDOW);
if (font)
{
font->draw(Text.c_str(), rect,
skin->getColor(IsActive ? EGDC_ACTIVE_CAPTION:EGDC_INACTIVE_CAPTION),
false, true, &AbsoluteClippingRect);
}
}
}
}
IGUIElement::draw();
}
//! Returns pointer to the close button
IGUIButton* CGUIWindow::getCloseButton() const
{
return CloseButton;
}
//! Returns pointer to the minimize button
IGUIButton* CGUIWindow::getMinimizeButton() const
{
return MinButton;
}
//! Returns pointer to the maximize button
IGUIButton* CGUIWindow::getMaximizeButton() const
{
return RestoreButton;
}
//! Returns true if the window is draggable, false if not
bool CGUIWindow::isDraggable() const
{
return IsDraggable;
}
//! Sets whether the window is draggable
void CGUIWindow::setDraggable(bool draggable)
{
IsDraggable = draggable;
if (Dragging && !IsDraggable)
Dragging = false;
}
//! Set if the window background will be drawn
void CGUIWindow::setDrawBackground(bool draw)
{
DrawBackground = draw;
}
//! Get if the window background will be drawn
bool CGUIWindow::getDrawBackground() const
{
return DrawBackground;
}
//! Set if the window titlebar will be drawn
void CGUIWindow::setDrawTitlebar(bool draw)
{
DrawTitlebar = draw;
}
//! Get if the window titlebar will be drawn
bool CGUIWindow::getDrawTitlebar() const
{
return DrawTitlebar;
}
void CGUIWindow::updateClientRect()
{
if (! DrawBackground )
{
ClientRect = core::rect<s32>(0,0, AbsoluteRect.getWidth(), AbsoluteRect.getHeight());
return;
}
IGUISkin* skin = Environment->getSkin();
skin->draw3DWindowBackground(this, DrawTitlebar,
skin->getColor(IsActive ? EGDC_ACTIVE_BORDER : EGDC_INACTIVE_BORDER),
AbsoluteRect, &AbsoluteClippingRect, &ClientRect);
ClientRect -= AbsoluteRect.UpperLeftCorner;
}
//! Returns the rectangle of the drawable area (without border, without titlebar and without scrollbars)
core::rect<s32> CGUIWindow::getClientRect() const
{
return ClientRect;
}
//! Writes attributes of the element.
void CGUIWindow::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIWindow::serializeAttributes(out,options);
out->addBool("IsDraggable", IsDraggable);
out->addBool("DrawBackground", DrawBackground);
out->addBool("DrawTitlebar", DrawTitlebar);
// Currently we can't just serialize attributes of sub-elements.
// To do this we either
// a) allow further serialization after attribute serialiation (second function, callback or event)
// b) add an IGUIElement attribute
// c) extend the attribute system to allow attributes to have sub-attributes
// We just serialize the most important info for now until we can do one of the above solutions.
out->addBool("IsCloseVisible", CloseButton->isVisible());
out->addBool("IsMinVisible", MinButton->isVisible());
out->addBool("IsRestoreVisible", RestoreButton->isVisible());
}
//! Reads attributes of the element
void CGUIWindow::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIWindow::deserializeAttributes(in,options);
Dragging = false;
IsActive = false;
IsDraggable = in->getAttributeAsBool("IsDraggable");
DrawBackground = in->getAttributeAsBool("DrawBackground");
DrawTitlebar = in->getAttributeAsBool("DrawTitlebar");
CloseButton->setVisible(in->getAttributeAsBool("IsCloseVisible"));
MinButton->setVisible(in->getAttributeAsBool("IsMinVisible"));
RestoreButton->setVisible(in->getAttributeAsBool("IsRestoreVisible"));
updateClientRect();
}
} // end namespace gui
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
| 25.69898
| 143
| 0.718384
|
arch-jslin
|
e76e562b84f64be22a59d1196ea88f2202d21bf2
| 2,900
|
hpp
|
C++
|
common/Options.hpp
|
MartinMetaksov/diku.OptionsPricing
|
1734801dddf7faa9e7c6ed1a46acb6ef8492e33c
|
[
"ISC"
] | 3
|
2019-01-11T11:13:13.000Z
|
2020-06-16T10:20:46.000Z
|
common/Options.hpp
|
MartinMetaksov/diku.OptionsPricing
|
1734801dddf7faa9e7c6ed1a46acb6ef8492e33c
|
[
"ISC"
] | null | null | null |
common/Options.hpp
|
MartinMetaksov/diku.OptionsPricing
|
1734801dddf7faa9e7c6ed1a46acb6ef8492e33c
|
[
"ISC"
] | 1
|
2019-01-09T21:47:46.000Z
|
2019-01-09T21:47:46.000Z
|
#ifndef OPTIONS_HPP
#define OPTIONS_HPP
#include <cinttypes>
#include <fstream>
#include <stdexcept>
#include <vector>
#include "Arrays.hpp"
#include "Real.hpp"
namespace trinom
{
enum class SortType : char
{
WIDTH_DESC = 'W',
WIDTH_ASC = 'w',
HEIGHT_DESC = 'H',
HEIGHT_ASC = 'h',
NONE = '-'
};
enum class OptionType : int8_t
{
CALL = 0,
PUT = 1
};
inline std::ostream &operator<<(std::ostream &os, const OptionType t)
{
os << static_cast<int>(t);
return os;
}
inline std::istream &operator>>(std::istream &is, OptionType &t)
{
int c;
is >> c;
t = static_cast<OptionType>(c);
if (OptionType::CALL != t && OptionType::PUT != t)
{
throw std::out_of_range("Invalid OptionType read from stream.");
}
return is;
}
struct Options
{
int N;
std::vector<real> StrikePrices;
std::vector<real> Maturities;
std::vector<real> Lengths;
std::vector<uint16_t> TermUnits;
std::vector<uint16_t> TermStepCounts;
std::vector<real> ReversionRates;
std::vector<real> Volatilities;
std::vector<OptionType> Types;
Options(const int count)
{
N = count;
Lengths.reserve(N);
Maturities.reserve(N);
StrikePrices.reserve(N);
TermUnits.reserve(N);
TermStepCounts.reserve(N);
ReversionRates.reserve(N);
Volatilities.reserve(N);
Types.reserve(N);
}
Options(const std::string &filename)
{
if (filename.empty())
{
throw std::invalid_argument("File not specified.");
}
std::ifstream in(filename);
if (!in)
{
throw std::invalid_argument("File '" + filename + "' does not exist.");
}
Arrays::read_array(in, StrikePrices);
Arrays::read_array(in, Maturities);
Arrays::read_array(in, Lengths);
Arrays::read_array(in, TermUnits);
Arrays::read_array(in, TermStepCounts);
Arrays::read_array(in, ReversionRates);
Arrays::read_array(in, Volatilities);
Arrays::read_array(in, Types);
N = StrikePrices.size();
in.close();
}
void writeToFile(const std::string &filename)
{
if (filename.empty())
{
throw std::invalid_argument("File not specified.");
}
std::ofstream out(filename);
if (!out)
{
throw std::invalid_argument("File does not exist.");
}
Arrays::write_array(out, StrikePrices);
Arrays::write_array(out, Maturities);
Arrays::write_array(out, Lengths);
Arrays::write_array(out, TermUnits);
Arrays::write_array(out, TermStepCounts);
Arrays::write_array(out, ReversionRates);
Arrays::write_array(out, Volatilities);
Arrays::write_array(out, Types);
out.close();
}
};
} // namespace trinom
#endif
| 22.65625
| 83
| 0.591034
|
MartinMetaksov
|
e770921b9fe4c70049212ece9cfdbd42d8745619
| 203
|
hpp
|
C++
|
NWNXLib/API/Mac/API/ZSTD_optimal_t.hpp
|
Qowyn/unified
|
149d0b7670a9d156e64555fe0bd7715423db4c2a
|
[
"MIT"
] | null | null | null |
NWNXLib/API/Mac/API/ZSTD_optimal_t.hpp
|
Qowyn/unified
|
149d0b7670a9d156e64555fe0bd7715423db4c2a
|
[
"MIT"
] | null | null | null |
NWNXLib/API/Mac/API/ZSTD_optimal_t.hpp
|
Qowyn/unified
|
149d0b7670a9d156e64555fe0bd7715423db4c2a
|
[
"MIT"
] | null | null | null |
#pragma once
#include <cstdint>
namespace NWNXLib {
namespace API {
struct ZSTD_optimal_t
{
int32_t price;
uint32_t off;
uint32_t mlen;
uint32_t litlen;
uint32_t rep[3];
};
}
}
| 9.666667
| 21
| 0.655172
|
Qowyn
|
e7718931c7603c0a13a9f82cce8c46501ba41d49
| 2,006
|
hpp
|
C++
|
modules/wechat_qrcode/src/zxing/qrcode/decoder/qrcode_decoder_metadata.hpp
|
ptelang/opencv_contrib
|
dd68e396c76f1db4d82e5aa7a6545580939f9b9d
|
[
"Apache-2.0"
] | 7,158
|
2016-07-04T22:19:27.000Z
|
2022-03-31T07:54:32.000Z
|
modules/wechat_qrcode/src/zxing/qrcode/decoder/qrcode_decoder_metadata.hpp
|
ptelang/opencv_contrib
|
dd68e396c76f1db4d82e5aa7a6545580939f9b9d
|
[
"Apache-2.0"
] | 2,184
|
2016-07-05T12:04:14.000Z
|
2022-03-30T19:10:12.000Z
|
modules/wechat_qrcode/src/zxing/qrcode/decoder/qrcode_decoder_metadata.hpp
|
ptelang/opencv_contrib
|
dd68e396c76f1db4d82e5aa7a6545580939f9b9d
|
[
"Apache-2.0"
] | 5,535
|
2016-07-06T12:01:10.000Z
|
2022-03-31T03:13:24.000Z
|
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Tencent is pleased to support the open source community by making WeChat QRCode available.
// Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
//
// Modified from ZXing. Copyright ZXing authors.
// Licensed under the Apache License, Version 2.0 (the "License").
#ifndef __ZXING_QRCODE_DECODER_QRCODEDECODERMETADATA_HPP__
#define __ZXING_QRCODE_DECODER_QRCODEDECODERMETADATA_HPP__
#include "../../common/array.hpp"
#include "../../common/counted.hpp"
#include "../../resultpoint.hpp"
// VC++
// The main class which implements QR Code decoding -- as opposed to locating
// and extracting the QR Code from an image.
namespace zxing {
namespace qrcode {
/**
* Meta-data container for QR Code decoding. Instances of this class may be used
* to convey information back to the decoding caller. Callers are expected to
* process this.
*
* @see com.google.zxing.common.DecoderResult#getOther()
*/
class QRCodeDecoderMetaData : public Counted {
private:
bool mirrored_;
public:
explicit QRCodeDecoderMetaData(bool mirrored) : mirrored_(mirrored) {}
public:
/**
* @return true if the QR Code was mirrored.
*/
bool isMirrored() { return mirrored_; };
/**
* Apply the result points' order correction due to mirroring.
*
* @param points Array of points to apply mirror correction to.
*/
void applyMirroredCorrection(ArrayRef<Ref<ResultPoint> >& points) {
if (!mirrored_ || points->size() < 3) {
return;
}
Ref<ResultPoint> bottomLeft = points[0];
points[0] = points[2];
points[2] = bottomLeft;
// No need to 'fix' top-left and alignment pattern.
};
};
} // namespace qrcode
} // namespace zxing
#endif // __ZXING_QRCODE_DECODER_QRCODEDECODERMETADATA_HPP__
| 30.861538
| 93
| 0.699402
|
ptelang
|
e7734fb36b4dc0a8e8a6182b63aceab7658aa031
| 210
|
cpp
|
C++
|
src/Gui.cpp
|
gw2-addon-loader/example_addon
|
fe363ac31f174ca87ff1f93c74107c95d95f2acf
|
[
"MIT"
] | 2
|
2020-08-17T17:33:23.000Z
|
2021-02-23T01:35:28.000Z
|
src/Gui.cpp
|
gw2-addon-loader/example_addon
|
fe363ac31f174ca87ff1f93c74107c95d95f2acf
|
[
"MIT"
] | null | null | null |
src/Gui.cpp
|
gw2-addon-loader/example_addon
|
fe363ac31f174ca87ff1f93c74107c95d95f2acf
|
[
"MIT"
] | 1
|
2021-02-07T06:59:45.000Z
|
2021-02-07T06:59:45.000Z
|
#include "stdafx.h"
void Gui::init()
{
//CHANGE ME
}
void Gui::draw()
{
//CHANGE ME
ImGui::Begin("Hello world window");
ImGui::Text("Hello world!");
ImGui::End();
}
void Gui::deinit()
{
//CHANGE ME
}
| 10
| 36
| 0.6
|
gw2-addon-loader
|
e77a18b8dec6bc29bf8852e6ccd3dc02905ad0eb
| 2,977
|
cpp
|
C++
|
OfficeAutomation/OfficeDoc.cpp
|
anboto/Anboto
|
fc40730e87b85bba4d9387724fcece7e98069843
|
[
"Apache-2.0"
] | 8
|
2021-02-28T12:07:43.000Z
|
2021-11-14T19:40:45.000Z
|
OfficeAutomation/OfficeDoc.cpp
|
anboto/Anboto
|
fc40730e87b85bba4d9387724fcece7e98069843
|
[
"Apache-2.0"
] | 8
|
2021-03-20T10:46:58.000Z
|
2022-01-27T19:50:32.000Z
|
OfficeAutomation/OfficeDoc.cpp
|
anboto/Anboto
|
fc40730e87b85bba4d9387724fcece7e98069843
|
[
"Apache-2.0"
] | 1
|
2021-08-20T09:15:18.000Z
|
2021-08-20T09:15:18.000Z
|
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 - 2021, the Anboto author and contributors
#ifdef _WIN32
#include <Core/Core.h>
using namespace Upp;
#include <Functions4U/Functions4U.h>
#include "OfficeAutomation.h"
#include "OfficeAutomationBase.h"
OfficeDoc::OfficeDoc() {
Ole::Init();
}
OfficeDoc::~OfficeDoc() {
Ole::Close();
}
bool OfficeDoc::Init(const char *name) {
return PluginInit(*this, name);
}
bool DocPlugin::IsAvailable() {return false;}
bool OfficeDoc::IsAvailable(const char *_name) {
for (int i = 0; i < Plugins().GetCount(); ++i) {
if (Plugins()[i].name == _name && Plugins()[i].type == typeid(OfficeDoc).name()) {
void *dat = Plugins()[i].New();
if (!dat)
return false;
bool ret = (static_cast<DocPlugin *>(dat))->IsAvailable();
Plugins()[i].Delete(dat);
return ret;
}
}
return false;
}
bool DocPlugin::AddDoc(bool visible) {return false;}
bool OfficeDoc::AddDoc(bool visible) {return (static_cast<DocPlugin *>(GetData()))->AddDoc(visible);}
bool DocPlugin::OpenDoc(String fileName, bool visible) {return false;}
bool OfficeDoc::OpenDoc(String fileName, bool visible) {return (static_cast<DocPlugin *>(GetData()))->OpenDoc(fileName, visible);}
bool DocPlugin::SetFont(String font, int size) {return false;}
bool OfficeDoc::SetFont(String font, int size) {return (static_cast<DocPlugin *>(GetData()))->SetFont(font, size);}
bool DocPlugin::SetBold(bool bold) {return false;}
bool OfficeDoc::SetBold(bool bold) {return (static_cast<DocPlugin *>(GetData()))->SetBold(bold);}
bool DocPlugin::SetItalic(bool italic) {return false;}
bool OfficeDoc::SetItalic(bool italic) {return (static_cast<DocPlugin *>(GetData()))->SetItalic(italic);}
bool DocPlugin::WriteText(String value) {return false;}
bool OfficeDoc::WriteText(String value) {return (static_cast<DocPlugin *>(GetData()))->WriteText(value);}
bool DocPlugin::Select() {return false;}
bool OfficeDoc::Select() {return (static_cast<DocPlugin *>(GetData()))->Select();}
bool DocPlugin::EnableCommandVars(bool) {return false;}
bool OfficeDoc::EnableCommandVars(bool enable) {return (static_cast<DocPlugin *>(GetData()))->EnableCommandVars(enable);}
bool DocPlugin::Replace(String search, String replace) {return false;}
bool OfficeDoc::Replace(String search, String replace) {return (static_cast<DocPlugin *>(GetData()))->Replace(search, replace);}
bool DocPlugin::Print() {return false;}
bool OfficeDoc::Print() {return (static_cast<DocPlugin *>(GetData()))->Print();}
bool DocPlugin::SaveAs(String fileName, String _type) {return false;}
bool OfficeDoc::SaveAs(String fileName, String _type) {return (static_cast<DocPlugin *>(GetData()))->SaveAs(fileName, _type);}
bool DocPlugin::Quit() {return false;}
bool OfficeDoc::Quit() {return (static_cast<DocPlugin *>(GetData()))->Quit();}
bool DocPlugin::SetSaved(bool saved) {return false;}
bool OfficeDoc::SetSaved(bool saved) {return (static_cast<DocPlugin *>(GetData()))->SetSaved(saved);}
#endif
| 36.753086
| 130
| 0.723547
|
anboto
|
e77c084654c918417dd4ed9fcde9b95cc2e98347
| 1,203
|
hpp
|
C++
|
framework/Shape.hpp
|
Snoopyxxel/programmiersprachen-raytracer
|
243765de0e5814cb20930046f6fc14a9faf87e49
|
[
"MIT"
] | null | null | null |
framework/Shape.hpp
|
Snoopyxxel/programmiersprachen-raytracer
|
243765de0e5814cb20930046f6fc14a9faf87e49
|
[
"MIT"
] | null | null | null |
framework/Shape.hpp
|
Snoopyxxel/programmiersprachen-raytracer
|
243765de0e5814cb20930046f6fc14a9faf87e49
|
[
"MIT"
] | null | null | null |
#ifndef RAYTRACER_SHAPE_HPP
#define RAYTRACER_SHAPE_HPP
#include <string>
#include <ostream>
#include "color.hpp"
#include "ray.hpp"
#include "hitpoint.hpp"
#include <glm/vec3.hpp>
#include <glm/glm.hpp>
#include <memory>
class Shape {
public:
Shape();
Shape(std::string const &name, std::shared_ptr<Material> const& material);
virtual float area() const = 0;
virtual float volume() const = 0;
friend std::ostream &operator<<(std::ostream &os, const Shape &shape);
virtual HitPoint intersect(Ray const& ray) const = 0;
virtual std::ostream& print(std::ostream &os = std::cout) const;
virtual glm::vec3 normal(glm::vec3 const& p) const = 0; //point has to be on the object!
void scale(float x,float y,float z);
void translate(float x,float y,float z);
void rotate(float angle,float x,float y,float z);
const glm::mat4 &getWorldTransformation() const;
const glm::mat4 &getWorldTransformationInv() const;
std::string get_name() const;
protected:
std::string name_;
std::shared_ptr<Material> material_;
glm::mat4 world_transformation_;
glm::mat4 world_transformation_inv_;
};
#endif //RAYTRACER_SHAPE_HPP
| 22.277778
| 94
| 0.689111
|
Snoopyxxel
|
e782f9f1e521157b6ee1fde87099d877ac318ba0
| 2,433
|
cpp
|
C++
|
src/fileinfo/file_information/file_information_types/relocation_table/relocation.cpp
|
lukasdurfina/retdec
|
7d6b8882690ff73c2bd7f209db10c5c091fa0359
|
[
"MIT",
"Zlib",
"BSD-3-Clause"
] | 1
|
2020-03-28T02:38:53.000Z
|
2020-03-28T02:38:53.000Z
|
src/fileinfo/file_information/file_information_types/relocation_table/relocation.cpp
|
lukasdurfina/retdec
|
7d6b8882690ff73c2bd7f209db10c5c091fa0359
|
[
"MIT",
"Zlib",
"BSD-3-Clause"
] | null | null | null |
src/fileinfo/file_information/file_information_types/relocation_table/relocation.cpp
|
lukasdurfina/retdec
|
7d6b8882690ff73c2bd7f209db10c5c091fa0359
|
[
"MIT",
"Zlib",
"BSD-3-Clause"
] | null | null | null |
/**
* @file src/fileinfo/file_information/file_information_types/relocation_table/relocation.cpp
* @brief Class for one relocation.
* @copyright (c) 2017 Avast Software, licensed under the MIT license
*/
#include "fileinfo/file_information/file_information_types/relocation_table/relocation.h"
#include "fileinfo/file_information/file_information_types/type_conversions.h"
namespace fileinfo {
/**
* Get name of associated symbol
* @return Name of associated symbol
*/
std::string Relocation::getSymbolName() const
{
return symbolName;
}
/**
* Get relocation offset
* @param format Format of result (e.g. std::dec, std::hex)
* @return Relocation offset
*/
std::string Relocation::getOffsetStr(std::ios_base &(* format)(std::ios_base &)) const
{
return getNumberAsString(offset, format);
}
/**
* Get value of associated symbol
* @return Value of associated symbol
*/
std::string Relocation::getSymbolValueStr() const
{
return getNumberAsString(symbolValue);
}
/**
* Get relocation type
* @return Type of relocation
*/
std::string Relocation::getRelocationTypeStr() const
{
return getNumberAsString(relocationType);
}
/**
* Get relocation addend
* @return Relocation addend
*/
std::string Relocation::getAddendStr() const
{
return getNumberAsString(addend);
}
/**
* Get calculated value
* @return Calculated value
*/
std::string Relocation::getCalculatedValueStr() const
{
return getNumberAsString(calculatedValue);
}
/**
* Set name of associated symbol
* @param name Name of symbol associated with relocation
*/
void Relocation::setSymbolName(std::string name)
{
symbolName = name;
}
/**
* Set relocation offset
* @param value Relocation offset
*/
void Relocation::setOffset(unsigned long long value)
{
offset = value;
}
/**
* Set value of symbol associated with relocation
* @param value Value of symbol associated with relocation
*/
void Relocation::setSymbolValue(unsigned long long value)
{
symbolValue = value;
}
/**
* Set type of relocation
* @param type Type of relocation
*/
void Relocation::setRelocationType(unsigned long long type)
{
relocationType = type;
}
/**
* Set relocation addend
* @param value Relocation addend
*/
void Relocation::setAddend(long long value)
{
addend = value;
}
/**
* Set calculated value
* @param value Calculated value
*/
void Relocation::setCalculatedValue(long long value)
{
calculatedValue = value;
}
} // namespace fileinfo
| 19.942623
| 93
| 0.738594
|
lukasdurfina
|
e787c3be6020b2f1bf44daf0bdeec433ebfce663
| 497
|
cpp
|
C++
|
Answer/ans_code_and_note/chapter3/test.cpp
|
seanleecn/EssentialCPP
|
a2cfbd054888a3d07cb0ac22230c34f6ce90bef5
|
[
"MIT"
] | null | null | null |
Answer/ans_code_and_note/chapter3/test.cpp
|
seanleecn/EssentialCPP
|
a2cfbd054888a3d07cb0ac22230c34f6ce90bef5
|
[
"MIT"
] | null | null | null |
Answer/ans_code_and_note/chapter3/test.cpp
|
seanleecn/EssentialCPP
|
a2cfbd054888a3d07cb0ac22230c34f6ce90bef5
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
bool myfunction(string i, string j)
{
return (i.length() < j.length());
}
int main(void)
{
string myints[] = {"hello", "world", "i", "love"};
vector<string> myvec(myints, myints + 4);
sort(myvec.begin(), myvec.end(), myfunction);
for (vector<string>::iterator it = myvec.begin(); it != myvec.end(); ++it) {
cout << ' ' << *it;
}
cout << endl;
return 0;
}
| 19.88
| 80
| 0.583501
|
seanleecn
|
e788b039eddcd475e3c855784a2810e79f4ca023
| 1,088
|
cpp
|
C++
|
LeetCode Problem-Set/42. Trapping Rain Water (Hard)/Solution1.cpp
|
ankuralld5999/LeetCode-Problems
|
2f9a767a0effbb2a50672e102925fbbb65034083
|
[
"FSFAP"
] | 2
|
2021-01-06T20:43:59.000Z
|
2021-01-11T15:42:59.000Z
|
LeetCode Problem-Set/42. Trapping Rain Water (Hard)/Solution1.cpp
|
ankuralld5999/LeetCode-Problems
|
2f9a767a0effbb2a50672e102925fbbb65034083
|
[
"FSFAP"
] | null | null | null |
LeetCode Problem-Set/42. Trapping Rain Water (Hard)/Solution1.cpp
|
ankuralld5999/LeetCode-Problems
|
2f9a767a0effbb2a50672e102925fbbb65034083
|
[
"FSFAP"
] | null | null | null |
// OJ: https://leetcode.com/problems/trapping-rain-water/
// Author: github.com/lzl124631x
// Time: O(N)
// Space: O(N)
class Solution {
public:
int trap(vector<int>& A) {
int N = A.size(), ans = 0;
vector<int> left(N, 0), right(N, 0);
for (int i = 1; i < N; ++i)
left[i] = max(left[i - 1], A[i - 1]);
for (int i = N - 2; i >= 0; --i)
right[i] = max(right[i + 1], A[i + 1]);
for (int i = 1; i < N - 1; ++i)
ans += max(0, min(left[i], right[i]) - A[i]);
return ans;
}
};
//Or
// Problem: https://leetcode.com/problems/trapping-rain-water/
// Author: github.com/ankuralld5999
// Time: O(N)
// Space: O(N)
class Solution {
public:
int trap(vector<int>& A) {
int N = A.size(), ans = 0, mx = 0, left = 0;
vector<int> right(N);
for (int i = N - 2; i >= 0; --i) right[i] = max(right[i + 1], A[i + 1]);
for (int i = 0; i < N; ++i) {
ans += max(0, min(left, right[i]) - A[i]);
left = max(left, A[i]);
}
return ans;
}
};
| 27.897436
| 80
| 0.463235
|
ankuralld5999
|
e788ea11cc54794e66f0671dad22a3a6197f3711
| 29,399
|
cpp
|
C++
|
src/VkRenderer/SceneObject.cpp
|
WubiCookie/VkRenderer
|
87cc5d858591fc976c197ab2834e1ac9a418becd
|
[
"MIT"
] | 2
|
2020-05-31T19:54:19.000Z
|
2021-09-14T12:00:12.000Z
|
src/VkRenderer/SceneObject.cpp
|
WubiCookie/VkRenderer
|
87cc5d858591fc976c197ab2834e1ac9a418becd
|
[
"MIT"
] | null | null | null |
src/VkRenderer/SceneObject.cpp
|
WubiCookie/VkRenderer
|
87cc5d858591fc976c197ab2834e1ac9a418becd
|
[
"MIT"
] | null | null | null |
#include "SceneObject.hpp"
#include "CommandBuffer.hpp"
#include "Material.hpp"
#include "RenderWindow.hpp"
#include "Scene.hpp"
#include "StandardMesh.hpp"
#include <iostream>
namespace cdm
{
SceneObject::Pipeline::Pipeline(Scene& s, StandardMesh& mesh,
MaterialInterface& material,
VkRenderPass renderPass)
: scene(&s),
mesh(&mesh),
material(&material),
renderPass(renderPass)
{
auto& rw = material.material().renderWindow();
auto& vk = rw.device();
#pragma region vertexShader
{
using namespace sdw;
VertexWriter writer;
Scene::SceneUbo sceneUbo(writer);
Scene::ModelUbo modelUbo(writer);
Scene::ModelPcb modelPcb(writer);
auto shaderVertexInput = mesh.shaderVertexInput(writer);
auto fragPosition = writer.declOutput<Vec3>("fragPosition", 0);
auto fragUV = writer.declOutput<Vec2>("fragUV", 1);
auto fragNormal = writer.declOutput<Vec3>("fragNormal", 2);
auto fragTangent = writer.declOutput<Vec3>("fragTangent", 3);
auto fragDistance = writer.declOutput<sdw::Float>("fragDistance", 4);
auto out = writer.getOut();
auto materialVertexShaderBuildData =
material.material().instantiateVertexShaderBuildData();
auto materialVertexFunction = material.material().vertexFunction(
writer, materialVertexShaderBuildData.get());
writer.implementMain([&]() {
auto model = modelUbo.getModel()[modelPcb.getModelId()];
auto view = sceneUbo.getView();
auto proj = sceneUbo.getProj();
fragPosition =
(model * vec4(shaderVertexInput.inPosition, 1.0_f)).xyz();
fragUV = shaderVertexInput.inUV;
Locale(model3, mat3(vec3(model[0][0], model[0][1], model[0][2]),
vec3(model[1][0], model[1][1], model[1][2]),
vec3(model[2][0], model[2][1], model[2][2])));
Locale(normalMatrix, transpose(inverse(model3)));
// Locale(normalMatrix, transpose((model3)));
fragNormal = shaderVertexInput.inNormal;
materialVertexFunction(fragPosition, fragNormal);
fragNormal = normalize(normalMatrix * fragNormal);
fragTangent =
normalize(normalMatrix * shaderVertexInput.inTangent);
// fragNormal = normalize((model * vec4(fragNormal, 0.0_f)).xyz());
// fragTangent = normalize(
// (model * vec4(shaderVertexInput.inTangent, 0.0_f)).xyz());
fragTangent = normalize(fragTangent -
dot(fragTangent, fragNormal) * fragNormal);
// Locale(B, cross(fragNormal, fragTangent));
// Locale(TBN, transpose(mat3(fragTangent, B, fragNormal)));
// fragTanLightPos = TBN * sceneUbo.getLightPos();
// fragTanViewPos = TBN * sceneUbo.getViewPos();
// fragTanFragPos = TBN * fragPosition;
fragDistance =
(view * model * vec4(shaderVertexInput.inPosition, 1.0_f)).z();
out.vtx.position = proj * view * model *
vec4(shaderVertexInput.inPosition, 1.0_f);
});
std::vector<uint32_t> bytecode =
spirv::serialiseSpirv(writer.getShader());
vk::ShaderModuleCreateInfo createInfo;
createInfo.codeSize = bytecode.size() * sizeof(*bytecode.data());
createInfo.pCode = bytecode.data();
vertexModule = vk.create(createInfo);
if (!vertexModule)
{
std::cerr << "error: failed to create vertex shader module"
<< std::endl;
abort();
}
}
#pragma endregion
#pragma region fragmentShader
{
using namespace sdw;
FragmentWriter writer;
Scene::SceneUbo sceneUbo(writer);
Scene::ModelPcb modelPcb(writer);
auto fragPosition = writer.declInput<sdw::Vec3>("fragPosition", 0);
auto fragUV = writer.declInput<sdw::Vec2>("fragUV", 1);
auto fragNormal = writer.declInput<sdw::Vec3>("fragNormal", 2);
auto fragTangent = writer.declInput<sdw::Vec3>("fragTangent", 3);
auto fragDistance = writer.declInput<sdw::Float>("fragDistance", 4);
auto fragColor = writer.declOutput<Vec4>("fragColor", 0);
auto fragID = writer.declOutput<UInt>("fragID", 1);
auto fragNormalDepth = writer.declOutput<Vec4>("fragNormalDepth", 2);
auto fragPos = writer.declOutput<Vec3>("fragPos", 3);
auto fragmentShaderBuildData =
material.material().instantiateFragmentShaderBuildData();
auto materialFragmentFunction = material.material().fragmentFunction(
writer, fragmentShaderBuildData.get());
auto shadingModelFragmentShaderBuildData =
material.material()
.shadingModel()
.instantiateFragmentShaderBuildData();
auto combinedMaterialFragmentFunction =
material.material()
.shadingModel()
.combinedMaterialFragmentFunction(
writer, materialFragmentFunction,
shadingModelFragmentShaderBuildData.get(), sceneUbo);
writer.implementMain([&]() {
Locale(materialInstanceId, modelPcb.getMaterialInstanceId() + 1_u);
materialInstanceId -= 1_u;
Locale(normal, normalize(fragNormal));
Locale(tangent, normalize(fragTangent));
fragColor = combinedMaterialFragmentFunction(
materialInstanceId, fragPosition, fragUV, normal, tangent);
fragID = modelPcb.getModelId();
fragNormalDepth.xyz() = fragNormal;
fragNormalDepth.w() = fragDistance;
fragPos = fragPosition;
});
std::vector<uint32_t> bytecode =
spirv::serialiseSpirv(writer.getShader());
vk::ShaderModuleCreateInfo createInfo;
createInfo.codeSize = bytecode.size() * sizeof(*bytecode.data());
createInfo.pCode = bytecode.data();
fragmentModule = vk.create(createInfo);
if (!fragmentModule)
{
std::cerr << "error: failed to create fragment shader module"
<< std::endl;
abort();
}
}
#pragma endregion
#pragma region pipeline layout
VkPushConstantRange pcRange{};
pcRange.size = sizeof(PcbStruct);
pcRange.stageFlags =
VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT;
std::array descriptorSetLayouts{
scene.get()->descriptorSetLayout(),
material.material().shadingModel().m_descriptorSetLayout.get(),
material.material().descriptorSetLayout(),
};
vk::PipelineLayoutCreateInfo pipelineLayoutInfo;
pipelineLayoutInfo.setLayoutCount = uint32_t(descriptorSetLayouts.size());
pipelineLayoutInfo.pSetLayouts = descriptorSetLayouts.data();
// pipelineLayoutInfo.setLayoutCount = 0;
// pipelineLayoutInfo.pSetLayouts = nullptr;
pipelineLayoutInfo.pushConstantRangeCount = 1;
pipelineLayoutInfo.pPushConstantRanges = &pcRange;
// pipelineLayoutInfo.pushConstantRangeCount = 0;
// pipelineLayoutInfo.pPushConstantRanges = nullptr;
pipelineLayout = vk.create(pipelineLayoutInfo);
if (!pipelineLayout)
{
std::cerr << "error: failed to create pipeline layout" << std::endl;
abort();
}
#pragma endregion
#pragma region pipeline
vk::PipelineShaderStageCreateInfo vertShaderStageInfo;
vertShaderStageInfo.stage = VK_SHADER_STAGE_VERTEX_BIT;
vertShaderStageInfo.module = vertexModule;
vertShaderStageInfo.pName = "main";
vk::PipelineShaderStageCreateInfo fragShaderStageInfo;
fragShaderStageInfo.stage = VK_SHADER_STAGE_FRAGMENT_BIT;
fragShaderStageInfo.module = fragmentModule;
fragShaderStageInfo.pName = "main";
std::array shaderStages = { vertShaderStageInfo, fragShaderStageInfo };
auto vertexInputState = mesh.vertexInputState();
vk::PipelineInputAssemblyStateCreateInfo inputAssembly;
inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
// inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
inputAssembly.primitiveRestartEnable = false;
VkViewport viewport = {};
viewport.x = 0.0f;
viewport.y = 0.0f;
/// TODO get from render pass
viewport.width = float(1280);
viewport.height = float(720);
viewport.minDepth = 0.0f;
viewport.maxDepth = 1.0f;
VkRect2D scissor = {};
scissor.offset = { 0, 0 };
/// TODO get from render pass
scissor.extent.width = 1280;
scissor.extent.height = 720;
vk::PipelineViewportStateCreateInfo viewportState;
viewportState.viewportCount = 1;
viewportState.pViewports = &viewport;
viewportState.scissorCount = 1;
viewportState.pScissors = &scissor;
vk::PipelineRasterizationStateCreateInfo rasterizer;
rasterizer.depthClampEnable = false;
rasterizer.rasterizerDiscardEnable = false;
rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
// rasterizer.polygonMode = VK_POLYGON_MODE_LINE;
rasterizer.lineWidth = 1.0f;
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
rasterizer.depthBiasEnable = false;
rasterizer.depthBiasConstantFactor = 0.0f;
rasterizer.depthBiasClamp = 0.0f;
rasterizer.depthBiasSlopeFactor = 0.0f;
/// TODO get from render pass
vk::PipelineMultisampleStateCreateInfo multisampling;
multisampling.sampleShadingEnable = false;
multisampling.rasterizationSamples = VK_SAMPLE_COUNT_4_BIT;
multisampling.minSampleShading = 1.0f;
multisampling.pSampleMask = nullptr;
multisampling.alphaToCoverageEnable = false;
multisampling.alphaToOneEnable = false;
/// TODO get from render pass and material
VkPipelineColorBlendAttachmentState colorBlendAttachment = {};
colorBlendAttachment.colorWriteMask =
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
colorBlendAttachment.blendEnable = false;
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
// colorBlendAttachment.blendEnable = true;
// colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
// colorBlendAttachment.dstColorBlendFactor =
// VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
// colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
// colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
// colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
// colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
/// TODO get from render pass and material
VkPipelineColorBlendAttachmentState objectIDBlendAttachment = {};
objectIDBlendAttachment.colorWriteMask =
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
objectIDBlendAttachment.blendEnable = false;
objectIDBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
objectIDBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
objectIDBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
objectIDBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
objectIDBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
objectIDBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
VkPipelineColorBlendAttachmentState normalDepthBlendAttachment = {};
normalDepthBlendAttachment.colorWriteMask =
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
normalDepthBlendAttachment.blendEnable = false;
normalDepthBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
normalDepthBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
normalDepthBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
normalDepthBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
normalDepthBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
normalDepthBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
VkPipelineColorBlendAttachmentState positionhBlendAttachment = {};
positionhBlendAttachment.colorWriteMask =
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
positionhBlendAttachment.blendEnable = false;
positionhBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
positionhBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
positionhBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
positionhBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
positionhBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
positionhBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
// colorHDRBlendAttachment.blendEnable = true;
// colorHDRBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
// colorHDRBlendAttachment.dstColorBlendFactor =
// VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
// colorHDRBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
// colorHDRBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
// colorHDRBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
// colorHDRBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
std::array colorBlendAttachments{ colorBlendAttachment,
objectIDBlendAttachment,
normalDepthBlendAttachment,
positionhBlendAttachment };
/// TODO get from render pass
vk::PipelineColorBlendStateCreateInfo colorBlending;
colorBlending.logicOpEnable = false;
colorBlending.logicOp = VK_LOGIC_OP_COPY;
colorBlending.attachmentCount = uint32_t(colorBlendAttachments.size());
colorBlending.pAttachments = colorBlendAttachments.data();
colorBlending.blendConstants[0] = 0.0f;
colorBlending.blendConstants[1] = 0.0f;
colorBlending.blendConstants[2] = 0.0f;
colorBlending.blendConstants[3] = 0.0f;
vk::PipelineDepthStencilStateCreateInfo depthStencil;
depthStencil.depthTestEnable = true;
depthStencil.depthWriteEnable = true;
depthStencil.depthCompareOp = VK_COMPARE_OP_LESS;
depthStencil.depthBoundsTestEnable = false;
depthStencil.minDepthBounds = 0.0f; // Optional
depthStencil.maxDepthBounds = 1.0f; // Optional
depthStencil.stencilTestEnable = false;
// depthStencil.front; // Optional
// depthStencil.back; // Optional
std::array dynamicStates = {
VK_DYNAMIC_STATE_VIEWPORT,
VK_DYNAMIC_STATE_SCISSOR,
};
vk::PipelineDynamicStateCreateInfo dynamicState;
dynamicState.dynamicStateCount = uint32_t(dynamicStates.size());
dynamicState.pDynamicStates = dynamicStates.data();
vk::GraphicsPipelineCreateInfo pipelineInfo;
pipelineInfo.stageCount = uint32_t(shaderStages.size());
pipelineInfo.pStages = shaderStages.data();
pipelineInfo.pVertexInputState = &vertexInputState.vertexInputInfo;
pipelineInfo.pInputAssemblyState = &inputAssembly;
pipelineInfo.pViewportState = &viewportState;
pipelineInfo.pRasterizationState = &rasterizer;
pipelineInfo.pMultisampleState = &multisampling;
pipelineInfo.pDepthStencilState = &depthStencil;
pipelineInfo.pColorBlendState = &colorBlending;
pipelineInfo.pDynamicState = &dynamicState;
pipelineInfo.layout = pipelineLayout;
pipelineInfo.renderPass = renderPass;
pipelineInfo.subpass = 0;
pipelineInfo.basePipelineHandle = nullptr;
pipelineInfo.basePipelineIndex = -1;
pipeline = vk.create(pipelineInfo);
if (!pipeline)
{
std::cerr << "error: failed to create graphics pipeline" << std::endl;
abort();
}
#pragma endregion
}
void SceneObject::Pipeline::bindPipeline(CommandBuffer& cb)
{
cb.bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
}
void SceneObject::Pipeline::bindDescriptorSet(CommandBuffer& cb)
{
std::array<VkDescriptorSet, 3> descriptorSets{
scene.get()->descriptorSet(),
material.get()->material().shadingModel().m_descriptorSet,
material.get()->material().descriptorSet(),
};
cb.bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0,
uint32_t(descriptorSets.size()),
descriptorSets.data());
}
void SceneObject::Pipeline::draw(CommandBuffer& cb) { mesh.get()->draw(cb); }
SceneObject::ShadowmapPipeline::ShadowmapPipeline(Scene& s, StandardMesh& mesh,
MaterialInterface& material,
VkRenderPass renderPass)
: scene(&s),
mesh(&mesh),
material(&material),
renderPass(renderPass)
{
auto& rw = material.material().renderWindow();
auto& vk = rw.device();
#pragma region vertexShader
{
using namespace sdw;
VertexWriter writer;
Scene::SceneUbo sceneUbo(writer);
Scene::ModelUbo modelUbo(writer);
Scene::ModelPcb modelPcb(writer);
auto inPosition = writer.declInput<Vec4>("fragPosition", 0);
auto out = writer.getOut();
auto materialVertexShaderBuildData =
material.material().instantiateVertexShaderBuildData();
auto materialVertexFunction = material.material().vertexFunction(
writer, materialVertexShaderBuildData.get());
writer.implementMain([&]() {
auto model = modelUbo.getModel()[modelPcb.getModelId()];
auto view = sceneUbo.getShadowView();
auto proj = sceneUbo.getShadowProj();
out.vtx.position = proj * view * model * inPosition;
});
std::vector<uint32_t> bytecode =
spirv::serialiseSpirv(writer.getShader());
vk::ShaderModuleCreateInfo createInfo;
createInfo.codeSize = bytecode.size() * sizeof(*bytecode.data());
createInfo.pCode = bytecode.data();
vertexModule = vk.create(createInfo);
if (!vertexModule)
{
std::cerr << "error: failed to create vertex shader module"
<< std::endl;
abort();
}
}
#pragma endregion
#pragma region fragmentShader
{
using namespace sdw;
FragmentWriter writer;
writer.implementMain([&]() {
});
std::vector<uint32_t> bytecode =
spirv::serialiseSpirv(writer.getShader());
vk::ShaderModuleCreateInfo createInfo;
createInfo.codeSize = bytecode.size() * sizeof(*bytecode.data());
createInfo.pCode = bytecode.data();
fragmentModule = vk.create(createInfo);
if (!fragmentModule)
{
std::cerr << "error: failed to create fragment shader module"
<< std::endl;
abort();
}
}
#pragma endregion
#pragma region pipeline layout
VkPushConstantRange pcRange{};
pcRange.size = sizeof(PcbStruct);
pcRange.stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
std::array descriptorSetLayouts{
scene.get()->descriptorSetLayout(),
material.material().shadingModel().m_descriptorSetLayout.get(),
material.material().descriptorSetLayout(),
};
vk::PipelineLayoutCreateInfo pipelineLayoutInfo;
pipelineLayoutInfo.setLayoutCount = uint32_t(descriptorSetLayouts.size());
pipelineLayoutInfo.pSetLayouts = descriptorSetLayouts.data();
// pipelineLayoutInfo.setLayoutCount = 0;
// pipelineLayoutInfo.pSetLayouts = nullptr;
pipelineLayoutInfo.pushConstantRangeCount = 1;
pipelineLayoutInfo.pPushConstantRanges = &pcRange;
// pipelineLayoutInfo.pushConstantRangeCount = 0;
// pipelineLayoutInfo.pPushConstantRanges = nullptr;
pipelineLayout = vk.create(pipelineLayoutInfo);
if (!pipelineLayout)
{
std::cerr << "error: failed to create pipeline layout" << std::endl;
abort();
}
#pragma endregion
#pragma region pipeline
vk::PipelineShaderStageCreateInfo vertShaderStageInfo;
vertShaderStageInfo.stage = VK_SHADER_STAGE_VERTEX_BIT;
vertShaderStageInfo.module = vertexModule;
vertShaderStageInfo.pName = "main";
vk::PipelineShaderStageCreateInfo fragShaderStageInfo;
fragShaderStageInfo.stage = VK_SHADER_STAGE_FRAGMENT_BIT;
fragShaderStageInfo.module = fragmentModule;
fragShaderStageInfo.pName = "main";
std::array shaderStages = { vertShaderStageInfo, fragShaderStageInfo };
VertexInputState vertexInputState = mesh.positionOnlyVertexInputState();
vk::PipelineInputAssemblyStateCreateInfo inputAssembly;
inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
// inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
inputAssembly.primitiveRestartEnable = false;
VkViewport viewport = {};
viewport.x = 0.0f;
viewport.y = 0.0f;
/// TODO get from render pass
viewport.width = float(1280);
viewport.height = float(720);
viewport.minDepth = 0.0f;
viewport.maxDepth = 1.0f;
VkRect2D scissor = {};
scissor.offset = { 0, 0 };
/// TODO get from render pass
scissor.extent.width = 1280;
scissor.extent.height = 720;
vk::PipelineViewportStateCreateInfo viewportState;
viewportState.viewportCount = 1;
viewportState.pViewports = &viewport;
viewportState.scissorCount = 1;
viewportState.pScissors = &scissor;
vk::PipelineRasterizationStateCreateInfo rasterizer;
rasterizer.depthClampEnable = false;
rasterizer.rasterizerDiscardEnable = false;
rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
// rasterizer.polygonMode = VK_POLYGON_MODE_LINE;
rasterizer.lineWidth = 1.0f;
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
rasterizer.depthBiasEnable = false;
rasterizer.depthBiasConstantFactor = 0.0f;
rasterizer.depthBiasClamp = 0.0f;
rasterizer.depthBiasSlopeFactor = 0.0f;
/// TODO get from render pass
vk::PipelineMultisampleStateCreateInfo multisampling;
multisampling.sampleShadingEnable = false;
multisampling.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
multisampling.minSampleShading = 1.0f;
multisampling.pSampleMask = nullptr;
multisampling.alphaToCoverageEnable = false;
multisampling.alphaToOneEnable = false;
/// TODO get from render pass and material
/*
VkPipelineColorBlendAttachmentState colorBlendAttachment = {};
colorBlendAttachment.colorWriteMask =
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
colorBlendAttachment.blendEnable = false;
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
// colorBlendAttachment.blendEnable = true;
// colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
// colorBlendAttachment.dstColorBlendFactor =
// VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
// colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
// colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
// colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
// colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
/// TODO get from render pass and material
VkPipelineColorBlendAttachmentState objectIDBlendAttachment = {};
objectIDBlendAttachment.colorWriteMask =
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
objectIDBlendAttachment.blendEnable = false;
objectIDBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
objectIDBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
objectIDBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
objectIDBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
objectIDBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
objectIDBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
// colorHDRBlendAttachment.blendEnable = true;
// colorHDRBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
// colorHDRBlendAttachment.dstColorBlendFactor =
// VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
// colorHDRBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
// colorHDRBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
// colorHDRBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
// colorHDRBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
std::array colorBlendAttachments{ colorBlendAttachment,
objectIDBlendAttachment };
//*/
/// TODO get from render pass
vk::PipelineColorBlendStateCreateInfo colorBlending;
colorBlending.logicOpEnable = false;
colorBlending.logicOp = VK_LOGIC_OP_COPY;
// colorBlending.attachmentCount = uint32_t(colorBlendAttachments.size());
// colorBlending.pAttachments = colorBlendAttachments.data();
colorBlending.attachmentCount = 0;
colorBlending.pAttachments = nullptr;
colorBlending.blendConstants[0] = 0.0f;
colorBlending.blendConstants[1] = 0.0f;
colorBlending.blendConstants[2] = 0.0f;
colorBlending.blendConstants[3] = 0.0f;
vk::PipelineDepthStencilStateCreateInfo depthStencil;
depthStencil.depthTestEnable = true;
depthStencil.depthWriteEnable = true;
depthStencil.depthCompareOp = VK_COMPARE_OP_LESS;
depthStencil.depthBoundsTestEnable = false;
depthStencil.minDepthBounds = 0.0f; // Optional
depthStencil.maxDepthBounds = 1.0f; // Optional
depthStencil.stencilTestEnable = false;
// depthStencil.front; // Optional
// depthStencil.back; // Optional
std::array dynamicStates = {
VK_DYNAMIC_STATE_VIEWPORT,
VK_DYNAMIC_STATE_SCISSOR,
};
vk::PipelineDynamicStateCreateInfo dynamicState;
dynamicState.dynamicStateCount = uint32_t(dynamicStates.size());
dynamicState.pDynamicStates = dynamicStates.data();
vk::GraphicsPipelineCreateInfo pipelineInfo;
pipelineInfo.stageCount = uint32_t(shaderStages.size());
pipelineInfo.pStages = shaderStages.data();
pipelineInfo.pVertexInputState = &vertexInputState.vertexInputInfo;
pipelineInfo.pInputAssemblyState = &inputAssembly;
pipelineInfo.pViewportState = &viewportState;
pipelineInfo.pRasterizationState = &rasterizer;
pipelineInfo.pMultisampleState = &multisampling;
pipelineInfo.pDepthStencilState = &depthStencil;
pipelineInfo.pColorBlendState = &colorBlending;
pipelineInfo.pDynamicState = &dynamicState;
pipelineInfo.layout = pipelineLayout;
pipelineInfo.renderPass = renderPass;
pipelineInfo.subpass = 0;
pipelineInfo.basePipelineHandle = nullptr;
pipelineInfo.basePipelineIndex = -1;
pipeline = vk.create(pipelineInfo);
if (!pipeline)
{
std::cerr << "error: failed to create graphics pipeline" << std::endl;
abort();
}
#pragma endregion
}
void SceneObject::ShadowmapPipeline::bindPipeline(CommandBuffer& cb)
{
cb.bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
}
void SceneObject::ShadowmapPipeline::bindDescriptorSet(CommandBuffer& cb)
{
std::array<VkDescriptorSet, 3> descriptorSets{
scene.get()->descriptorSet(),
material.get()->material().shadingModel().m_descriptorSet,
material.get()->material().descriptorSet(),
};
cb.bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0,
uint32_t(descriptorSets.size()),
descriptorSets.data());
}
void SceneObject::ShadowmapPipeline::draw(CommandBuffer& cb)
{
mesh.get()->drawPositions(cb);
}
SceneObject::SceneObject(Scene& s) : m_scene(&s) {}
void SceneObject::draw(CommandBuffer& cb, VkRenderPass renderPass,
std::optional<VkViewport> viewport,
std::optional<VkRect2D> scissor)
{
if (m_scene && m_mesh && m_material)
{
Pipeline* pipeline;
auto foundPipeline = m_pipelines.find(renderPass);
if (foundPipeline == m_pipelines.end())
{
auto it = m_pipelines
.insert(std::make_pair(
renderPass, Pipeline(*m_scene, *m_mesh,
*m_material, renderPass)))
.first;
pipeline = &it->second;
}
else
{
pipeline = &foundPipeline->second;
}
pipeline->bindPipeline(cb);
if (viewport.has_value())
cb.setViewport(viewport.value());
if (scissor.has_value())
cb.setScissor(scissor.value());
pipeline->bindDescriptorSet(cb);
PcbStruct pcbStruct;
pcbStruct.modelIndex = id;
pcbStruct.materialInstanceIndex = m_material.get()->index();
cb.pushConstants(
pipeline->pipelineLayout,
VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0,
&pcbStruct);
pipeline->draw(cb);
}
}
void SceneObject::drawShadowmapPass(CommandBuffer& cb, VkRenderPass renderPass,
std::optional<VkViewport> viewport,
std::optional<VkRect2D> scissor)
{
if (m_scene && m_mesh && m_material)
{
ShadowmapPipeline* pipeline;
auto foundPipeline = m_shadowmapPipelines.find(renderPass);
if (foundPipeline == m_shadowmapPipelines.end())
{
auto it = m_shadowmapPipelines
.insert(std::make_pair(
renderPass,
ShadowmapPipeline(*m_scene, *m_mesh, *m_material,
renderPass)))
.first;
pipeline = &it->second;
}
else
{
pipeline = &foundPipeline->second;
}
pipeline->bindPipeline(cb);
if (viewport.has_value())
cb.setViewport(viewport.value());
if (scissor.has_value())
cb.setScissor(scissor.value());
pipeline->bindDescriptorSet(cb);
PcbStruct pcbStruct;
pcbStruct.modelIndex = id;
pcbStruct.materialInstanceIndex = m_material.get()->index();
cb.pushConstants(pipeline->pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT,
0, &pcbStruct);
pipeline->draw(cb);
}
}
} // namespace cdm
| 36.250308
| 80
| 0.734379
|
WubiCookie
|
e78a81ecc6bce9fb6fd3c3a29b1da0dd0dec9615
| 33,645
|
cpp
|
C++
|
src/utilities/QuadratureUtil.cpp
|
chennachaos/stabfem
|
b3d1f44c45e354dc930203bda22efc800c377c6f
|
[
"MIT"
] | null | null | null |
src/utilities/QuadratureUtil.cpp
|
chennachaos/stabfem
|
b3d1f44c45e354dc930203bda22efc800c377c6f
|
[
"MIT"
] | null | null | null |
src/utilities/QuadratureUtil.cpp
|
chennachaos/stabfem
|
b3d1f44c45e354dc930203bda22efc800c377c6f
|
[
"MIT"
] | null | null | null |
#include "QuadratureUtil.h"
#include <iostream>
#include <math.h>
#include <assert.h>
using namespace std;
void getGaussPoints1D(int ngp, vector<double>& gausspoints, vector<double>& gaussweights)
{
//cout << " ngp = " << ngp << endl;
gausspoints.resize(ngp);
gaussweights.resize(ngp);
switch(ngp)
{
case 1: // 1 Point quadrature rule
gausspoints[0] = 0.0; gaussweights[0] = 2.0;
break;
case 2: //2 Point quadrature rule
gausspoints[0] = -0.577350269189626; gaussweights[0] = 1.0;
gausspoints[1] = 0.577350269189626; gaussweights[1] = 1.0;
break;
case 3: //3 Point quadrature rule
gausspoints[0] = -0.774596669241483; gaussweights[0] = 5.0/9.0;
gausspoints[1] = 0.0; gaussweights[1] = 8.0/9.0;
gausspoints[2] = 0.774596669241483; gaussweights[2] = 5.0/9.0;
break;
case 4: //4 Point quadrature rule
gausspoints[0] = -0.861136311594953; gaussweights[0] = 0.347854845137454;
gausspoints[1] = -0.339981043584856; gaussweights[1] = 0.652145154862546;
gausspoints[2] = 0.339981043584856; gaussweights[2] = 0.652145154862546;
gausspoints[3] = 0.861136311594953; gaussweights[3] = 0.347854845137454;
break;
case 5: //5 Point quadrature rule
gausspoints[0] = -0.906179845938664; gaussweights[0] = 0.236926885056189;
gausspoints[1] = -0.538469310105683; gaussweights[1] = 0.478628670499366;
gausspoints[2] = 0.0; gaussweights[2] = 0.568888888888889;
gausspoints[3] = 0.538469310105683; gaussweights[3] = 0.478628670499366;
gausspoints[4] = 0.906179845938664; gaussweights[4] = 0.236926885056189;
break;
case 6: //6 Point quadrature rule
gausspoints[0] = -0.932469514203152; gaussweights[0] = 0.171324492379170;
gausspoints[1] = -0.661209386466265; gaussweights[1] = 0.360761573048139;
gausspoints[2] = -0.238619186083197; gaussweights[2] = 0.467913934572691;
gausspoints[3] = 0.238619186083197; gaussweights[3] = 0.467913934572691;
gausspoints[4] = 0.661209386466265; gaussweights[4] = 0.360761573048139;
gausspoints[5] = 0.932469514203152; gaussweights[5] = 0.171324492379170;
break;
case 7: //7 Point quadrature rule
gausspoints[0] = -0.9491079123427585245261897; gaussweights[0] = 0.1294849661688696932706114 ;
gausspoints[1] = -0.7415311855993944398638648; gaussweights[1] = 0.2797053914892766679014678 ;
gausspoints[2] = -0.4058451513773971669066064; gaussweights[2] = 0.3818300505051189449503698 ;
gausspoints[3] = 0.0 ; gaussweights[3] = 0.4179591836734693877551020 ;
gausspoints[4] = 0.4058451513773971669066064; gaussweights[4] = 0.3818300505051189449503698 ;
gausspoints[5] = 0.7415311855993944398638648; gaussweights[5] = 0.2797053914892766679014678 ;
gausspoints[6] = 0.9491079123427585245261897; gaussweights[6] = 0.1294849661688696932706114 ;
break;
case 8: //8 Point quadrature rule
gausspoints[0] = -0.96028986; gaussweights[0] = 0.10122854 ;
gausspoints[1] = -0.79666648; gaussweights[1] = 0.22238103 ;
gausspoints[2] = -0.52553241; gaussweights[2] = 0.31370665 ;
gausspoints[3] = -0.18343464; gaussweights[3] = 0.36268378 ;
gausspoints[4] = 0.18343464; gaussweights[4] = 0.36268378 ;
gausspoints[5] = 0.52553241; gaussweights[5] = 0.31370665 ;
gausspoints[6] = 0.79666648; gaussweights[6] = 0.22238103 ;
gausspoints[7] = 0.96028986; gaussweights[7] = 0.10122854 ;
break;
case 9: //9 Point quadrature rule
gaussweights[0] = 0.0812743883615744; gausspoints[0] = -0.9681602395076261;
gaussweights[1] = 0.1806481606948574; gausspoints[1] = -0.8360311073266358;
gaussweights[2] = 0.2606106964029354; gausspoints[2] = -0.6133714327005904;
gaussweights[3] = 0.3123470770400029; gausspoints[3] = -0.3242534234038089;
gaussweights[4] = 0.3302393550012598; gausspoints[4] = 0.0000000000000000;
gaussweights[5] = 0.3123470770400029; gausspoints[5] = 0.3242534234038089;
gaussweights[6] = 0.2606106964029354; gausspoints[6] = 0.6133714327005904;
gaussweights[7] = 0.1806481606948574; gausspoints[7] = 0.8360311073266358;
gaussweights[8] = 0.0812743883615744; gausspoints[8] = 0.9681602395076261;
case 10: //10 Point quadrature rule
gaussweights[0] = 0.0666713443086881; gausspoints[0] = -0.9739065285171717;
gaussweights[1] = 0.1494513491505806; gausspoints[1] = -0.8650633666889845;
gaussweights[2] = 0.2190863625159820; gausspoints[2] = -0.6794095682990244;
gaussweights[3] = 0.2692667193099963; gausspoints[3] = -0.4333953941292472;
gaussweights[4] = 0.2955242247147529; gausspoints[4] = -0.1488743389816312;
gaussweights[5] = 0.2955242247147529; gausspoints[5] = 0.1488743389816312;
gaussweights[6] = 0.2692667193099963; gausspoints[6] = 0.4333953941292472;
gaussweights[7] = 0.2190863625159820; gausspoints[7] = 0.6794095682990244;
gaussweights[8] = 0.1494513491505806; gausspoints[8] = 0.8650633666889845;
gaussweights[9] = 0.0666713443086881; gausspoints[9] = 0.9739065285171717;
break;
case 11: //11 Point quadrature rule
gaussweights[0] = 0.0556685671161737; gausspoints[0] = -0.9782286581460570;
gaussweights[1] = 0.1255803694649046; gausspoints[1] = -0.8870625997680953;
gaussweights[2] = 0.1862902109277343; gausspoints[2] = -0.7301520055740494;
gaussweights[3] = 0.2331937645919905; gausspoints[3] = -0.5190961292068118;
gaussweights[4] = 0.2628045445102467; gausspoints[4] = -0.2695431559523450;
gaussweights[5] = 0.2729250867779006; gausspoints[5] = 0.0000000000000000;
gaussweights[6] = 0.2628045445102467; gausspoints[6] = 0.2695431559523450;
gaussweights[7] = 0.2331937645919905; gausspoints[7] = 0.5190961292068118;
gaussweights[8] = 0.1862902109277343; gausspoints[8] = 0.7301520055740494;
gaussweights[9] = 0.1255803694649046; gausspoints[9] = 0.8870625997680953;
gaussweights[10] = 0.0556685671161737; gausspoints[10] = 0.9782286581460570;
break;
case 12: //12 Point quadrature rule
gaussweights[0] = 0.0471753363865118; gausspoints[0] = -0.9815606342467192;
gaussweights[1] = 0.1069393259953184; gausspoints[1] = -0.9041172563704749;
gaussweights[2] = 0.1600783285433462; gausspoints[2] = -0.7699026741943047;
gaussweights[3] = 0.2031674267230659; gausspoints[3] = -0.5873179542866175;
gaussweights[4] = 0.2334925365383548; gausspoints[4] = -0.3678314989981802;
gaussweights[5] = 0.2491470458134028; gausspoints[5] = -0.1252334085114689;
gaussweights[6] = 0.2491470458134028; gausspoints[6] = 0.1252334085114689;
gaussweights[7] = 0.2334925365383548; gausspoints[7] = 0.3678314989981802;
gaussweights[8] = 0.2031674267230659; gausspoints[8] = 0.5873179542866175;
gaussweights[9] = 0.1600783285433462; gausspoints[9] = 0.7699026741943047;
gaussweights[10] = 0.1069393259953184; gausspoints[10] = 0.9041172563704749;
gaussweights[11] = 0.0471753363865118; gausspoints[11] = 0.9815606342467192;
break;
case 13: //13 Point quadrature rule
gaussweights[0] = 0.0404840047653159; gausspoints[7] = -0.9841830547185881;
gaussweights[1] = 0.0921214998377285; gausspoints[7] = -0.9175983992229779;
gaussweights[2] = 0.1388735102197872; gausspoints[7] = -0.8015780907333099;
gaussweights[3] = 0.1781459807619457; gausspoints[7] = -0.6423493394403402;
gaussweights[4] = 0.2078160475368885; gausspoints[7] = -0.4484927510364469;
gaussweights[5] = 0.2262831802628972; gausspoints[7] = -0.2304583159551348;
gaussweights[6] = 0.2325515532308739; gausspoints[7] = 0.0000000000000000;
gaussweights[7] = 0.2262831802628972; gausspoints[7] = 0.2304583159551348;
gaussweights[8] = 0.2078160475368885; gausspoints[7] = 0.4484927510364469;
gaussweights[9] = 0.1781459807619457; gausspoints[7] = 0.6423493394403402;
gaussweights[10] = 0.1388735102197872; gausspoints[10] = 0.8015780907333099;
gaussweights[11] = 0.0921214998377285; gausspoints[11] = 0.9175983992229779;
gaussweights[12] = 0.0404840047653159; gausspoints[12] = 0.9841830547185881;
break;
case 14: //14 Point quadrature rule
gaussweights[0] = 0.0351194603317519; gausspoints[0] = -0.9862838086968123;
gaussweights[1] = 0.0801580871597602; gausspoints[1] = -0.9284348836635735;
gaussweights[2] = 0.1215185706879032; gausspoints[2] = -0.8272013150697650;
gaussweights[3] = 0.1572031671581935; gausspoints[3] = -0.6872929048116855;
gaussweights[4] = 0.1855383974779378; gausspoints[4] = -0.5152486363581541;
gaussweights[5] = 0.2051984637212956; gausspoints[5] = -0.3191123689278897;
gaussweights[6] = 0.2152638534631578; gausspoints[6] = -0.1080549487073437;
gaussweights[7] = 0.2152638534631578; gausspoints[7] = 0.1080549487073437;
gaussweights[8] = 0.2051984637212956; gausspoints[8] = 0.3191123689278897;
gaussweights[9] = 0.1855383974779378; gausspoints[9] = 0.5152486363581541;
gaussweights[10] = 0.1572031671581935; gausspoints[10] = 0.6872929048116855;
gaussweights[11] = 0.1215185706879032; gausspoints[11] = 0.8272013150697650;
gaussweights[12] = 0.0801580871597602; gausspoints[12] = 0.9284348836635735;
gaussweights[13] = 0.0351194603317519; gausspoints[13] = 0.9862838086968123;
break;
case 15: //15 Point quadrature rule
gaussweights[0] = 0.0307532419961173; gausspoints[0] = -0.9879925180204854;
gaussweights[1] = 0.0703660474881081; gausspoints[1] = -0.9372733924007060;
gaussweights[2] = 0.1071592204671719; gausspoints[2] = -0.8482065834104272;
gaussweights[3] = 0.1395706779261543; gausspoints[3] = -0.7244177313601701;
gaussweights[4] = 0.1662692058169939; gausspoints[4] = -0.5709721726085388;
gaussweights[5] = 0.1861610000155622; gausspoints[5] = -0.3941513470775634;
gaussweights[6] = 0.1984314853271116; gausspoints[6] = -0.2011940939974345;
gaussweights[7] = 0.2025782419255613; gausspoints[7] = 0.0000000000000000;
gaussweights[8] = 0.1984314853271116; gausspoints[8] = 0.2011940939974345;
gaussweights[9] = 0.1861610000155622; gausspoints[9] = 0.3941513470775634;
gaussweights[10] = 0.1662692058169939; gausspoints[10] = 0.5709721726085388;
gaussweights[11] = 0.1395706779261543; gausspoints[11] = 0.7244177313601701;
gaussweights[12] = 0.1071592204671719; gausspoints[12] = 0.8482065834104272;
gaussweights[13] = 0.0703660474881081; gausspoints[13] = 0.9372733924007060;
gaussweights[14] = 0.0307532419961173; gausspoints[14] = 0.9879925180204854;
break;
default:
cerr << " invalid value of 'ngp' ! " << endl;
break;
}
return;
}
void getGaussPointsQuad(int ngp, vector<double>& gps1, vector<double>& gps2, vector<double>& gws)
{
gps1.resize(ngp);
gps2.resize(ngp);
gws.resize(ngp);
int nn=0;
if(ngp == 1) nn = 1;
else if(ngp == 4) nn = 2;
else if(ngp == 9) nn = 3;
else if(ngp == 16) nn = 4;
else
{
cerr << " Error in getGaussPointsQuad() ... ngp = " << ngp << endl;
}
vector<double> gpoints1, gweights1;
getGaussPoints1D(nn, gpoints1, gweights1);
int ind=0, ii, jj;
for(jj=0; jj<nn; jj++)
{
for(ii=0; ii<nn; ii++)
{
gps1[ind] = gpoints1[ii];
gps2[ind] = gpoints1[jj];
gws[ind] = gweights1[jj]*gweights1[ii];
ind++;
}
}
return;
}
void getGaussPointsHexa(int ngp, vector<double>& gp1, vector<double>& gp2, vector<double>& gp3, vector<double>& gws)
{
int nn=0;
if(ngp == 1) nn = 1;
else if(ngp == 8) nn = 2;
else if(ngp == 27) nn = 3;
else if(ngp == 64) nn = 4;
else
{
cerr << " Error in getGaussPointsHex ... ngp = " << ngp << endl;
}
gp1.resize(ngp);
gp2.resize(ngp);
gp3.resize(ngp);
gws.resize(ngp);
vector<double> gpoints1, gweights1;
getGaussPoints1D(nn, gpoints1, gweights1);
int ind=0, ii, jj, kk;
for(kk=0; kk<nn; kk++)
{
for(jj=0; jj<nn; jj++)
{
for(ii=0; ii<nn; ii++)
{
gp1[ind] = gpoints1[ii];
gp2[ind] = gpoints1[jj];
gp3[ind] = gpoints1[kk];
gws[ind] = gweights1[kk]*gweights1[jj]*gweights1[ii];
ind++;
}
}
}
return;
}
void getGaussPointsTriangle(int ngp, vector<double>& gps1, vector<double>& gps2, vector<double>& gws)
{
// weights are normalized to calculate the exact area of the triangle
// i.e. each weight is divided by 2.0
double r1d3 = 1.0/3.0, a1, fact=0.5;
gps1.resize(ngp);
gps2.resize(ngp);
gws.resize(ngp);
switch(ngp)
{
case 1: // 1 Point quadrature rule
gps1[0] = r1d3; gps2[0] = r1d3; gws[0] = fact*1.0;
break;
case 3: //3 Point quadrature rule
a1 = 1.0/3.0;
gps1[0] = 1.0/6.0; gps2[0] = 1.0/6.0; gws[0] = fact*a1;
gps1[1] = 4.0/6.0; gps2[1] = 1.0/6.0; gws[1] = fact*a1;
gps1[2] = 1.0/6.0; gps2[2] = 4.0/6.0; gws[2] = fact*a1;
break;
case 4: //4 Point quadrature rule
a1 = 25.0/48.0;
gps1[0] = r1d3; gps2[0] = r1d3; gws[0] = fact*(-27.0/48.0);
gps1[1] = 0.6; gps2[1] = 0.2; gws[1] = fact*a1;
gps1[2] = 0.2; gps2[2] = 0.6; gws[2] = fact*a1;
gps1[3] = 0.2; gps2[3] = 0.2; gws[3] = fact*a1;
break;
case 6: //6 Point quadrature rule
gps1[0] = 0.10810301816807022736; gps2[0] = 0.44594849091596488632; gws[0] = fact*0.22338158967801146570;
gps1[1] = 0.44594849091596488632; gps2[1] = 0.10810301816807022736; gws[1] = fact*0.22338158967801146570;
gps1[2] = 0.44594849091596488632; gps2[2] = 0.44594849091596488632; gws[2] = fact*0.22338158967801146570;
gps1[3] = 0.81684757298045851308; gps2[3] = 0.09157621350977074346; gws[3] = fact*0.10995174365532186764;
gps1[4] = 0.09157621350977074346; gps2[4] = 0.81684757298045851308; gws[4] = fact*0.10995174365532186764;
gps1[5] = 0.09157621350977074346; gps2[5] = 0.09157621350977074346; gws[5] = fact*0.10995174365532186764;
break;
case 7: //7 Point quadrature rule
gps1[0] = r1d3; gps2[0] = r1d3; gws[0] = fact*0.225;
gps1[1] = 0.79742698535308732240; gps2[1] = 0.10128650732345633880; gws[1] = fact*0.12593918054482715260;
gps1[2] = 0.10128650732345633880; gps2[2] = 0.79742698535308732240; gws[2] = fact*0.12593918054482715260;
gps1[3] = 0.10128650732345633880; gps2[3] = 0.10128650732345633880; gws[3] = fact*0.12593918054482715260;
gps1[4] = 0.05971587178976982045; gps2[4] = 0.47014206410511508977; gws[4] = fact*0.13239415278850618074;
gps1[5] = 0.47014206410511508977; gps2[5] = 0.05971587178976982045; gws[5] = fact*0.13239415278850618074;
gps1[6] = 0.47014206410511508977; gps2[6] = 0.47014206410511508977; gws[6] = fact*0.13239415278850618074;
break;
case 12: //12 Point quadrature rule
gps1[0] = 0.87382197101699554332; gps2[0] = 0.06308901449150222834; gws[0] = fact*0.050844906370206816921;
gps1[1] = 0.06308901449150222834; gps2[1] = 0.87382197101699554332; gws[1] = fact*0.050844906370206816921;
gps1[2] = 0.06308901449150222834; gps2[2] = 0.06308901449150222834; gws[2] = fact*0.050844906370206816921;
gps1[3] = 0.50142650965817915742; gps2[3] = 0.24928674517091042129; gws[3] = fact*0.116786275726379366030;
gps1[4] = 0.24928674517091042129; gps2[4] = 0.50142650965817915742; gws[4] = fact*0.116786275726379366030;
gps1[5] = 0.24928674517091042129; gps2[5] = 0.24928674517091042129; gws[5] = fact*0.116786275726379366030;
gps1[6] = 0.05314504984481694735; gps2[6] = 0.31035245103378440542; gws[6] = fact*0.082851075618373575194;
gps1[7] = 0.31035245103378440542; gps2[7] = 0.05314504984481694735; gws[7] = fact*0.082851075618373575194;
gps1[8] = 0.05314504984481694735; gps2[8] = 0.63650249912139864723; gws[8] = fact*0.082851075618373575194;
gps1[9] = 0.31035245103378440542; gps2[9] = 0.63650249912139864723; gws[9] = fact*0.082851075618373575194;
gps1[10] = 0.63650249912139864723; gps2[10] = 0.05314504984481694735; gws[10] = fact*0.082851075618373575194;
gps1[11] = 0.63650249912139864723; gps2[11] = 0.31035245103378440542; gws[11] = fact*0.082851075618373575194;
break;
case 13: // 13 point quadrature rule
gps1[0] = 0.33333333333333; gps2[0] = 0.33333333333333; gws[0] = fact*-0.14957004446768;
gps1[1] = 0.26034596607904; gps2[1] = 0.26034596607904; gws[1] = fact* 0.17561525743321;
gps1[2] = 0.26034596607904; gps2[2] = 0.47930806784192; gws[2] = fact* 0.17561525743321;
gps1[3] = 0.47930806784192; gps2[3] = 0.26034596607904; gws[3] = fact* 0.17561525743321;
gps1[4] = 0.06513010290222; gps2[4] = 0.06513010290222; gws[4] = fact* 0.05334723560884;
gps1[5] = 0.06513010290222; gps2[5] = 0.86973979419557; gws[5] = fact* 0.05334723560884;
gps1[6] = 0.86973979419557; gps2[6] = 0.06513010290222; gws[6] = fact* 0.05334723560884;
gps1[7] = 0.31286549600487; gps2[7] = 0.63844418856981; gws[7] = fact* 0.07711376089026;
gps1[8] = 0.63844418856981; gps2[8] = 0.04869031542532; gws[8] = fact* 0.07711376089026;
gps1[9] = 0.04869031542532; gps2[9] = 0.31286549600487; gws[9] = fact* 0.07711376089026;
gps1[10] = 0.63844418856981; gps2[10] = 0.31286549600487; gws[10] = fact* 0.07711376089026;
gps1[11] = 0.31286549600487; gps2[11] = 0.04869031542532; gws[11] = fact* 0.07711376089026;
gps1[12] = 0.04869031542532; gps2[12] = 0.63844418856981; gws[12] = fact* 0.07711376089026;
break;
case 16: // 16 point quadrature rule
gps1[0] = 0.33333333333333; gps2[0] = 0.33333333333333; gws[0] = fact* 0.14431560767779;
gps1[1] = 0.45929258829272; gps2[1] = 0.45929258829272; gws[1] = fact* 0.09509163426728;
gps1[2] = 0.45929258829272; gps2[2] = 0.08141482341455; gws[2] = fact* 0.09509163426728;
gps1[3] = 0.08141482341455; gps2[3] = 0.45929258829272; gws[3] = fact* 0.09509163426728;
gps1[4] = 0.17056930775176; gps2[4] = 0.17056930775176; gws[4] = fact* 0.10321737053472;
gps1[5] = 0.17056930775176; gps2[5] = 0.65886138449648; gws[5] = fact* 0.10321737053472;
gps1[6] = 0.65886138449648; gps2[6] = 0.17056930775176; gws[6] = fact* 0.10321737053472;
gps1[7] = 0.05054722831703; gps2[7] = 0.05054722831703; gws[7] = fact* 0.03245849762320;
gps1[8] = 0.05054722831703; gps2[8] = 0.89890554336594; gws[8] = fact* 0.03245849762320;
gps1[9] = 0.89890554336594; gps2[9] = 0.05054722831703; gws[9] = fact* 0.03245849762320;
gps1[10] = 0.26311282963464; gps2[10] = 0.72849239295540; gws[10] = fact* 0.02723031417443;
gps1[11] = 0.72849239295540; gps2[11] = 0.00839477740996; gws[11] = fact* 0.02723031417443;
gps1[12] = 0.00839477740996; gps2[12] = 0.26311282963464; gws[12] = fact* 0.02723031417443;
gps1[13] = 0.72849239295540; gps2[13] = 0.26311282963464; gws[13] = fact* 0.02723031417443;
gps1[14] = 0.26311282963464; gps2[14] = 0.00839477740996; gws[14] = fact* 0.02723031417443;
gps1[15] = 0.00839477740996; gps2[15] = 0.72849239295540; gws[15] = fact* 0.02723031417443;
break;
default:
cerr << " invalid value of 'ngp' in getGaussPointsTriangle ! " << endl;
break;
}
return;
}
void getGaussPointsTetra(int ngp, vector<double>& gps1, vector<double>& gps2, vector<double>& gps3, vector<double>& gws)
{
double fact=1.0/6.0;
gps1.resize(ngp);
gps2.resize(ngp);
gps3.resize(ngp);
gws.resize(ngp);
switch(ngp)
{
case 1: // 1 Point quadrature rule
gps1[0] = 0.25;
gps2[0] = 0.25;
gps3[0] = 0.25;
gws[0] = fact;
break;
case 4: // N=4
gps1[0] = 0.1381966011250105;
gps1[1] = 0.5854101966249685;
gps1[2] = 0.1381966011250105;
gps1[3] = 0.1381966011250105;
gps2[0] = 0.1381966011250105;
gps2[1] = 0.1381966011250105;
gps2[2] = 0.5854101966249685;
gps2[3] = 0.1381966011250105;
gps3[0] = 0.1381966011250105;
gps3[1] = 0.1381966011250105;
gps3[2] = 0.1381966011250105;
gps3[3] = 0.5854101966249685;
gws[0] = 0.2500000000000000*fact;
gws[1] = 0.2500000000000000*fact;
gws[2] = 0.2500000000000000*fact;
gws[3] = 0.2500000000000000*fact;
break;
case 5: // N=5
gps1[0] = 0.2500000000000000;
gps1[1] = 0.5000000000000000;
gps1[2] = 0.1666666666666667;
gps1[3] = 0.1666666666666667;
gps1[4] = 0.1666666666666667;
gps2[0] = 0.2500000000000000;
gps2[1] = 0.1666666666666667;
gps2[2] = 0.1666666666666667;
gps2[3] = 0.1666666666666667;
gps2[4] = 0.5000000000000000;
gps3[0] = 0.2500000000000000;
gps3[1] = 0.1666666666666667;
gps3[2] = 0.1666666666666667;
gps3[3] = 0.5000000000000000;
gps3[4] = 0.1666666666666667;
gws[0] = -0.8000000000000000*fact;
gws[1] = 0.4500000000000000*fact;
gws[2] = 0.4500000000000000*fact;
gws[3] = 0.4500000000000000*fact;
gws[4] = 0.4500000000000000*fact;
break;
case 8: // N=8
gps1[0] = 0.01583591;
gps1[1] = 0.328054697;
gps1[2] = 0.328054697;
gps1[3] = 0.328054697;
gps1[4] = 0.679143178;
gps1[5] = 0.106952274;
gps1[6] = 0.106952274;
gps1[7] = 0.106952274;
gps2[0] = 0.328054697;
gps2[1] = 0.01583591;
gps2[2] = 0.328054697;
gps2[3] = 0.328054697;
gps2[4] = 0.106952274;
gps2[5] = 0.679143178;
gps2[6] = 0.106952274;
gps2[7] = 0.106952274;
gps3[0] = 0.328054697;
gps3[1] = 0.328054697;
gps3[2] = 0.01583591;
gps3[3] = 0.328054697;
gps3[4] = 0.106952274;
gps3[5] = 0.106952274;
gps3[6] = 0.679143178;
gps3[7] = 0.106952274;
gws[0] = 0.023087995;
gws[1] = 0.023087995;
gws[2] = 0.023087995;
gws[3] = 0.023087995;
gws[4] = 0.018578672;
gws[5] = 0.018578672;
gws[6] = 0.018578672;
gws[7] = 0.018578672;
break;
case 11: // N=11
gps1[0] = 0.2500000000000000;
gps1[1] = 0.7857142857142857;
gps1[2] = 0.0714285714285714;
gps1[3] = 0.0714285714285714;
gps1[4] = 0.0714285714285714;
gps1[5] = 0.1005964238332008;
gps1[6] = 0.3994035761667992;
gps1[7] = 0.3994035761667992;
gps1[8] = 0.3994035761667992;
gps1[9] = 0.1005964238332008;
gps1[10] = 0.1005964238332008;
gps2[0] = 0.2500000000000000;
gps2[1] = 0.0714285714285714;
gps2[2] = 0.0714285714285714;
gps2[3] = 0.0714285714285714;
gps2[4] = 0.7857142857142857;
gps2[5] = 0.3994035761667992;
gps2[6] = 0.1005964238332008;
gps2[7] = 0.3994035761667992;
gps2[8] = 0.1005964238332008;
gps2[9] = 0.3994035761667992;
gps2[10] = 0.1005964238332008;
gps3[0] = 0.2500000000000000;
gps3[1] = 0.0714285714285714;
gps3[2] = 0.0714285714285714;
gps3[3] = 0.7857142857142857;
gps3[4] = 0.0714285714285714;
gps3[5] = 0.3994035761667992;
gps3[6] = 0.3994035761667992;
gps3[7] = 0.1005964238332008;
gps3[8] = 0.1005964238332008;
gps3[9] = 0.1005964238332008;
gps3[10] = 0.3994035761667992;
gws[0] = -0.0789333333333333*fact;
gws[1] = 0.0457333333333333*fact;
gws[2] = 0.0457333333333333*fact;
gws[3] = 0.0457333333333333*fact;
gws[4] = 0.0457333333333333*fact;
gws[5] = 0.1493333333333333*fact;
gws[6] = 0.1493333333333333*fact;
gws[7] = 0.1493333333333333*fact;
gws[8] = 0.1493333333333333*fact;
gws[9] = 0.1493333333333333*fact;
gws[10] = 0.1493333333333333*fact;
break;
case 15: // N=15
gps1[0] = 0.2500000000000000;
gps1[1] = 0.0000000000000000;
gps1[2] = 0.3333333333333333;
gps1[3] = 0.3333333333333333;
gps1[4] = 0.3333333333333333;
gps1[5] = 0.7272727272727273;
gps1[6] = 0.0909090909090909;
gps1[7] = 0.0909090909090909;
gps1[8] = 0.0909090909090909;
gps1[9] = 0.4334498464263357;
gps1[10] = 0.0665501535736643;
gps1[11] = 0.0665501535736643;
gps1[12] = 0.0665501535736643;
gps1[13] = 0.4334498464263357;
gps1[14] = 0.4334498464263357;
gps2[0] = 0.2500000000000000;
gps2[1] = 0.3333333333333333;
gps2[2] = 0.3333333333333333;
gps2[3] = 0.3333333333333333;
gps2[4] = 0.0000000000000000;
gps2[5] = 0.0909090909090909;
gps2[6] = 0.0909090909090909;
gps2[7] = 0.0909090909090909;
gps2[8] = 0.7272727272727273;
gps2[9] = 0.0665501535736643;
gps2[10] = 0.4334498464263357;
gps2[11] = 0.0665501535736643;
gps2[12] = 0.4334498464263357;
gps2[13] = 0.0665501535736643;
gps2[14] = 0.4334498464263357;
gps3[0] = 0.2500000000000000;
gps3[1] = 0.3333333333333333;
gps3[2] = 0.3333333333333333;
gps3[3] = 0.0000000000000000;
gps3[4] = 0.3333333333333333;
gps3[5] = 0.0909090909090909;
gps3[6] = 0.0909090909090909;
gps3[7] = 0.7272727272727273;
gps3[8] = 0.0909090909090909;
gps3[9] = 0.0665501535736643;
gps3[10] = 0.0665501535736643;
gps3[11] = 0.4334498464263357;
gps3[12] = 0.4334498464263357;
gps3[13] = 0.4334498464263357;
gps3[14] = 0.0665501535736643;
gws[0] = 0.1817020685825351*fact;
gws[1] = 0.0361607142857143*fact;
gws[2] = 0.0361607142857143*fact;
gws[3] = 0.0361607142857143*fact;
gws[4] = 0.0361607142857143*fact;
gws[5] = 0.0698714945161738*fact;
gws[6] = 0.0698714945161738*fact;
gws[7] = 0.0698714945161738*fact;
gws[8] = 0.0698714945161738*fact;
gws[9] = 0.0656948493683187*fact;
gws[10] = 0.0656948493683187*fact;
gws[11] = 0.0656948493683187*fact;
gws[12] = 0.0656948493683187*fact;
gws[13] = 0.0656948493683187*fact;
gws[14] = 0.0656948493683187*fact;
break;
default:
cerr << " invalid value of 'ngp' in getGaussPointsTet() ! " << '\t' << ngp << endl;
break;
}
return;
}
void getLobattoPoints(int ngp, vector<double>& gausspoints, vector<double>& gaussweights)
{
char fct[] = "getGaussPoints";
switch(ngp)
{
case 2: //2 Point quadrature rule
gausspoints.resize(2);
gaussweights.resize(2);
gausspoints[0] = -1.0; gaussweights[0] = 1.0;
gausspoints[1] = 1.0; gaussweights[1] = 1.0;
break;
case 3: //3 Point quadrature rule
gausspoints.resize(3);
gaussweights.resize(3);
gausspoints[0] = -1.0; gaussweights[0] = 0.333333333333;
gausspoints[1] = 0.0; gaussweights[1] = 1.333333333333;
gausspoints[2] = 1.0; gaussweights[2] = 0.333333333333;
break;
case 4: //4 Point quadrature rule
gausspoints.resize(4);
gaussweights.resize(4);
gausspoints[0] = -1.0; gaussweights[0] = 1.0/6.0;
gausspoints[1] = -0.447213595500; gaussweights[1] = 5.0/6.0;
gausspoints[2] = 0.447213595500; gaussweights[2] = 5.0/6.0;
gausspoints[3] = 1.0; gaussweights[3] = 1.0/6.0;
break;
case 5: //5 Point quadrature rule
gausspoints.resize(5);
gaussweights.resize(5);
gausspoints[0] = -1.0; gaussweights[0] = 0.1;
gausspoints[1] = -0.654653670708; gaussweights[1] = 0.54444444444;
gausspoints[2] = 0.0; gaussweights[2] = 0.71111111111;
gausspoints[3] = 0.654653670708; gaussweights[3] = 0.54444444444;
gausspoints[4] = 1.0; gaussweights[4] = 0.1;
break;
default:
cerr << " getGaussPoints1D()... invalid value of 'ngp' ! " << endl;
break;
}
return;
}
void getGaussPointsPrism(int ngp, vector<double>& gps1, vector<double>& gps2, vector<double>& gps3, vector<double>& gws)
{
// weights are normalized to calculate the exact area of the triangle
// i.e. each weight is divided by 2.0
double r1d3 = 1.0/3.0, a1, r1d2=0.5, fact;
gps1.resize(ngp);
gps2.resize(ngp);
gps3.resize(ngp);
gws.resize(ngp);
switch(ngp)
{
// 1 Point quadrature rule - 1 for triangle, 1 for the quad
case 1:
gps1[0] = r1d3;
gps2[0] = r1d3;
gps3[0] = 0.0;
gws[0] = r1d2*2.0; // 2.0 for the weight in the normal direction
break;
// 2 Point quadrature rule - 1 for triangle, 2 for the quad
case 2: //2 Point quadrature rule
gps1[0] = r1d3;
gps2[0] = r1d3;
gps3[0] = -0.577350269189626;
gws[0] = r1d2*1.0;
gps1[1] = r1d3;
gps2[1] = r1d3;
gps3[1] = 0.577350269189626;
gws[1] = r1d2*1.0;
break;
// 3 Point quadrature rule - 3 for triangle, 1 for the quad
case 3: //3 Point quadrature rule
fact = r1d2*r1d3*2.0;
gps1[0] = 1.0/6.0;
gps2[0] = 1.0/6.0;
gps3[0] = 0.0;
gws[0] = fact;
gps1[1] = 1.0/6.0;
gps2[1] = 4.0/6.0;
gps3[1] = 0.0;
gws[1] = fact;
gps1[2] = 4.0/6.0;
gps2[2] = 1.0/6.0;
gps3[2] = 0.0;
gws[2] = fact;
break;
// 6 Point quadrature rule - 3 for triangle, 2 for the quad
case 6: //6 Point quadrature rule
fact = r1d2*r1d3*1.0;
gps1[0] = 1.0/6.0;
gps2[0] = 1.0/6.0;
gps3[0] = -0.577350269189626;
gws[0] = fact;
gps1[1] = 1.0/6.0;
gps2[1] = 4.0/6.0;
gps3[1] = -0.577350269189626;
gws[1] = fact;
gps1[2] = 4.0/6.0;
gps2[2] = 1.0/6.0;
gps3[2] = -0.577350269189626;
gws[2] = fact;
gps1[3] = 1.0/6.0;
gps2[3] = 1.0/6.0;
gps3[3] = 0.577350269189626;
gws[3] = fact;
gps1[4] = 1.0/6.0;
gps2[4] = 4.0/6.0;
gps3[4] = 0.577350269189626;
gws[4] = fact;
gps1[5] = 4.0/6.0;
gps2[5] = 1.0/6.0;
gps3[5] = 0.577350269189626;
gws[5] = fact;
break;
default:
cerr << " invalid value of 'ngp' in getGaussPointsPrism ! " << endl;
break;
}
return;
}
void getGaussPointsPyramid(int ngp, vector<double>& gps1, vector<double>& gps2, vector<double>& gps3, vector<double>& gws)
{
gps1.resize(ngp);
gps2.resize(ngp);
gps3.resize(ngp);
gws.resize(ngp);
switch(ngp)
{
// 1 Point quadrature rule
case 1:
gps1[0] = 0.0;
gps2[0] = 0.0;
gps3[0] = -0.5;
gws[0] = 128.0/27.0;
break;
default:
cerr << " invalid value of 'ngp' in getGaussPointsPyramid ! " << endl;
break;
}
return;
}
| 38.407534
| 123
| 0.580205
|
chennachaos
|
e78a973ae6efaf290a7a8194e5fc183ed541bc7f
| 7,155
|
cpp
|
C++
|
src/IntaRNA/InteractionEnergyVrna.cpp
|
fabio-gut/IntaRNA
|
034bb1427673eda5b611dffdba37f464e1bb2835
|
[
"MIT"
] | null | null | null |
src/IntaRNA/InteractionEnergyVrna.cpp
|
fabio-gut/IntaRNA
|
034bb1427673eda5b611dffdba37f464e1bb2835
|
[
"MIT"
] | 1
|
2019-06-27T07:39:05.000Z
|
2019-06-27T11:10:52.000Z
|
src/IntaRNA/InteractionEnergyVrna.cpp
|
fabio-gut/IntaRNA
|
034bb1427673eda5b611dffdba37f464e1bb2835
|
[
"MIT"
] | null | null | null |
#include "IntaRNA/InteractionEnergyVrna.h"
#include <cassert>
#include <set>
// ES computation
extern "C" {
#include <ViennaRNA/fold_vars.h>
#include <ViennaRNA/fold.h>
#include <ViennaRNA/part_func.h>
#include <ViennaRNA/structure_utils.h>
#include <ViennaRNA/utils.h>
}
namespace IntaRNA {
////////////////////////////////////////////////////////////////////////////
InteractionEnergyVrna::InteractionEnergyVrna(
const Accessibility & accS1
, const ReverseAccessibility & accS2
, VrnaHandler &vrnaHandler
, const size_t maxInternalLoopSize1
, const size_t maxInternalLoopSize2
, const bool initES
)
:
InteractionEnergy(accS1, accS2, maxInternalLoopSize1, maxInternalLoopSize2)
// get final VRNA folding parameters
, foldModel( vrnaHandler.getModel() )
, foldParams( vrna_params( &foldModel ) )
, RT(vrnaHandler.getRT())
, bpCG( BP_pair[RnaSequence::getCodeForChar('C')][RnaSequence::getCodeForChar('G')] )
, bpGC( BP_pair[RnaSequence::getCodeForChar('G')][RnaSequence::getCodeForChar('C')] )
, esValues1(NULL)
, esValues2(NULL)
{
vrna_md_defaults_reset( &foldModel );
// init ES values if needed
if (initES) {
// 23.11.2017 : should not be relevant anymore
//#if INTARNA_MULITHREADING
// #pragma omp critical(intarna_omp_callingVRNA)
//#endif
// {
// create ES container to be filled
esValues1 = new EsMatrix();
esValues2 = new EsMatrix();
// fill ES container
computeES( accS1, *esValues1 );
computeES( accS2, *esValues2 );
// } // omp critical(intarna_omp_callingVRNA)
}
}
////////////////////////////////////////////////////////////////////////////
InteractionEnergyVrna::~InteractionEnergyVrna()
{
// garbage collection
if (foldParams != NULL) {
free(foldParams);
foldParams = NULL;
}
INTARNA_CLEANUP(esValues1);
INTARNA_CLEANUP(esValues2);
}
////////////////////////////////////////////////////////////////////////////
E_type
InteractionEnergyVrna::
getBestE_interLoop() const
{
// TODO maybe setup member variable (init=E_INF) with lazy initialization
// get all possible base pair codes handled
std::set<int> basePairCodes;
for (int i=0; i<NBASES; i++) {
for (int j=0; j<NBASES; j++) {
if (BP_pair[i][j] != 0) {
basePairCodes.insert( BP_pair[i][j] );
}
}
}
// get minimal energy for any base pair code combination
E_type minStackingE = E_INF;
for (std::set<int>::const_iterator p1=basePairCodes.begin(); p1!=basePairCodes.end(); p1++) {
for (std::set<int>::const_iterator p2=basePairCodes.begin(); p2!=basePairCodes.end(); p2++) {
minStackingE = std::min( minStackingE
, (E_type)E_IntLoop( 0 // unpaired region 1
, 0 // unpaired region 2
, *p1 // type BP (i1,i2)
, *p2 // type BP (j2,j1)
, 0
, 0
, 0
, 0
, foldParams)
// correct from dcal/mol to kcal/mol
/ (E_type)100.0
);
}
}
return minStackingE;
}
////////////////////////////////////////////////////////////////////////////
E_type
InteractionEnergyVrna::
getBestE_dangling() const
{
// TODO maybe setup member variable (init=E_INF) with lazy initialization
// get all possible base pair codes handled
std::set<int> basePairCodes;
for (int i=0; i<NBASES; i++) {
for (int j=0; j<NBASES; j++) {
basePairCodes.insert( BP_pair[i][j] );
}
}
// get minimal energy for any base pair code combination
E_type minDangleE = std::numeric_limits<E_type>::infinity();
// get codes for the sequence alphabet
const RnaSequence::CodeSeq_type alphabet = RnaSequence::getCodeForString(RnaSequence::SequenceAlphabet);
// get minimal
for (std::set<int>::const_iterator p1=basePairCodes.begin(); p1!=basePairCodes.end(); p1++) {
for (size_t i=0; i<alphabet.size(); i++) {
for (size_t j=0; j<alphabet.size(); j++) {
minDangleE = std::min( minDangleE
, (E_type)E_Stem( *p1
, alphabet.at(i)
, alphabet.at(j)
, 1 // is an external loop
, foldParams
)
// correct from dcal/mol to kcal/mol
/ (E_type)100.0
);
}
}
}
return minDangleE;
}
////////////////////////////////////////////////////////////////////////////
void
InteractionEnergyVrna::
computeES( const Accessibility & acc, InteractionEnergyVrna::EsMatrix & esToFill )
{
// prepare container
esToFill.resize( acc.getSequence().size(), acc.getSequence().size() );
// sequence length
const int seqLength = (int)acc.getSequence().size();
const E_type RT = getRT();
// VRNA compatible data structures
char * sequence = (char *) vrna_alloc(sizeof(char) * (seqLength + 1));
char * structureConstraint = (char *) vrna_alloc(sizeof(char) * (seqLength + 1));
for (int i=0; i<seqLength; i++) {
// copy sequence
sequence[i] = acc.getSequence().asString().at(i);
// copy accessibility constraint if present
structureConstraint[i] = acc.getAccConstraint().getVrnaDotBracket(i);
}
sequence[seqLength] = structureConstraint[seqLength] = '\0';
// prepare folding data
vrna_md_t curModel;
vrna_md_copy( &curModel, &foldModel );
// set maximal base pair span
curModel.max_bp_span = acc.getAccConstraint().getMaxBpSpan();
if (curModel.max_bp_span >= (int)acc.getSequence().size()) {
curModel.max_bp_span = -1;
}
// TODO check if VRNA_OPTION_WINDOW reasonable to speedup
vrna_fold_compound_t * foldData = vrna_fold_compound( sequence, &foldModel, VRNA_OPTION_PF);
// Adding hard constraints from pseudo dot-bracket
unsigned int constraint_options = VRNA_CONSTRAINT_DB_DEFAULT;
// enforce constraints
constraint_options |= VRNA_CONSTRAINT_DB_ENFORCE_BP;
vrna_constraints_add( foldData, (const char *)structureConstraint, constraint_options);
// compute correct partition function scaling via mfe
FLT_OR_DBL min_free_energy = vrna_mfe( foldData, NULL );
vrna_exp_params_rescale( foldData, &min_free_energy);
// compute partition functions
const float ensembleE = vrna_pf( foldData, NULL );
if (foldData->exp_matrices == NULL) {
throw std::runtime_error("AccessibilityVrna::computeES() : partition functions after computation not available");
}
if (foldData->exp_matrices->qm == NULL) {
throw std::runtime_error("AccessibilityVrna::computeES() : partition functions Qm after computation not available");
}
// copy ensemble energies of multi loop parts = ES values
FLT_OR_DBL qm_val = 0.0;
const int minLoopSubseqLength = foldModel.min_loop_size + 2;
for (int i=0; i<seqLength; i++) {
for (int j=i; j<seqLength; j++) {
// check if too short to enable a base pair
if (j-i+1 < minLoopSubseqLength) {
// make unfavorable
esToFill(i,j) = E_INF;
} else {
// get Qm value
// indexing via iindx starts with 1 instead of 0
qm_val = foldData->exp_matrices->qm[foldData->iindx[i+1]-j+1];
if ( E_equal(qm_val, 0.) ) {
esToFill(i,j) = E_INF;
} else {
// ES energy = -RT*log( Qm )
esToFill(i,j) = (E_type)( - RT*( std::log(qm_val)
+((FLT_OR_DBL)(j-i+1))*std::log(foldData->exp_params->pf_scale)));
}
}
}
}
// garbage collection
vrna_fold_compound_free(foldData);
free(structureConstraint);
free(sequence);
}
////////////////////////////////////////////////////////////////////////////
} // namespace
| 29.085366
| 118
| 0.647939
|
fabio-gut
|
e78da99d3ff6a31a9e2a9cb5a3caf8571c98626c
| 1,050
|
cpp
|
C++
|
core/connection.cpp
|
shakthi-prashanth-m/DroneCore
|
63f204beab14d3305068db17b8f7968bfddf39aa
|
[
"BSD-3-Clause"
] | 1
|
2019-06-16T23:50:37.000Z
|
2019-06-16T23:50:37.000Z
|
core/connection.cpp
|
peterbarker/DroneCore
|
d0c47bb3c749738feb9d04db807e9fba93c7688e
|
[
"BSD-3-Clause"
] | null | null | null |
core/connection.cpp
|
peterbarker/DroneCore
|
d0c47bb3c749738feb9d04db807e9fba93c7688e
|
[
"BSD-3-Clause"
] | null | null | null |
#include "connection.h"
#include "dronecore_impl.h"
#include "mavlink_channels.h"
#include "global_include.h"
namespace dronecore {
Connection::Connection(DroneCoreImpl &parent) :
_parent(parent),
_mavlink_receiver() {}
Connection::~Connection()
{
// Just in case a specific connection didn't call it already.
stop_mavlink_receiver();
}
bool Connection::start_mavlink_receiver()
{
uint8_t channel;
if (!MAVLinkChannels::Instance().checkout_free_channel(channel)) {
return false;
}
_mavlink_receiver.reset(new MAVLinkReceiver(channel));
return true;
}
void Connection::stop_mavlink_receiver()
{
if (_mavlink_receiver) {
uint8_t used_channel = _mavlink_receiver->get_channel();
// Destroy receiver before giving the channel back.
_mavlink_receiver.reset();
MAVLinkChannels::Instance().checkin_used_channel(used_channel);
}
}
void Connection::receive_message(const mavlink_message_t &message)
{
_parent.receive_message(message);
}
} // namespace dronecore
| 22.826087
| 71
| 0.72
|
shakthi-prashanth-m
|
e790c329036965309267d731546bf41618e035ee
| 1,115
|
cc
|
C++
|
example/user_profile_request_handler.cc
|
chao-he/tictac
|
13b4b0289e8ac8e1d1764f99152ad0327ffa93d4
|
[
"Apache-2.0"
] | null | null | null |
example/user_profile_request_handler.cc
|
chao-he/tictac
|
13b4b0289e8ac8e1d1764f99152ad0327ffa93d4
|
[
"Apache-2.0"
] | null | null | null |
example/user_profile_request_handler.cc
|
chao-he/tictac
|
13b4b0289e8ac8e1d1764f99152ad0327ffa93d4
|
[
"Apache-2.0"
] | null | null | null |
#include "core/connection.h"
#include "user_profile_request_handler.h"
#include "index_service.h"
#include "query_service.h"
#include "userprofile.pb.h"
void UserProfileRequestHandler::DoGet(RedisRequest* request, Connection* conn) {
auto& uid = request->arguments(0);
auto& qs = QueryService::Instance();
RecoUserList candidates;
auto pos = uid.find(':');
if (pos != std::string::npos) {
qs.NearUserRecommend(uid.substr(pos+1), &candidates);
} else {
qs.NearUserRecommend(uid, &candidates);
}
char* b = (char*)malloc(candidates.ByteSize() + 16);
char* p = b + snprintf(b, candidates.ByteSize() + 16, "$%d\r\n", candidates.ByteSize());
candidates.SerializeToArray(p, candidates.ByteSize());
p += candidates.ByteSize();
*p ++ = '\r';
*p ++ = '\n';
conn->AsyncWrite(b, p - b);
}
void UserProfileRequestHandler::DoSet(RedisRequest* request, Connection* conn) {
auto& is = IndexService::Instance();
is.IndexRawString(request->arguments(1));
conn->AsyncWrite("$2\r\nOK\r\n", 8);
}
RequestHandler* RequestHandler::NewRequestHandler() {
return new RedisRequestHandler();
}
| 30.972222
| 90
| 0.687892
|
chao-he
|
e796b0390eee58d6c4eb9c4b6343d1740e85f708
| 606
|
hpp
|
C++
|
src/dynamics/object.hpp
|
brysonjones/dynamics_sim
|
201bdf0a93d00addc585ffa47f280cffacebb9b3
|
[
"MIT"
] | null | null | null |
src/dynamics/object.hpp
|
brysonjones/dynamics_sim
|
201bdf0a93d00addc585ffa47f280cffacebb9b3
|
[
"MIT"
] | null | null | null |
src/dynamics/object.hpp
|
brysonjones/dynamics_sim
|
201bdf0a93d00addc585ffa47f280cffacebb9b3
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <autodiff/forward/real.hpp>
#include <autodiff/forward/real/eigen.hpp>
#include <Eigen/Dense>
#include <Eigen/Core>
#include "rotation.hpp"
// using namespace autodiff;
using namespace Eigen;
class Object {
public:
Object();
virtual autodiff::real U(const autodiff::ArrayXreal& pos);
VectorXd DLT1(const autodiff::ArrayXreal& q1, const autodiff::ArrayXreal& q2, double h);
private:
protected:
double m = 1; // mass (kg)
double g = 1; // gravity accel (m/s^2)
MatrixXd J; // (3x3) Inertia Tensor (kg*m^2)
};
| 22.444444
| 96
| 0.643564
|
brysonjones
|
e79a0ac49e4b01e4d92fd1ac5a33564b41985387
| 3,027
|
cpp
|
C++
|
src/qt/tokentransactionrecord.cpp
|
rlinxy/fcore
|
652288940bd27ecbad69c0366bba20ad0f7515b6
|
[
"MIT"
] | 1
|
2021-04-29T16:38:46.000Z
|
2021-04-29T16:38:46.000Z
|
src/qt/tokentransactionrecord.cpp
|
rlinxy/fcore
|
652288940bd27ecbad69c0366bba20ad0f7515b6
|
[
"MIT"
] | null | null | null |
src/qt/tokentransactionrecord.cpp
|
rlinxy/fcore
|
652288940bd27ecbad69c0366bba20ad0f7515b6
|
[
"MIT"
] | 1
|
2019-10-22T08:16:36.000Z
|
2019-10-22T08:16:36.000Z
|
#include <tokentransactionrecord.h>
#include <base58.h>
#include <consensus/consensus.h>
#include <validation.h>
#include <timedata.h>
#include <wallet/wallet.h>
#include <stdint.h>
/*
* Decompose CWallet transaction to model transaction records.
*/
QList<TokenTransactionRecord> TokenTransactionRecord::decomposeTransaction(const CWallet *wallet, const CTokenTx &wtx)
{
// Initialize variables
QList<TokenTransactionRecord> parts;
uint256 credit;
uint256 debit;
std::string tokenSymbol;
uint8_t decimals = 18;
if(wallet && !wtx.nValue.IsNull() && wallet->GetTokenTxDetails(wtx, credit, debit, tokenSymbol, decimals))
{
// Get token transaction data
TokenTransactionRecord rec;
rec.time = wtx.nCreateTime;
rec.credit = dev::u2s(uintTou256(credit));
rec.debit = -dev::u2s(uintTou256(debit));
rec.hash = wtx.GetHash();
rec.txid = wtx.transactionHash;
rec.tokenSymbol = tokenSymbol;
rec.decimals = decimals;
rec.label = wtx.strLabel;
dev::s256 net = rec.credit + rec.debit;
// Determine type
if(net == 0)
{
rec.type = SendToSelf;
}
else if(net > 0)
{
rec.type = RecvWithAddress;
}
else
{
rec.type = SendToAddress;
}
if(net)
{
rec.status.countsForBalance = true;
}
// Set address
switch (rec.type) {
case SendToSelf:
case SendToAddress:
case SendToOther:
case RecvWithAddress:
case RecvFromOther:
rec.address = wtx.strReceiverAddress;
default:
break;
}
// Append record
if(rec.type != Other)
parts.append(rec);
}
return parts;
}
void TokenTransactionRecord::updateStatus(const CWallet *wallet, const CTokenTx &wtx)
{
AssertLockHeld(cs_main);
// Determine transaction status
status.cur_num_blocks = chainActive.Height();
if(wtx.blockNumber == -1)
{
status.depth = 0;
}
else
{
status.depth = status.cur_num_blocks - wtx.blockNumber + 1;
}
auto mi = wallet->mapWallet.find(wtx.transactionHash);
if (mi != wallet->mapWallet.end() && (GetAdjustedTime() - mi->second.nTimeReceived > 2 * 60) && mi->second.GetRequestCount() == 0)
{
status.status = TokenTransactionStatus::Offline;
}
else if (status.depth == 0)
{
status.status = TokenTransactionStatus::Unconfirmed;
}
else if (status.depth < RecommendedNumConfirmations)
{
status.status = TokenTransactionStatus::Confirming;
}
else
{
status.status = TokenTransactionStatus::Confirmed;
}
}
bool TokenTransactionRecord::statusUpdateNeeded()
{
AssertLockHeld(cs_main);
return status.cur_num_blocks != chainActive.Height();
}
QString TokenTransactionRecord::getTxID() const
{
return QString::fromStdString(txid.ToString());
}
| 25.436975
| 134
| 0.61447
|
rlinxy
|
e79a8850483827fe6ef96d843e5a14b076bbd40b
| 2,124
|
hpp
|
C++
|
src/mlpack/core/tree/rectangle_tree/r_tree_descent_heuristic.hpp
|
RMaron/mlpack
|
a179a2708d9555ab7ee4b1e90e0c290092edad2e
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 675
|
2019-02-07T01:23:19.000Z
|
2022-03-28T05:45:10.000Z
|
src/mlpack/core/tree/rectangle_tree/r_tree_descent_heuristic.hpp
|
RMaron/mlpack
|
a179a2708d9555ab7ee4b1e90e0c290092edad2e
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 843
|
2019-01-25T01:06:46.000Z
|
2022-03-16T11:15:53.000Z
|
src/mlpack/core/tree/rectangle_tree/r_tree_descent_heuristic.hpp
|
RMaron/mlpack
|
a179a2708d9555ab7ee4b1e90e0c290092edad2e
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 83
|
2019-02-20T06:18:46.000Z
|
2022-03-20T09:36:09.000Z
|
/**
* @file r_tree_descent_heuristic.hpp
* @author Andrew Wells
*
* Definition of RTreeDescentHeuristic, a class that chooses the best child of a
* node in an R tree when inserting a new point.
*
* mlpack is free software; you may redistribute it and/or modify it under the
* terms of the 3-clause BSD license. You should have received a copy of the
* 3-clause BSD license along with mlpack. If not, see
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#ifndef MLPACK_CORE_TREE_RECTANGLE_TREE_R_TREE_DESCENT_HEURISTIC_HPP
#define MLPACK_CORE_TREE_RECTANGLE_TREE_R_TREE_DESCENT_HEURISTIC_HPP
#include <mlpack/prereqs.hpp>
namespace mlpack {
namespace tree {
/**
* When descending a RectangleTree to insert a point, we need to have a way to
* choose a child node when the point isn't enclosed by any of them. This
* heuristic is used to do so.
*/
class RTreeDescentHeuristic
{
public:
/**
* Evaluate the node using a heuristic. The heuristic guarantees two things:
*
* 1. If point is contained in (or on) the bound, the value returned is zero.
* 2. If the point is not contained in (or on) the bound, the value returned
* is greater than zero.
*
* @param node The node that is being evaluated.
* @param point The index of the point that is being inserted.
*/
template<typename TreeType>
static size_t ChooseDescentNode(const TreeType* node, const size_t point);
/**
* Evaluate the node using a heuristic. The heuristic guarantees two things:
*
* 1. If point is contained in (or on) the bound, the value returned is zero.
* 2. If the point is not contained in (or on) the bound, the value returned
* is greater than zero.
*
* @param node The node that is being evaluated.
* @param insertedNode The node that is being inserted.
*/
template<typename TreeType>
static size_t ChooseDescentNode(const TreeType* node,
const TreeType* insertedNode);
};
} // namespace tree
} // namespace mlpack
// Include implementation.
#include "r_tree_descent_heuristic_impl.hpp"
#endif
| 33.1875
| 80
| 0.718456
|
RMaron
|
e79bb907214e7600470605f83640d05da78da46f
| 27,585
|
cpp
|
C++
|
core/run/jobs/SimulationJobs.cpp
|
pavelsevecek/OpenSPH
|
d547c0af6270a739d772a4dcba8a70dc01775367
|
[
"MIT"
] | 20
|
2021-04-02T04:30:08.000Z
|
2022-03-01T09:52:01.000Z
|
core/run/jobs/SimulationJobs.cpp
|
pavelsevecek/OpenSPH
|
d547c0af6270a739d772a4dcba8a70dc01775367
|
[
"MIT"
] | null | null | null |
core/run/jobs/SimulationJobs.cpp
|
pavelsevecek/OpenSPH
|
d547c0af6270a739d772a4dcba8a70dc01775367
|
[
"MIT"
] | 1
|
2022-01-22T11:44:52.000Z
|
2022-01-22T11:44:52.000Z
|
#include "run/jobs/SimulationJobs.h"
#include "gravity/AggregateSolver.h"
#include "io/LogWriter.h"
#include "io/Logger.h"
#include "io/Output.h"
#include "run/IRun.h"
#include "run/SpecialEntries.h"
#include "sph/solvers/StabilizationSolver.h"
NAMESPACE_SPH_BEGIN
/// \todo generailize, add generic triggers to UI
class EnergyLogWriter : public ILogWriter {
public:
using ILogWriter::ILogWriter;
private:
virtual void write(const Storage& storage, const Statistics& stats) override {
const Float t = stats.get<Float>(StatisticsId::RUN_TIME);
const Float e = TotalEnergy().evaluate(storage);
logger->write(t, " ", e);
}
};
static std::string getIdentifier(const std::string& name) {
std::string escaped = replaceAll(name, " ", "-");
return lowercase(escaped);
}
// ----------------------------------------------------------------------------------------------------------
// SphJob
// ----------------------------------------------------------------------------------------------------------
static RunSettings overrideSettings(const RunSettings& settings,
const RunSettings& overrides,
const bool isResumed) {
RunSettings actual = settings;
actual.addEntries(overrides);
if (!isResumed) {
// reset the (potentially) overriden values back to original
actual.set(RunSettingsId::RUN_START_TIME, settings.get<Float>(RunSettingsId::RUN_START_TIME));
actual.set(RunSettingsId::TIMESTEPPING_INITIAL_TIMESTEP,
settings.get<Float>(RunSettingsId::TIMESTEPPING_INITIAL_TIMESTEP));
actual.set(
RunSettingsId::RUN_OUTPUT_FIRST_INDEX, settings.get<int>(RunSettingsId::RUN_OUTPUT_FIRST_INDEX));
}
return actual;
}
static void addTimeSteppingCategory(VirtualSettings& connector, RunSettings& settings, bool& resumeRun) {
auto courantEnabler = [&settings] {
Flags<TimeStepCriterionEnum> criteria =
settings.getFlags<TimeStepCriterionEnum>(RunSettingsId::TIMESTEPPING_CRITERION);
return criteria.has(TimeStepCriterionEnum::COURANT);
};
auto derivativeEnabler = [&settings] {
Flags<TimeStepCriterionEnum> criteria =
settings.getFlags<TimeStepCriterionEnum>(RunSettingsId::TIMESTEPPING_CRITERION);
return criteria.hasAny(TimeStepCriterionEnum::DERIVATIVES, TimeStepCriterionEnum::ACCELERATION);
};
auto divergenceEnabler = [&settings] {
Flags<TimeStepCriterionEnum> criteria =
settings.getFlags<TimeStepCriterionEnum>(RunSettingsId::TIMESTEPPING_CRITERION);
return criteria.has(TimeStepCriterionEnum::DIVERGENCE);
};
VirtualSettings::Category& rangeCat = connector.addCategory("Integration");
rangeCat.connect<Float>("Duration [s]", settings, RunSettingsId::RUN_END_TIME);
rangeCat.connect("Use start time of input", "is_resumed", resumeRun);
rangeCat.connect<Float>("Maximal timestep [s]", settings, RunSettingsId::TIMESTEPPING_MAX_TIMESTEP);
rangeCat.connect<Float>("Initial timestep [s]", settings, RunSettingsId::TIMESTEPPING_INITIAL_TIMESTEP);
rangeCat.connect<EnumWrapper>("Integrator", settings, RunSettingsId::TIMESTEPPING_INTEGRATOR);
rangeCat.connect<Flags<TimeStepCriterionEnum>>(
"Time step criteria", settings, RunSettingsId::TIMESTEPPING_CRITERION);
rangeCat.connect<Float>("Courant number", settings, RunSettingsId::TIMESTEPPING_COURANT_NUMBER)
.setEnabler(courantEnabler);
rangeCat.connect<Float>("Derivative factor", settings, RunSettingsId::TIMESTEPPING_DERIVATIVE_FACTOR)
.setEnabler(derivativeEnabler);
rangeCat.connect<Float>("Divergence factor", settings, RunSettingsId::TIMESTEPPING_DIVERGENCE_FACTOR)
.setEnabler(divergenceEnabler);
rangeCat.connect<Float>("Max step change", settings, RunSettingsId::TIMESTEPPING_MAX_INCREASE);
}
static void addGravityCategory(VirtualSettings& connector, RunSettings& settings) {
VirtualSettings::Category& gravityCat = connector.addCategory("Gravity");
gravityCat.connect<EnumWrapper>("Gravity solver", settings, RunSettingsId::GRAVITY_SOLVER);
gravityCat.connect<Float>("Opening angle", settings, RunSettingsId::GRAVITY_OPENING_ANGLE)
.setEnabler([&settings] {
return settings.get<GravityEnum>(RunSettingsId::GRAVITY_SOLVER) == GravityEnum::BARNES_HUT;
});
gravityCat.connect<int>("Multipole order", settings, RunSettingsId::GRAVITY_MULTIPOLE_ORDER);
gravityCat.connect<EnumWrapper>("Softening kernel", settings, RunSettingsId::GRAVITY_KERNEL);
gravityCat.connect<Float>(
"Recomputation period [s]", settings, RunSettingsId::GRAVITY_RECOMPUTATION_PERIOD);
}
static void addOutputCategory(VirtualSettings& connector, RunSettings& settings, const SharedToken& owner) {
auto enabler = [&settings] {
const IoEnum type = settings.get<IoEnum>(RunSettingsId::RUN_OUTPUT_TYPE);
return type != IoEnum::NONE;
};
VirtualSettings::Category& outputCat = connector.addCategory("Output");
outputCat.connect<EnumWrapper>("Format", settings, RunSettingsId::RUN_OUTPUT_TYPE)
.setValidator([](const IVirtualEntry::Value& value) {
const IoEnum type = IoEnum(value.get<EnumWrapper>());
return type == IoEnum::NONE || getIoCapabilities(type).has(IoCapability::OUTPUT);
})
.addAccessor(owner,
[&settings](const IVirtualEntry::Value& value) {
const IoEnum type = IoEnum(value.get<EnumWrapper>());
Path name = Path(settings.get<std::string>(RunSettingsId::RUN_OUTPUT_NAME));
if (Optional<std::string> extension = getIoExtension(type)) {
name.replaceExtension(extension.value());
}
settings.set(RunSettingsId::RUN_OUTPUT_NAME, name.native());
})
.setSideEffect(); // needs to update the 'File mask' entry
outputCat.connect<Path>("Directory", settings, RunSettingsId::RUN_OUTPUT_PATH)
.setEnabler(enabler)
.setPathType(IVirtualEntry::PathType::DIRECTORY);
outputCat.connect<std::string>("File mask", settings, RunSettingsId::RUN_OUTPUT_NAME).setEnabler(enabler);
outputCat.connect<Flags<OutputQuantityFlag>>("Quantities", settings, RunSettingsId::RUN_OUTPUT_QUANTITIES)
.setEnabler([&settings] {
const IoEnum type = settings.get<IoEnum>(RunSettingsId::RUN_OUTPUT_TYPE);
return type == IoEnum::TEXT_FILE || type == IoEnum::VTK_FILE;
});
outputCat.connect<EnumWrapper>("Output spacing", settings, RunSettingsId::RUN_OUTPUT_SPACING)
.setEnabler(enabler);
outputCat.connect<Float>("Output interval [s]", settings, RunSettingsId::RUN_OUTPUT_INTERVAL)
.setEnabler([&] {
const IoEnum type = settings.get<IoEnum>(RunSettingsId::RUN_OUTPUT_TYPE);
const OutputSpacing spacing = settings.get<OutputSpacing>(RunSettingsId::RUN_OUTPUT_SPACING);
return type != IoEnum::NONE && spacing != OutputSpacing::CUSTOM;
});
outputCat.connect<std::string>("Custom times [s]", settings, RunSettingsId::RUN_OUTPUT_CUSTOM_TIMES)
.setEnabler([&] {
const IoEnum type = settings.get<IoEnum>(RunSettingsId::RUN_OUTPUT_TYPE);
const OutputSpacing spacing = settings.get<OutputSpacing>(RunSettingsId::RUN_OUTPUT_SPACING);
return type != IoEnum::NONE && spacing == OutputSpacing::CUSTOM;
});
}
static void addLoggerCategory(VirtualSettings& connector, RunSettings& settings) {
VirtualSettings::Category& loggerCat = connector.addCategory("Logging");
loggerCat.connect<EnumWrapper>("Logger", settings, RunSettingsId::RUN_LOGGER);
loggerCat.connect<Path>("Log file", settings, RunSettingsId::RUN_LOGGER_FILE)
.setPathType(IVirtualEntry::PathType::OUTPUT_FILE)
.setEnabler(
[&settings] { return settings.get<LoggerEnum>(RunSettingsId::RUN_LOGGER) == LoggerEnum::FILE; });
loggerCat.connect<int>("Log verbosity", settings, RunSettingsId::RUN_LOGGER_VERBOSITY);
}
class SphRun : public IRun {
protected:
SharedPtr<IDomain> domain;
public:
explicit SphRun(const RunSettings& run, SharedPtr<IDomain> domain)
: domain(domain) {
settings = run;
scheduler = Factory::getScheduler(settings);
}
virtual void setUp(SharedPtr<Storage> storage) override {
AutoPtr<IBoundaryCondition> bc = Factory::getBoundaryConditions(settings, domain);
solver = Factory::getSolver(*scheduler, settings, std::move(bc));
for (Size matId = 0; matId < storage->getMaterialCnt(); ++matId) {
solver->create(*storage, storage->getMaterial(matId));
}
}
virtual void tearDown(const Storage& storage, const Statistics& stats) override {
// last dump after simulation ends
output->dump(storage, stats);
}
};
SphJob::SphJob(const std::string& name, const RunSettings& overrides)
: IRunJob(name) {
settings = getDefaultSettings(name);
settings.addEntries(overrides);
}
RunSettings SphJob::getDefaultSettings(const std::string& name) {
const Size dumpCnt = 10;
const Interval timeRange(0, 10);
RunSettings settings;
settings.set(RunSettingsId::TIMESTEPPING_INTEGRATOR, TimesteppingEnum::PREDICTOR_CORRECTOR)
.set(RunSettingsId::TIMESTEPPING_INITIAL_TIMESTEP, 0.01_f)
.set(RunSettingsId::TIMESTEPPING_MAX_TIMESTEP, 10._f)
.set(RunSettingsId::TIMESTEPPING_COURANT_NUMBER, 0.2_f)
.set(RunSettingsId::RUN_START_TIME, timeRange.lower())
.set(RunSettingsId::RUN_END_TIME, timeRange.upper())
.set(RunSettingsId::RUN_NAME, name)
.set(RunSettingsId::RUN_OUTPUT_INTERVAL, timeRange.size() / dumpCnt)
.set(RunSettingsId::RUN_OUTPUT_TYPE, IoEnum::NONE)
.set(RunSettingsId::RUN_OUTPUT_NAME, getIdentifier(name) + "_%d.ssf")
.set(RunSettingsId::RUN_VERBOSE_NAME, getIdentifier(name) + ".log")
.set(RunSettingsId::SPH_SOLVER_TYPE, SolverEnum::ASYMMETRIC_SOLVER)
.set(RunSettingsId::SPH_SOLVER_FORCES,
ForceEnum::PRESSURE | ForceEnum::SOLID_STRESS | ForceEnum::SELF_GRAVITY)
.set(RunSettingsId::SPH_DISCRETIZATION, DiscretizationEnum::STANDARD)
.set(RunSettingsId::SPH_FINDER, FinderEnum::KD_TREE)
.set(RunSettingsId::SPH_AV_TYPE, ArtificialViscosityEnum::STANDARD)
.set(RunSettingsId::SPH_AV_ALPHA, 1.5_f)
.set(RunSettingsId::SPH_AV_BETA, 3._f)
.set(RunSettingsId::SPH_KERNEL, KernelEnum::CUBIC_SPLINE)
.set(RunSettingsId::GRAVITY_SOLVER, GravityEnum::BARNES_HUT)
.set(RunSettingsId::GRAVITY_KERNEL, GravityKernelEnum::SPH_KERNEL)
.set(RunSettingsId::GRAVITY_OPENING_ANGLE, 0.8_f)
.set(RunSettingsId::GRAVITY_RECOMPUTATION_PERIOD, 5._f)
.set(RunSettingsId::FINDER_LEAF_SIZE, 20)
.set(RunSettingsId::SPH_STABILIZATION_DAMPING, 0.1_f)
.set(RunSettingsId::RUN_THREAD_GRANULARITY, 1000)
.set(RunSettingsId::SPH_ADAPTIVE_SMOOTHING_LENGTH, EMPTY_FLAGS)
.set(RunSettingsId::SPH_ASYMMETRIC_COMPUTE_RADII_HASH_MAP, false)
.set(RunSettingsId::SPH_STRAIN_RATE_CORRECTION_TENSOR, true)
.set(RunSettingsId::RUN_DIAGNOSTICS_INTERVAL, 1._f);
return settings;
}
VirtualSettings SphJob::getSettings() {
VirtualSettings connector;
addGenericCategory(connector, instName);
addTimeSteppingCategory(connector, settings, isResumed);
auto stressEnabler = [this] {
return settings.getFlags<ForceEnum>(RunSettingsId::SPH_SOLVER_FORCES).has(ForceEnum::SOLID_STRESS);
};
auto avEnabler = [this] {
return settings.get<ArtificialViscosityEnum>(RunSettingsId::SPH_AV_TYPE) !=
ArtificialViscosityEnum::NONE;
};
auto asEnabler = [this] { return settings.get<bool>(RunSettingsId::SPH_AV_USE_STRESS); };
// auto acEnabler = [this] { return settings.get<bool>(RunSettingsId::SPH_USE_AC); };
auto deltaSphEnabler = [this] { return settings.get<bool>(RunSettingsId::SPH_USE_DELTASPH); };
auto enforceEnabler = [this] {
return settings.getFlags<SmoothingLengthEnum>(RunSettingsId::SPH_ADAPTIVE_SMOOTHING_LENGTH)
.has(SmoothingLengthEnum::SOUND_SPEED_ENFORCING);
};
VirtualSettings::Category& solverCat = connector.addCategory("SPH solver");
solverCat.connect<Flags<ForceEnum>>("Forces", settings, RunSettingsId::SPH_SOLVER_FORCES);
solverCat.connect<Vector>("Constant acceleration", settings, RunSettingsId::FRAME_CONSTANT_ACCELERATION);
solverCat.connect<Float>("Tides mass [M_earth]", settings, RunSettingsId::FRAME_TIDES_MASS)
.setUnits(Constants::M_earth);
solverCat.connect<Vector>("Tides position [R_earth]", settings, RunSettingsId::FRAME_TIDES_POSITION)
.setUnits(Constants::R_earth);
solverCat.connect<EnumWrapper>("Solver type", settings, RunSettingsId::SPH_SOLVER_TYPE);
solverCat.connect<EnumWrapper>("SPH discretization", settings, RunSettingsId::SPH_DISCRETIZATION);
solverCat.connect<Flags<SmoothingLengthEnum>>(
"Adaptive smoothing length", settings, RunSettingsId::SPH_ADAPTIVE_SMOOTHING_LENGTH);
solverCat.connect<Float>("Minimal smoothing length", settings, RunSettingsId::SPH_SMOOTHING_LENGTH_MIN)
.setEnabler([this] {
return settings.getFlags<SmoothingLengthEnum>(RunSettingsId::SPH_ADAPTIVE_SMOOTHING_LENGTH) !=
EMPTY_FLAGS;
});
solverCat
.connect<Float>("Neighbor count enforcing strength", settings, RunSettingsId::SPH_NEIGHBOR_ENFORCING)
.setEnabler(enforceEnabler);
solverCat.connect<Interval>("Neighbor range", settings, RunSettingsId::SPH_NEIGHBOR_RANGE)
.setEnabler(enforceEnabler);
solverCat
.connect<bool>("Use radii hash map", settings, RunSettingsId::SPH_ASYMMETRIC_COMPUTE_RADII_HASH_MAP)
.setEnabler([this] {
return settings.get<SolverEnum>(RunSettingsId::SPH_SOLVER_TYPE) == SolverEnum::ASYMMETRIC_SOLVER;
});
solverCat
.connect<bool>("Apply correction tensor", settings, RunSettingsId::SPH_STRAIN_RATE_CORRECTION_TENSOR)
.setEnabler(stressEnabler);
solverCat.connect<bool>("Sum only undamaged particles", settings, RunSettingsId::SPH_SUM_ONLY_UNDAMAGED);
solverCat.connect<EnumWrapper>("Continuity mode", settings, RunSettingsId::SPH_CONTINUITY_MODE);
solverCat.connect<EnumWrapper>("Neighbor finder", settings, RunSettingsId::SPH_FINDER);
solverCat.connect<EnumWrapper>("Boundary condition", settings, RunSettingsId::DOMAIN_BOUNDARY);
VirtualSettings::Category& avCat = connector.addCategory("Artificial viscosity");
avCat.connect<EnumWrapper>("Artificial viscosity type", settings, RunSettingsId::SPH_AV_TYPE);
avCat.connect<bool>("Apply Balsara switch", settings, RunSettingsId::SPH_AV_USE_BALSARA)
.setEnabler(avEnabler);
avCat.connect<Float>("Artificial viscosity alpha", settings, RunSettingsId::SPH_AV_ALPHA)
.setEnabler(avEnabler);
avCat.connect<Float>("Artificial viscosity beta", settings, RunSettingsId::SPH_AV_BETA)
.setEnabler(avEnabler);
avCat.connect<bool>("Apply artificial stress", settings, RunSettingsId::SPH_AV_USE_STRESS);
avCat.connect<Float>("Artificial stress factor", settings, RunSettingsId::SPH_AV_STRESS_FACTOR)
.setEnabler(asEnabler);
avCat.connect<Float>("Artificial stress exponent", settings, RunSettingsId::SPH_AV_STRESS_EXPONENT)
.setEnabler(asEnabler);
avCat.connect<bool>("Apply artificial conductivity", settings, RunSettingsId::SPH_USE_AC);
avCat.connect<EnumWrapper>("Signal speed", settings, RunSettingsId::SPH_AC_SIGNAL_SPEED)
.setEnabler([this] { return settings.get<bool>(RunSettingsId::SPH_USE_AC); });
VirtualSettings::Category& modCat = connector.addCategory("SPH modifications");
modCat.connect<bool>("Enable XPSH", settings, RunSettingsId::SPH_USE_XSPH);
modCat.connect<Float>("XSPH epsilon", settings, RunSettingsId::SPH_XSPH_EPSILON).setEnabler([this] {
return settings.get<bool>(RunSettingsId::SPH_USE_XSPH);
});
modCat.connect<bool>("Enable delta-SPH", settings, RunSettingsId::SPH_USE_DELTASPH);
modCat.connect<Float>("delta-SPH alpha", settings, RunSettingsId::SPH_VELOCITY_DIFFUSION_ALPHA)
.setEnabler(deltaSphEnabler);
modCat.connect<Float>("delta-SPH delta", settings, RunSettingsId::SPH_DENSITY_DIFFUSION_DELTA)
.setEnabler(deltaSphEnabler);
auto scriptEnabler = [this] { return settings.get<bool>(RunSettingsId::SPH_SCRIPT_ENABLE); };
VirtualSettings::Category& scriptCat = connector.addCategory("Scripts");
scriptCat.connect<bool>("Enable script", settings, RunSettingsId::SPH_SCRIPT_ENABLE);
scriptCat.connect<Path>("Script file", settings, RunSettingsId::SPH_SCRIPT_FILE)
.setEnabler(scriptEnabler)
.setPathType(IVirtualEntry::PathType::INPUT_FILE)
.setFileFormats({ { "Chaiscript script", "chai" } });
scriptCat.connect<Float>("Script period [s]", settings, RunSettingsId::SPH_SCRIPT_PERIOD)
.setEnabler(scriptEnabler);
scriptCat.connect<bool>("Run only once", settings, RunSettingsId::SPH_SCRIPT_ONESHOT)
.setEnabler(scriptEnabler);
addGravityCategory(connector, settings);
addOutputCategory(connector, settings, *this);
addLoggerCategory(connector, settings);
return connector;
}
AutoPtr<IRun> SphJob::getRun(const RunSettings& overrides) const {
SPH_ASSERT(overrides.size() < 15); // not really required, just checking that we don't override everything
const BoundaryEnum boundary = settings.get<BoundaryEnum>(RunSettingsId::DOMAIN_BOUNDARY);
SharedPtr<IDomain> domain;
if (boundary != BoundaryEnum::NONE) {
domain = this->getInput<IDomain>("boundary");
}
RunSettings run = overrideSettings(settings, overrides, isResumed);
if (!run.getFlags<ForceEnum>(RunSettingsId::SPH_SOLVER_FORCES).has(ForceEnum::SOLID_STRESS)) {
run.set(RunSettingsId::SPH_STRAIN_RATE_CORRECTION_TENSOR, false);
}
return makeAuto<SphRun>(run, domain);
}
static JobRegistrar sRegisterSph(
"SPH run",
"simulations",
[](const std::string& name) { return makeAuto<SphJob>(name, EMPTY_SETTINGS); },
"Runs a SPH simulation, using provided initial conditions.");
// ----------------------------------------------------------------------------------------------------------
// SphStabilizationJob
// ----------------------------------------------------------------------------------------------------------
class SphStabilizationRun : public SphRun {
public:
using SphRun::SphRun;
virtual void setUp(SharedPtr<Storage> storage) override {
AutoPtr<IBoundaryCondition> bc = Factory::getBoundaryConditions(settings, domain);
solver = makeAuto<StabilizationSolver>(*scheduler, settings, std::move(bc));
for (Size matId = 0; matId < storage->getMaterialCnt(); ++matId) {
solver->create(*storage, storage->getMaterial(matId));
}
}
};
VirtualSettings SphStabilizationJob::getSettings() {
VirtualSettings connector = SphJob::getSettings();
VirtualSettings::Category& stabCat = connector.addCategory("Stabilization");
stabCat.connect<Float>("Damping coefficient", settings, RunSettingsId::SPH_STABILIZATION_DAMPING);
return connector;
}
AutoPtr<IRun> SphStabilizationJob::getRun(const RunSettings& overrides) const {
RunSettings run = overrideSettings(settings, overrides, isResumed);
const BoundaryEnum boundary = settings.get<BoundaryEnum>(RunSettingsId::DOMAIN_BOUNDARY);
SharedPtr<IDomain> domain;
if (boundary != BoundaryEnum::NONE) {
domain = this->getInput<IDomain>("boundary");
}
return makeAuto<SphStabilizationRun>(run, domain);
}
static JobRegistrar sRegisterSphStab(
"SPH stabilization",
"stabilization",
"simulations",
[](const std::string& name) { return makeAuto<SphStabilizationJob>(name, EMPTY_SETTINGS); },
"Runs a SPH simulation with a damping term, suitable for stabilization of non-equilibrium initial "
"conditions.");
// ----------------------------------------------------------------------------------------------------------
// NBodyJob
// ----------------------------------------------------------------------------------------------------------
class NBodyRun : public IRun {
private:
bool useSoft;
public:
NBodyRun(const RunSettings& run, const bool useSoft)
: useSoft(useSoft) {
settings = run;
scheduler = Factory::getScheduler(settings);
}
virtual void setUp(SharedPtr<Storage> storage) override {
logger = Factory::getLogger(settings);
const bool aggregateEnable = settings.get<bool>(RunSettingsId::NBODY_AGGREGATES_ENABLE);
const AggregateEnum aggregateSource =
settings.get<AggregateEnum>(RunSettingsId::NBODY_AGGREGATES_SOURCE);
if (aggregateEnable) {
AutoPtr<AggregateSolver> aggregates = makeAuto<AggregateSolver>(*scheduler, settings);
aggregates->createAggregateData(*storage, aggregateSource);
solver = std::move(aggregates);
} else if (useSoft) {
solver = makeAuto<SoftSphereSolver>(*scheduler, settings);
} else {
solver = makeAuto<HardSphereSolver>(*scheduler, settings);
}
NullMaterial mtl(BodySettings::getDefaults());
solver->create(*storage, mtl);
setPersistentIndices(*storage);
}
virtual void tearDown(const Storage& storage, const Statistics& stats) override {
output->dump(storage, stats);
}
};
NBodyJob::NBodyJob(const std::string& name, const RunSettings& overrides)
: IRunJob(name) {
settings = getDefaultSettings(name);
settings.addEntries(overrides);
}
RunSettings NBodyJob::getDefaultSettings(const std::string& name) {
const Interval timeRange(0, 1.e6_f);
RunSettings settings;
settings.set(RunSettingsId::RUN_NAME, name)
.set(RunSettingsId::RUN_TYPE, RunTypeEnum::NBODY)
.set(RunSettingsId::TIMESTEPPING_INTEGRATOR, TimesteppingEnum::LEAP_FROG)
.set(RunSettingsId::TIMESTEPPING_INITIAL_TIMESTEP, 0.01_f)
.set(RunSettingsId::TIMESTEPPING_MAX_TIMESTEP, 10._f)
.set(RunSettingsId::TIMESTEPPING_CRITERION, TimeStepCriterionEnum::ACCELERATION)
.set(RunSettingsId::TIMESTEPPING_DERIVATIVE_FACTOR, 0.2_f)
.set(RunSettingsId::RUN_START_TIME, timeRange.lower())
.set(RunSettingsId::RUN_END_TIME, timeRange.upper())
.set(RunSettingsId::RUN_OUTPUT_INTERVAL, timeRange.size() / 10)
.set(RunSettingsId::RUN_OUTPUT_TYPE, IoEnum::NONE)
.set(RunSettingsId::RUN_OUTPUT_NAME, getIdentifier(name) + "_%d.ssf")
.set(RunSettingsId::RUN_VERBOSE_NAME, getIdentifier(name) + ".log")
.set(RunSettingsId::SPH_FINDER, FinderEnum::KD_TREE)
.set(RunSettingsId::GRAVITY_SOLVER, GravityEnum::BARNES_HUT)
.set(RunSettingsId::GRAVITY_KERNEL, GravityKernelEnum::SOLID_SPHERES)
.set(RunSettingsId::GRAVITY_OPENING_ANGLE, 0.8_f)
.set(RunSettingsId::FINDER_LEAF_SIZE, 20)
.set(RunSettingsId::COLLISION_HANDLER, CollisionHandlerEnum::MERGE_OR_BOUNCE)
.set(RunSettingsId::COLLISION_OVERLAP, OverlapEnum::PASS_OR_MERGE)
.set(RunSettingsId::COLLISION_RESTITUTION_NORMAL, 0.5_f)
.set(RunSettingsId::COLLISION_RESTITUTION_TANGENT, 1._f)
.set(RunSettingsId::COLLISION_ALLOWED_OVERLAP, 0.01_f)
.set(RunSettingsId::COLLISION_BOUNCE_MERGE_LIMIT, 4._f)
.set(RunSettingsId::COLLISION_ROTATION_MERGE_LIMIT, 1._f)
.set(RunSettingsId::NBODY_INERTIA_TENSOR, false)
.set(RunSettingsId::NBODY_MAX_ROTATION_ANGLE, 0.01_f)
.set(RunSettingsId::RUN_THREAD_GRANULARITY, 100);
return settings;
}
VirtualSettings NBodyJob::getSettings() {
VirtualSettings connector;
addGenericCategory(connector, instName);
addTimeSteppingCategory(connector, settings, isResumed);
addGravityCategory(connector, settings);
VirtualSettings::Category& aggregateCat = connector.addCategory("Aggregates (experimental)");
aggregateCat.connect<bool>("Enable aggregates", settings, RunSettingsId::NBODY_AGGREGATES_ENABLE);
aggregateCat.connect<EnumWrapper>("Initial aggregates", settings, RunSettingsId::NBODY_AGGREGATES_SOURCE)
.setEnabler([this] { return settings.get<bool>(RunSettingsId::NBODY_AGGREGATES_ENABLE); });
VirtualSettings::Category& softCat = connector.addCategory("Soft-body physics (experimental)");
softCat.connect("Enable soft-body", "soft.enable", useSoft);
softCat.connect<Float>("Repel force strength", settings, RunSettingsId::SOFT_REPEL_STRENGTH)
.setEnabler([this] { return useSoft; });
softCat.connect<Float>("Friction force strength", settings, RunSettingsId::SOFT_FRICTION_STRENGTH)
.setEnabler([this] { return useSoft; });
auto collisionEnabler = [this] {
return !useSoft && !settings.get<bool>(RunSettingsId::NBODY_AGGREGATES_ENABLE) &&
settings.get<CollisionHandlerEnum>(RunSettingsId::COLLISION_HANDLER) !=
CollisionHandlerEnum::NONE;
};
auto mergeLimitEnabler = [this] {
if (useSoft) {
return false;
}
const CollisionHandlerEnum handler =
settings.get<CollisionHandlerEnum>(RunSettingsId::COLLISION_HANDLER);
if (handler == CollisionHandlerEnum::NONE) {
return false;
}
const bool aggregates = settings.get<bool>(RunSettingsId::NBODY_AGGREGATES_ENABLE);
const OverlapEnum overlap = settings.get<OverlapEnum>(RunSettingsId::COLLISION_OVERLAP);
return aggregates || handler == CollisionHandlerEnum::MERGE_OR_BOUNCE ||
overlap == OverlapEnum::PASS_OR_MERGE || overlap == OverlapEnum::REPEL_OR_MERGE;
};
VirtualSettings::Category& collisionCat = connector.addCategory("Collisions");
collisionCat.connect<EnumWrapper>("Collision handler", settings, RunSettingsId::COLLISION_HANDLER)
.setEnabler([this] { //
return !useSoft && !settings.get<bool>(RunSettingsId::NBODY_AGGREGATES_ENABLE);
});
collisionCat.connect<EnumWrapper>("Overlap handler", settings, RunSettingsId::COLLISION_OVERLAP)
.setEnabler(collisionEnabler);
collisionCat.connect<Float>("Normal restitution", settings, RunSettingsId::COLLISION_RESTITUTION_NORMAL)
.setEnabler(collisionEnabler);
collisionCat
.connect<Float>("Tangential restitution", settings, RunSettingsId::COLLISION_RESTITUTION_TANGENT)
.setEnabler(collisionEnabler);
collisionCat.connect<Float>("Merge velocity limit", settings, RunSettingsId::COLLISION_BOUNCE_MERGE_LIMIT)
.setEnabler(mergeLimitEnabler);
collisionCat
.connect<Float>("Merge rotation limit", settings, RunSettingsId::COLLISION_ROTATION_MERGE_LIMIT)
.setEnabler(mergeLimitEnabler);
addLoggerCategory(connector, settings);
addOutputCategory(connector, settings, *this);
return connector;
}
AutoPtr<IRun> NBodyJob::getRun(const RunSettings& overrides) const {
RunSettings run = overrideSettings(settings, overrides, isResumed);
return makeAuto<NBodyRun>(run, useSoft);
}
static JobRegistrar sRegisterNBody(
"N-body run",
"simulations",
[](const std::string& name) { return makeAuto<NBodyJob>(name, EMPTY_SETTINGS); },
"Runs N-body simulation using given initial conditions.");
NAMESPACE_SPH_END
| 49.702703
| 110
| 0.701939
|
pavelsevecek
|
e7a5d630bb54dff331aabbf8fa33f0f3ac2f5094
| 1,453
|
cpp
|
C++
|
test/ci_app_tests/ci_test_macros.cpp
|
daboehme/Caliper
|
38e2fc9a703601801ea8223a0bbd53795b6a0a3a
|
[
"BSD-3-Clause"
] | null | null | null |
test/ci_app_tests/ci_test_macros.cpp
|
daboehme/Caliper
|
38e2fc9a703601801ea8223a0bbd53795b6a0a3a
|
[
"BSD-3-Clause"
] | null | null | null |
test/ci_app_tests/ci_test_macros.cpp
|
daboehme/Caliper
|
38e2fc9a703601801ea8223a0bbd53795b6a0a3a
|
[
"BSD-3-Clause"
] | null | null | null |
// --- Caliper continuous integration test app for basic trace test
#define _XOPEN_SOURCE
#include <unistd.h> /* usleep */
#include "caliper/cali.h"
#include "caliper/cali-manager.h"
#include <string>
// test C and C++ macros
void foo(int count, int sleep_usec)
{
CALI_CXX_MARK_FUNCTION;
CALI_MARK_BEGIN("pre-loop");
CALI_WRAP_STATEMENT("foo.init", count = std::max(1, count));
CALI_MARK_END("pre-loop");
CALI_MARK_LOOP_BEGIN(fooloop, "fooloop");
for (int i = 0; i < count; ++i) {
CALI_MARK_ITERATION_BEGIN(fooloop, i);
if (sleep_usec > 0)
usleep(sleep_usec);
CALI_MARK_ITERATION_END(fooloop);
}
CALI_MARK_LOOP_END(fooloop);
}
int main(int argc, char* argv[])
{
int sleep_usec = 0;
if (argc > 1)
sleep_usec = std::stoi(argv[1]);
cali::ConfigManager mgr;
if (argc > 2)
if (std::string(argv[2]) != "none")
mgr.add(argv[2]);
if (mgr.error()) {
std::cerr << mgr.error_msg() << std::endl;
return -1;
}
mgr.start();
CALI_MARK_FUNCTION_BEGIN;
int count = 4;
if (argc > 3)
count = std::max(1, std::stoi(argv[3]));
CALI_CXX_MARK_LOOP_BEGIN(mainloop, "mainloop");
for (int i = 0; i < count; ++i) {
CALI_CXX_MARK_LOOP_ITERATION(mainloop, i);
foo(count, sleep_usec);
}
CALI_CXX_MARK_LOOP_END(mainloop);
CALI_MARK_FUNCTION_END;
mgr.flush();
}
| 19.90411
| 67
| 0.600826
|
daboehme
|
e7a94c5246962d4e68054e4b3d933b461ecbfd0f
| 242
|
cpp
|
C++
|
busplan/time_line.cpp
|
gonmator/busplan
|
5845b63b16741dd0472cbba1ba028bdfdcfe0e3f
|
[
"MIT"
] | null | null | null |
busplan/time_line.cpp
|
gonmator/busplan
|
5845b63b16741dd0472cbba1ba028bdfdcfe0e3f
|
[
"MIT"
] | null | null | null |
busplan/time_line.cpp
|
gonmator/busplan
|
5845b63b16741dd0472cbba1ba028bdfdcfe0e3f
|
[
"MIT"
] | null | null | null |
#include "time_line.hpp"
TimeLine applyDurations(const DifTimeLine& dtline, Time start) {
TimeLine rv{start};
for (auto duration: dtline.durations) {
start += duration;
rv.push_back(start);
}
return rv;
}
| 20.166667
| 64
| 0.636364
|
gonmator
|
e7ac4f836e9d104a170b2a09124fd497d5fc4d26
| 1,224
|
cpp
|
C++
|
2017-08-04 Formatting-Exercise-Cout-Iomanip/formatting-ex-cout.cpp
|
gnanakeethan/cpp
|
51f779d9981eb4644f6a5e6e923ba68585be7988
|
[
"CC0-1.0"
] | null | null | null |
2017-08-04 Formatting-Exercise-Cout-Iomanip/formatting-ex-cout.cpp
|
gnanakeethan/cpp
|
51f779d9981eb4644f6a5e6e923ba68585be7988
|
[
"CC0-1.0"
] | null | null | null |
2017-08-04 Formatting-Exercise-Cout-Iomanip/formatting-ex-cout.cpp
|
gnanakeethan/cpp
|
51f779d9981eb4644f6a5e6e923ba68585be7988
|
[
"CC0-1.0"
] | null | null | null |
#include <iostream>
using namespace std;
int main (void){
double up,qty,discr,total,disct,payable;
int width =20;
cout.width(width);
cout.setf(ios::left);
return 0;
cout << "Enter Unit Price" << ": ";
cin >> up;
cout.width(width);
cout.setf(ios::left);
cout << "Enter Quantity" << ": ";
cin >> qty;
cout.width(width);
cout.setf(ios::left);
cout << "Enter Discount Rate" << ": ";
cin >>discr;
cout << "\n\n\n";
total = up*qty;
disct = total*discr/100;
payable = total - disct;
cout.width(width);
cout.fill('.');
cout.setf(ios::fixed);
cout << "Total Price is" <<": " << "Rs ";
cout.precision(2);
cout.fill(' ');
cout.width(10);
cout.setf(ios::right);
cout << total <<endl;
cout.width(width);
cout.fill('.');
cout.unsetf(ios::right);
cout << "Discount is" <<": "<< "Rs ";
cout.fill(' ');
cout.width(10);
cout.precision(2);
cout.setf(ios::right);
cout << disct<<endl;
cout.unsetf(ios::right);cout.width(width);cout.fill('.');cout.precision(2);cout.setf(ios::fixed);
cout << "Payable is" << ": "<<"Rs ";
cout.width(10);
cout.fill(' ');
cout.setf(ios::right);
cout <<payable<<endl;
}
| 20.065574
| 100
| 0.553922
|
gnanakeethan
|
e7afbd5ed6f7ffe5bbdcaee1b8696d62c798252c
| 31,985
|
cpp
|
C++
|
src/expr/internal_functions.cpp
|
raptium/BaikalDB
|
cbc306bf3a1c709a93f191fdd389fb14eac0952f
|
[
"Apache-2.0"
] | null | null | null |
src/expr/internal_functions.cpp
|
raptium/BaikalDB
|
cbc306bf3a1c709a93f191fdd389fb14eac0952f
|
[
"Apache-2.0"
] | null | null | null |
src/expr/internal_functions.cpp
|
raptium/BaikalDB
|
cbc306bf3a1c709a93f191fdd389fb14eac0952f
|
[
"Apache-2.0"
] | null | null | null |
// Copyright (c) 2018-present Baidu, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "internal_functions.h"
#include <openssl/md5.h>
#include "hll_common.h"
#include "datetime.h"
#include <boost/date_time/gregorian/gregorian.hpp>
#include <cctype>
#include <cmath>
#include <algorithm>
namespace baikaldb {
static const int32_t DATE_FORMAT_LENGTH = 128;
static const std::vector<std::string> day_names = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"};
static const std::vector<std::string> month_names = {
"January", "February", "March", "April", "May",
"June", "July", "August", "September",
"October", "November", "December"};
ExprValue round(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
int bits = input.size() == 2 ? input[1].get_numberic<int>() : 0;
double base = std::pow(10, bits);
double orgin = input[0].get_numberic<double>();
ExprValue tmp(pb::DOUBLE);
if (base > 0) {
if (orgin < 0) {
tmp._u.double_val = -::round(-orgin * base) / base;
} else {
tmp._u.double_val = ::round(orgin * base) / base;
}
}
return tmp;
}
ExprValue floor(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::INT64);
tmp._u.int64_val = ::floor(input[0].get_numberic<double>());
return tmp;
}
ExprValue ceil(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::INT64);
tmp._u.int64_val = ::ceil(input[0].get_numberic<double>());
return tmp;
}
ExprValue abs(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = ::abs(input[0].get_numberic<double>());
return tmp;
}
ExprValue sqrt(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
double val = input[0].get_numberic<double>();
if (val < 0) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::sqrt(val);
return tmp;
}
ExprValue mod(const std::vector<ExprValue>& input) {
if (input.size() < 2 || input[0].is_null() || input[1].is_null()) {
return ExprValue::Null();
}
double rhs = input[1].get_numberic<double>();
if (float_equal(rhs, 0)) {
return ExprValue::Null();
}
double lhs = input[0].get_numberic<double>();
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::fmod(lhs, rhs);
return tmp;
}
ExprValue rand(const std::vector<ExprValue>& input) {
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = butil::fast_rand_double();
return tmp;
}
ExprValue sign(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::INT64);
double val = input[0].get_numberic<double>();
tmp._u.int64_val = val > 0 ? 1 : (val < 0 ? -1 : 0);
return tmp;
}
ExprValue sin(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::sin(input[0].get_numberic<double>());
return tmp;
}
ExprValue asin(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
double val = input[0].get_numberic<double>();
if (val < -1 || val > 1) {
return ExprValue::Null();
}
tmp._u.double_val = std::asin(val);
return tmp;
}
ExprValue cos(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::cos(input[0].get_numberic<double>());
return tmp;
}
ExprValue acos(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
double val = input[0].get_numberic<double>();
if (val < -1 || val > 1) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::acos(val);
return tmp;
}
ExprValue tan(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::tan(input[0].get_numberic<double>());
return tmp;
}
ExprValue cot(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
double val = input[0].get_numberic<double>();
double sin_val = std::sin(val);
double cos_val = std::cos(val);
if (float_equal(sin_val, 0)) {
return ExprValue::Null();
}
tmp._u.double_val = cos_val/sin_val;
return tmp;
}
ExprValue atan(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::atan(input[0].get_numberic<double>());
return tmp;
}
ExprValue ln(const std::vector<ExprValue>& input) {
if (input.size() < 1 || input[0].is_null()) {
return ExprValue::Null();
}
double val = input[0].get_numberic<double>();
if (val <= 0) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::log(input[0].get_numberic<double>());
return tmp;
}
ExprValue log(const std::vector<ExprValue>& input) {
if (input.size() < 2 || input[0].is_null() || input[1].is_null()) {
return ExprValue::Null();
}
double base = input[0].get_numberic<double>();
double val = input[1].get_numberic<double>();
if (base <= 0 || val <= 0 || base == 1) {
return ExprValue::Null();
}
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::log(val) / std::log(base);
return tmp;
}
ExprValue pow(const std::vector<ExprValue>& input) {
if (input.size() < 2 || input[0].is_null() || input[1].is_null()) {
return ExprValue::Null();
}
double base = input[0].get_numberic<double>();
double exp = input[1].get_numberic<double>();
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = std::pow(base, exp);
return tmp;
}
ExprValue pi(const std::vector<ExprValue>& input) {
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = M_PI;
return tmp;
}
ExprValue greatest(const std::vector<ExprValue>& input) {
bool find_flag = false;
double ret = std::numeric_limits<double>::lowest();
for (const auto& item : input) {
if (item.is_null()) {
return ExprValue::Null();
} else {
double val = item.get_numberic<double>();
if (!find_flag) {
find_flag = true;
ret = val;
} else {
if (val > ret) {
ret = val;
}
}
}
}
if (find_flag) {
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = ret;
return tmp;
} else {
return ExprValue::Null();
}
}
ExprValue least(const std::vector<ExprValue>& input) {
bool find_flag = false;
double ret = std::numeric_limits<double>::max();
for (const auto& item : input) {
if (item.is_null()) {
return ExprValue::Null();
} else {
double val = item.get_numberic<double>();
if (!find_flag) {
find_flag = true;
ret = val;
} else {
if (val < ret) {
ret = val;
}
}
}
}
if (find_flag) {
ExprValue tmp(pb::DOUBLE);
tmp._u.double_val = ret;
return tmp;
} else {
return ExprValue::Null();
}
}
ExprValue length(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::UINT32);
tmp._u.uint32_val = input[0].get_string().size();
return tmp;
}
ExprValue bit_length(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::UINT32);
tmp._u.uint32_val = input[0].get_string().size() * 8;
return tmp;
}
ExprValue lower(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].get_string();
std::transform(tmp.str_val.begin(), tmp.str_val.end(), tmp.str_val.begin(), ::tolower);
return tmp;
}
ExprValue lower_gbk(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].get_string();
std::string& literal = tmp.str_val;
size_t idx = 0;
while (idx < literal.size()) {
if ((literal[idx] & 0x80) != 0) {
idx += 2;
} else {
literal[idx] = tolower(literal[idx]);
idx++;
}
}
return tmp;
}
ExprValue upper(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].get_string();
std::transform(tmp.str_val.begin(), tmp.str_val.end(), tmp.str_val.begin(), ::toupper);
return tmp;
}
ExprValue concat(const std::vector<ExprValue>& input) {
ExprValue tmp(pb::STRING);
for (auto& s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
tmp.str_val += s.get_string();
}
return tmp;
}
ExprValue substr(const std::vector<ExprValue>& input) {
if (input.size() < 2) {
return ExprValue::Null();
}
for (auto& s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
}
std::string str = input[0].get_string();
ExprValue tmp(pb::STRING);
int pos = input[1].get_numberic<int>();
if (pos < 0) {
pos = str.size() + pos;
} else {
--pos;
}
if (pos < 0 || pos >= (int)str.size()) {
return tmp;
}
int len = -1;
if (input.size() == 3) {
len = input[2].get_numberic<int>();
if (len <= 0) {
return tmp;
}
}
tmp.str_val = str;
if (len == -1) {
tmp.str_val = tmp.str_val.substr(pos);
} else {
tmp.str_val = tmp.str_val.substr(pos, len);
}
return tmp;
}
ExprValue left(const std::vector<ExprValue>& input) {
if (input.size() < 2) {
return ExprValue::Null();
}
for (auto& s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
}
ExprValue tmp(pb::STRING);
int len = input[1].get_numberic<int>();
if (len <= 0) {
return tmp;
}
tmp.str_val = input[0].str_val;
tmp.str_val = tmp.str_val.substr(0, len);
return tmp;
}
ExprValue right(const std::vector<ExprValue>& input) {
if (input.size() < 2) {
return ExprValue::Null();
}
for (auto& s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
}
ExprValue tmp(pb::STRING);
int len = input[1].get_numberic<int>();
if (len <= 0) {
return tmp;
}
int pos = input[0].str_val.size() - len;
if (pos < 0) {
pos = 0;
}
tmp.str_val = input[0].str_val;
tmp.str_val = tmp.str_val.substr(pos);
return tmp;
}
ExprValue trim(const std::vector<ExprValue>& input) {
if (input.size() != 1) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].str_val;
tmp.str_val.erase(0, tmp.str_val.find_first_not_of(" "));
tmp.str_val.erase(tmp.str_val.find_last_not_of(" ") + 1);
return tmp;
}
ExprValue ltrim(const std::vector<ExprValue>& input) {
if (input.size() != 1) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].str_val;
tmp.str_val.erase(0, tmp.str_val.find_first_not_of(" "));
return tmp;
}
ExprValue rtrim(const std::vector<ExprValue>& input) {
if (input.size() != 1) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].str_val;
tmp.str_val.erase(tmp.str_val.find_last_not_of(" ") + 1);
return tmp;
}
ExprValue concat_ws(const std::vector<ExprValue>& input) {
if (input.size() < 2) {
return ExprValue::Null();
}
if (input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
bool first_push = false;
for (int i = 1; i < input.size(); i++) {
if (!input[i].is_null()) {
if (!first_push) {
first_push = true;
tmp.str_val = input[i].get_string();
} else {
tmp.str_val += input[0].get_string() + input[i].get_string();
}
}
}
if (!first_push) {
return ExprValue::Null();
}
return tmp;
}
ExprValue ascii(const std::vector<ExprValue>& input) {
if (input.size() < 1) {
return ExprValue::Null();
}
if (input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::INT32);
if (input[0].str_val.empty()) {
tmp._u.int32_val = 0;
} else {
tmp._u.int32_val = static_cast<int32_t>(input[0].str_val[0]);
}
return tmp;
}
ExprValue strcmp(const std::vector<ExprValue>& input) {
if (input.size() != 2) {
return ExprValue::Null();
}
ExprValue tmp(pb::INT32);
int64_t ret = input[0].compare(input[1]);
if (ret < 0) {
tmp._u.int32_val = -1;
} else if (ret > 0) {
tmp._u.int32_val = 1;
} else {
tmp._u.int32_val = 0;
}
return tmp;
}
ExprValue insert(const std::vector<ExprValue>& input) {
if (input.size() != 4) {
return ExprValue::Null();
}
for (auto s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
}
int pos = input[1].get_numberic<int>();
if (pos < 0) {
return input[0];
}
int len = input[2].get_numberic<int>();
if (len <= 0) {
return input[0];
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].str_val;
tmp.str_val.replace(pos, len, input[2].str_val);
return tmp;
}
ExprValue replace(const std::vector<ExprValue>& input) {
if (input.size() != 3) {
return ExprValue::Null();
}
if (input[0].is_null()) {
return ExprValue::Null();
}
if (input[1].str_val.empty()) {
return input[0];
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].str_val;
for (auto pos = 0; pos != std::string::npos; pos += input[2].str_val.length()) {
pos = tmp.str_val.find(input[1].str_val, pos);
if (pos != std::string::npos) {
tmp.str_val.replace(pos, input[1].str_val.length(), input[2].str_val);
} else {
break;
}
}
return tmp;
}
ExprValue repeat(const std::vector<ExprValue>& input) {
if (input.size() != 2) {
return ExprValue::Null();
}
if (input[0].is_null()) {
return ExprValue::Null();
}
int len = input[1].get_numberic<int>();
if (len <= 0) {
return ExprValue::Null();
}
std::string val = input[0].get_string();
ExprValue tmp(pb::STRING);
tmp.str_val.reserve(val.size() * len);
for (int i = 0; i < len; i++) {
tmp.str_val += val;
}
return tmp;
}
ExprValue reverse(const std::vector<ExprValue>& input) {
if (input.size() != 1) {
return ExprValue::Null();
}
if (input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
tmp.str_val = input[0].get_string();
std::reverse(tmp.str_val.begin(), tmp.str_val.end());
return tmp;
}
ExprValue locate(const std::vector<ExprValue>& input) {
if (input.size() < 2 || input.size() > 3) {
return ExprValue::Null();
}
for (auto s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
}
int begin_pos = 0;
if (input.size() == 3) {
begin_pos = input[2].get_numberic<int>();
}
ExprValue tmp(pb::INT32);
auto pos = input[1].str_val.find(input[0].str_val, begin_pos);
if (pos != std::string::npos) {
tmp._u.int32_val = pos;
} else {
tmp._u.int32_val = 0;
}
return tmp;
}
ExprValue unix_timestamp(const std::vector<ExprValue>& input) {
ExprValue tmp(pb::UINT32);
if (input.size() == 0) {
tmp._u.uint32_val = time(NULL);
} else {
if (input[0].is_null()) {
return ExprValue::Null();
}
ExprValue in = input[0];
if (in.type == pb::INT64) {
in.cast_to(pb::STRING);
}
tmp._u.uint32_val = in.cast_to(pb::TIMESTAMP)._u.uint32_val;
}
return tmp;
}
ExprValue from_unixtime(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::TIMESTAMP);
tmp._u.uint32_val = input[0].get_numberic<uint32_t>();
return tmp;
}
ExprValue now(const std::vector<ExprValue>& input) {
return ExprValue::Now();
}
ExprValue date_format(const std::vector<ExprValue>& input) {
if (input.size() != 2) {
return ExprValue::Null();
}
for (auto& s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
}
ExprValue tmp = input[0];
time_t t = tmp.cast_to(pb::TIMESTAMP)._u.uint32_val;
struct tm t_result;
localtime_r(&t, &t_result);
char s[DATE_FORMAT_LENGTH];
strftime(s, sizeof(s), input[1].str_val.c_str(), &t_result);
ExprValue format_result(pb::STRING);
format_result.str_val = s;
return format_result;
}
ExprValue timediff(const std::vector<ExprValue>& input) {
if (input.size() < 2) {
return ExprValue::Null();
}
for (auto& s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
}
ExprValue arg1 = input[0];
ExprValue arg2 = input[1];
int32_t seconds = arg1.cast_to(pb::TIMESTAMP)._u.uint32_val -
arg2.cast_to(pb::TIMESTAMP)._u.uint32_val;
ExprValue ret(pb::TIME);
ret._u.int32_val = seconds_to_time(seconds);
return ret;
}
ExprValue timestampdiff(const std::vector<ExprValue>& input) {
if (input.size() < 3) {
return ExprValue::Null();
}
for (auto& s : input) {
if (s.is_null()) {
return ExprValue::Null();
}
}
ExprValue arg2 = input[1];
ExprValue arg3 = input[2];
int32_t seconds = arg3.cast_to(pb::TIMESTAMP)._u.uint32_val -
arg2.cast_to(pb::TIMESTAMP)._u.uint32_val;
ExprValue ret(pb::INT64);
if (input[0].str_val == "second") {
ret._u.int64_val = seconds;
} else if (input[0].str_val == "minute") {
ret._u.int64_val = seconds / 60;
} else if (input[0].str_val == "hour") {
ret._u.int64_val = seconds / 3600;
} else if (input[0].str_val == "day") {
ret._u.int64_val = seconds / (24 * 3600);
} else {
// un-support
return ExprValue::Null();
}
return ret;
}
ExprValue curdate(const std::vector<ExprValue>& input) {
ExprValue tmp(pb::DATE);
uint64_t datetime = timestamp_to_datetime(time(NULL));
tmp._u.uint32_val = (datetime >> 41) & 0x3FFFFF;
return tmp;
}
ExprValue current_date(const std::vector<ExprValue>& input) {
return curdate(input);
}
ExprValue curtime(const std::vector<ExprValue>& input) {
ExprValue tmp(pb::TIME);
uint64_t datetime = timestamp_to_datetime(time(NULL));
tmp._u.int32_val = datetime_to_time(datetime);
return tmp;
}
ExprValue current_time(const std::vector<ExprValue>& input) {
return curtime(input);
}
ExprValue day(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue in = input[0];
if (in.type == pb::INT64) {
in.cast_to(pb::STRING);
}
ExprValue tmp(pb::UINT32);
time_t t = in.cast_to(pb::TIMESTAMP)._u.uint32_val;
struct tm tm;
localtime_r(&t, &tm);
tmp._u.uint32_val = tm.tm_mday;
return tmp;
}
ExprValue dayname(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::STRING);
uint32_t week_num = dayofweek(input)._u.uint32_val;
if (week_num <= day_names.size()) {
tmp.str_val = day_names[week_num - 1];
}
return tmp;
}
ExprValue monthname(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
uint32_t month_num = month(input)._u.uint32_val;
ExprValue tmp(pb::STRING);
if (month_num <= month_names.size()) {
tmp.str_val = month_names[month_num - 1];
}
return tmp;
}
ExprValue dayofweek(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue in = input[0];
if (in.type == pb::INT64) {
in.cast_to(pb::STRING);
}
ExprValue tmp(pb::UINT32);
time_t t = in.cast_to(pb::TIMESTAMP)._u.uint32_val;
struct tm tm;
localtime_r(&t, &tm);
boost::gregorian::date today(tm.tm_year + 1900, ++tm.tm_mon, tm.tm_mday);
/*
DAYOFWEEK(d) 函数返回 d 对应的一周中的索引(位置)。1 表示周日,2 表示周一,……,7 表示周六
*/
tmp._u.uint32_val = today.day_of_week() + 1;
return tmp;
}
ExprValue dayofmonth(const std::vector<ExprValue>& input) {
return day(input);
}
ExprValue month(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue in = input[0];
if (in.type == pb::INT64) {
in.cast_to(pb::STRING);
}
ExprValue tmp(pb::UINT32);
time_t t = in.cast_to(pb::TIMESTAMP)._u.uint32_val;
struct tm tm;
localtime_r(&t, &tm);
tmp._u.uint32_val = ++tm.tm_mon;
return tmp;
}
ExprValue year(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue in = input[0];
if (in.type == pb::INT64) {
in.cast_to(pb::STRING);
}
ExprValue tmp(pb::UINT32);
time_t t = in.cast_to(pb::TIMESTAMP)._u.uint32_val;
struct tm tm;
localtime_r(&t, &tm);
tmp._u.uint32_val = tm.tm_year + 1900;
return tmp;
}
ExprValue time_to_sec(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue tmp(pb::INT32);
ExprValue in = input[0];
time_t time = in.cast_to(pb::TIME)._u.int32_val;
bool minus = false;
if (time < 0) {
minus = true;
time = -time;
}
uint32_t hour = (time >> 12) & 0x3FF;
uint32_t min = (time >> 6) & 0x3F;
uint32_t sec = time & 0x3F;
uint32_t sec_sum = hour * 3600 + min * 60 + sec;
if (!minus) {
tmp._u.int32_val = sec_sum;
} else {
tmp._u.int32_val = -sec_sum;
}
return tmp;
}
ExprValue sec_to_time(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue in = input[0];
if (in.type == pb::STRING) {
in.cast_to(pb::INT32);
}
int32_t secs = in._u.int32_val;
bool minus = false;
if (secs < 0) {
minus = true;
secs = - secs;
}
ExprValue tmp(pb::TIME);
uint32_t hour = secs / 3600;
uint32_t min = (secs - hour * 3600) / 60;
uint32_t sec = secs % 60;
int32_t time = 0;
time |= sec;
time |= (min << 6);
time |= (hour << 12);
if (minus) {
time = -time;
}
tmp._u.int32_val = time;
return tmp;
}
ExprValue dayofyear(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue in = input[0];
if (in.type == pb::INT64) {
in.cast_to(pb::STRING);
}
ExprValue tmp(pb::UINT32);
time_t t = in.cast_to(pb::TIMESTAMP)._u.uint32_val;
struct tm tm;
localtime_r(&t, &tm);
boost::gregorian::date today(tm.tm_year += 1900, ++tm.tm_mon, tm.tm_mday);
tmp._u.uint32_val = today.day_of_year();
return tmp;
}
ExprValue weekday(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue in = input[0];
if (in.type == pb::INT64) {
in.cast_to(pb::STRING);
}
ExprValue one = input[0];
time_t t = one.cast_to(pb::TIMESTAMP)._u.uint32_val;
struct tm tm;
localtime_r(&t, &tm);
boost::gregorian::date today(tm.tm_year + 1900, ++tm.tm_mon, tm.tm_mday);
ExprValue tmp(pb::UINT32);
uint32_t day_of_week = today.day_of_week();
if (day_of_week >= 1) {
tmp._u.uint32_val = day_of_week - 1;
} else {
tmp._u.uint32_val = 6;
}
return tmp;
}
ExprValue week(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null()) {
return ExprValue::Null();
}
ExprValue one = input[0];
time_t t = one.cast_to(pb::TIMESTAMP)._u.uint32_val;
struct tm tm;
localtime_r(&t, &tm);
boost::gregorian::date today(tm.tm_year += 1900, ++tm.tm_mon, tm.tm_mday);
uint32_t week_number = today.week_number();
ExprValue tmp(pb::UINT32);
if (input.size() > 1) {
ExprValue two = input[1];
uint32_t mode = two.cast_to(pb::UINT32)._u.uint32_val;
if (!mode) {
week_number -= 1;
}
}
tmp._u.uint32_val = week_number;
return tmp;
}
ExprValue datediff(const std::vector<ExprValue>& input) {
if (input.size() == 0 || input[0].is_null() || input[1].is_null()) {
return ExprValue::Null();
}
ExprValue left = input[0];
if (left.type == pb::INT64) {
left.cast_to(pb::STRING);
}
ExprValue right = input[1];
if (right.type == pb::INT64) {
right.cast_to(pb::STRING);
}
time_t t1 = left.cast_to(pb::TIMESTAMP)._u.uint32_val;
time_t t2 = right.cast_to(pb::TIMESTAMP)._u.uint32_val;
ExprValue tmp(pb::INT32);
tmp._u.int32_val = (t1 - t2) / (3600 * 24);
return tmp;
}
ExprValue hll_add(const std::vector<ExprValue>& input) {
if (input.size() == 0) {
return ExprValue::Null();
}
if (!input[0].is_hll()) {
(ExprValue&)input[0] = hll::hll_init();
}
for (size_t i = 1; i < input.size(); i++) {
if (!input[i].is_null()) {
hll::hll_add((ExprValue&)input[0], input[i].hash());
}
}
return input[0];
}
ExprValue hll_init(const std::vector<ExprValue>& input) {
if (input.size() == 0) {
return ExprValue::Null();
}
ExprValue hll_init = hll::hll_init();
for (size_t i = 0; i < input.size(); i++) {
if (!input[i].is_null()) {
hll::hll_add(hll_init, input[i].hash());
}
}
return hll_init;
}
ExprValue hll_merge(const std::vector<ExprValue>& input) {
if (input.size() == 0) {
return ExprValue::Null();
}
if (!input[0].is_hll()) {
(ExprValue&)input[0] = hll::hll_init();
}
for (size_t i = 1; i < input.size(); i++) {
if (input[i].is_hll()) {
hll::hll_merge((ExprValue&)input[0], (ExprValue&)input[i]);
}
}
return input[0];
}
ExprValue hll_estimate(const std::vector<ExprValue>& input) {
if (input.size() == 0) {
return ExprValue::Null();
}
ExprValue tmp(pb::INT64);
if (input[0].is_null()) {
tmp._u.int64_val = 0;
return tmp;
}
tmp._u.int64_val = hll::hll_estimate(input[0]);
return tmp;
}
ExprValue case_when(const std::vector<ExprValue>& input) {
for (size_t i = 0; i < input.size() / 2; ++i) {
auto if_index = i * 2;
auto then_index = i * 2 + 1;
if (input[if_index].get_numberic<bool>()) {
return input[then_index];
}
}
//没有else分支, 返回null
if (input.size() % 2 == 0) {
return ExprValue();
} else {
return input[input.size() - 1];
}
}
ExprValue case_expr_when(const std::vector<ExprValue>& input) {
for (size_t i = 0; i < (input.size() - 1) / 2; ++i) {
auto if_index = i * 2 + 1;
auto then_index = i * 2 + 2;
if (input[0].compare(input[if_index]) == 0) {
return input[then_index];
}
}
//没有else分支, 返回null
if ((input.size() - 1) % 2 == 0) {
return ExprValue();
} else {
return input[input.size() - 1];
}
}
ExprValue if_(const std::vector<ExprValue>& input) {
if (input.size() != 3) {
return ExprValue::Null();
}
return input[0].get_numberic<bool>() ? input[1] : input[2];
}
ExprValue ifnull(const std::vector<ExprValue>& input) {
if (input.size() != 2) {
return ExprValue::Null();
}
return input[0].is_null() ? input[1] : input[0];
}
ExprValue nullif(const std::vector<ExprValue>& input) {
if (input.size() != 2) {
return ExprValue::Null();
}
ExprValue arg1 = input[0];
ExprValue arg2 = input[1];
if (arg1.compare_diff_type(arg2) == 0) {
return ExprValue::Null();
} else {
return input[0];
}
}
ExprValue murmur_hash(const std::vector<ExprValue>& input) {
if (input.size() == 0) {
return ExprValue::Null();
}
ExprValue tmp(pb::UINT64);
if (input.size() == 0) {
tmp._u.uint64_val = 0;
} else {
tmp._u.uint64_val = make_sign(input[0].str_val);
}
return tmp;
}
ExprValue md5(const std::vector<ExprValue>& input) {
if (input.size() == 0) {
return ExprValue::Null();
}
ExprValue orig = input[0];
if (orig.type != pb::STRING) {
orig.cast_to(pb::STRING);
}
ExprValue tmp(pb::STRING);
unsigned char md5_str[16] = {0};
MD5_CTX ctx;
MD5_Init(&ctx);
MD5_Update(&ctx, orig.str_val.c_str(), orig.str_val.size());
MD5_Final(md5_str, &ctx);
tmp.str_val.resize(32);
int j = 0;
static char const zEncode[] = "0123456789abcdef";
for (int i = 0; i < 16; i ++) {
int a = md5_str[i];
tmp.str_val[j++] = zEncode[(a >> 4) & 0xf];
tmp.str_val[j++] = zEncode[a & 0xf];
}
return tmp;
}
ExprValue sha1(const std::vector<ExprValue>& input) {
if (input.size() == 0) {
return ExprValue::Null();
}
ExprValue orig = input[0];
if (orig.type != pb::STRING) {
orig.cast_to(pb::STRING);
}
ExprValue tmp(pb::STRING);
tmp.str_val = butil::SHA1HashString(orig.str_val);
return tmp;
}
ExprValue sha(const std::vector<ExprValue>& input) {
return sha1(input);
}
}
/* vim: set ts=4 sw=4 sts=4 tw=100 */
| 27.175021
| 92
| 0.565421
|
raptium
|
e7b17965c6952e8f46fb8925e54fe64ff7be608e
| 202
|
cpp
|
C++
|
Problems_Beginner1/Problem_1002.cpp
|
gustavocabralsouza/Programacao_Competitiva
|
9b568cf968e6543ddeb12d626303cd53845a9ded
|
[
"MIT"
] | null | null | null |
Problems_Beginner1/Problem_1002.cpp
|
gustavocabralsouza/Programacao_Competitiva
|
9b568cf968e6543ddeb12d626303cd53845a9ded
|
[
"MIT"
] | null | null | null |
Problems_Beginner1/Problem_1002.cpp
|
gustavocabralsouza/Programacao_Competitiva
|
9b568cf968e6543ddeb12d626303cd53845a9ded
|
[
"MIT"
] | null | null | null |
#include<bits/stdc++.h>
using namespace std;
int main(){
double raio, pi, area;
pi = 3.14159;
scanf("%lf",&raio);
area = pi * raio * raio;
printf("A=%.4lf\n", area);
return 0;
}
| 12.625
| 28
| 0.549505
|
gustavocabralsouza
|
e7b2b7a86807ffa7b4c969eca45f7ee1f3217271
| 15,520
|
hpp
|
C++
|
osmi/ConnectionLinePreprocessor.hpp
|
johsin18/osmi-addresses
|
374f9a1d435ee7fe0ea6abb235fe4a8237e149d1
|
[
"BSL-1.0"
] | null | null | null |
osmi/ConnectionLinePreprocessor.hpp
|
johsin18/osmi-addresses
|
374f9a1d435ee7fe0ea6abb235fe4a8237e149d1
|
[
"BSL-1.0"
] | null | null | null |
osmi/ConnectionLinePreprocessor.hpp
|
johsin18/osmi-addresses
|
374f9a1d435ee7fe0ea6abb235fe4a8237e149d1
|
[
"BSL-1.0"
] | null | null | null |
#ifndef CONNECTIONLINEPREPROCESSOR_HPP_
#define CONNECTIONLINEPREPROCESSOR_HPP_
#include <math.h>
constexpr osmium::object_id_type DUMMY_ID = 0;
// maximum length of a connection line (given in degrees)
// the given value is not a strict limit: some connection lines may be longer (up to a factor of maybe 1.5)
// approximate length in meters = MAXDIST*40'000'000/360
constexpr double MAXDIST = 0.01;
constexpr bool IS_ADDRSTREET = true;
constexpr bool IS_ADDRPLACE = false;
#include "NearestPointsWriter.hpp"
#include "NearestRoadsWriter.hpp"
#include "NearestAreasWriter.hpp"
#include "ConnectionLineWriter.hpp"
#include "GeometryHelper.hpp"
class ConnectionLinePreprocessor {
public:
ConnectionLinePreprocessor(
const std::string& dir_name,
name2highways_type& name2highways_area,
name2highways_type& name2highways_nonarea,
name2place_type& name2place_nody,
name2place_type& name2place_wayy)
: mp_name2highways_area(name2highways_area),
mp_name2highways_nonarea(name2highways_nonarea),
m_name2place_nody(name2place_nody),
m_name2place_wayy(name2place_wayy),
addrstreet(nullptr) {
mp_nearest_points_writer = new NearestPointsWriter (dir_name);
mp_nearest_roads_writer = new NearestRoadsWriter (dir_name);
mp_nearest_areas_writer = new NearestAreasWriter (dir_name);
mp_connection_line_writer = new ConnectionLineWriter(dir_name);
}
~ConnectionLinePreprocessor() {
// those need to be explicitly to be deleted to perform the commit operations in their deconstructor
delete mp_nearest_points_writer;
delete mp_nearest_roads_writer;
delete mp_nearest_areas_writer;
delete mp_connection_line_writer;
}
void process_interpolated_node(
OGRPoint& ogr_point,
std::string& road_id, // out
std::string& nody_place_id, // out
std::string& wayy_place_id, // out
const std::string& street)
{
addrstreet = street.c_str();
if (addrstreet && has_entry_in_name2highways(street)) {
handle_connection_line(ogr_point, DUMMY_ID,
object_type::interpolated_node_object, addrstreet, road_id,
nody_place_id, wayy_place_id, IS_ADDRSTREET);
}
}
void process_node(
const osmium::Node& node,
std::string& road_id, // out
std::string& nody_place_id, // out
std::string& wayy_place_id) // out
{
addrstreet = node.tags().get_value_by_key("addr:street");
if (addrstreet && has_entry_in_name2highways(node)) {
std::unique_ptr<OGRPoint> ogr_point = m_factory.create_point(node);
handle_connection_line(*ogr_point.get(), node.id(),
object_type::node_object, addrstreet, road_id,
nody_place_id, wayy_place_id, IS_ADDRSTREET);
} else {
// road_id shall not be written by handle_connection_line
}
addrplace = node.tags().get_value_by_key("addr:place");
if (addrplace && has_entry_in_name2place(node)) {
std::unique_ptr<OGRPoint> ogr_point = m_factory.create_point(node);
handle_connection_line(*ogr_point.get(), node.id(),
object_type::node_object, addrplace, road_id,
nody_place_id, wayy_place_id, IS_ADDRPLACE);
} else {
// nody_place_id, wayy_place_id shall not be written by handle_connection_line
}
}
void process_way(
const osmium::Way& way,
std::string& road_id, // out
std::string& nody_place_id, // out
std::string& wayy_place_id) // out
{
if (way.is_closed()) {
addrstreet = way.tags().get_value_by_key("addr:street");
if (addrstreet && has_entry_in_name2highways(way)) {
std::unique_ptr<OGRPoint> ogr_point = m_geometry_helper.centroid(way);
handle_connection_line(*ogr_point.get(), way.id(),
object_type::way_object, addrstreet, road_id,
nody_place_id, wayy_place_id, IS_ADDRSTREET);
} else {
// road_id shall not be written by handle_connection_line
}
addrplace = way.tags().get_value_by_key("addr:place");
if (addrplace && has_entry_in_name2place(way)) {
std::unique_ptr<OGRPoint> ogr_point = m_geometry_helper.centroid(way);
handle_connection_line(*ogr_point.get(), way.id(),
object_type::way_object, addrplace, road_id,
nody_place_id, wayy_place_id, IS_ADDRPLACE);
} else {
// nody_place_id, wayy_place_id shall not be written by handle_connection_line
}
}
}
private:
void handle_connection_line(
OGRPoint& ogr_point, // TODO: can we make this const ?
const osmium::object_id_type& objectid,
const object_type& the_object_type,
const char* addrstreet,
std::string& road_id, // out
std::string& nody_place_id, // out
std::string& wayy_place_id, // out
const bool& is_addrstreet) {
std::unique_ptr<OGRPoint> closest_node(new OGRPoint);
std::unique_ptr<OGRPoint> closest_point(new OGRPoint); // TODO: check if new is necessary
std::unique_ptr<OGRLineString> closest_way(new OGRLineString); // TODO: check if new is necessary
osmium::unsigned_object_id_type closest_obj_id = 0; // gets written later; wouldn't need an initialization, but gcc warns otherwise
osmium::unsigned_object_id_type closest_way_id = 0; // gets written later; wouldn't need an initialization, but gcc warns otherwise
int ind_closest_node;
std::string lastchange;
bool is_area;
bool is_nody;
// handle addr:place here
if (is_addrstreet == IS_ADDRPLACE &&
get_closest_place(ogr_point, closest_point, is_nody, closest_obj_id, lastchange)) {
if (is_nody) {
nody_place_id = "1";
} else {
wayy_place_id = "1";
}
mp_connection_line_writer->write_line(ogr_point, closest_point, closest_obj_id, the_object_type);
}
// handle addr:street here
if (is_addrstreet == IS_ADDRSTREET &&
get_closest_way(ogr_point, closest_way, is_area, closest_way_id, lastchange)) {
m_geometry_helper.wgs2mercator({&ogr_point, closest_way.get(), closest_point.get()});
get_closest_node(ogr_point, closest_way, closest_node, ind_closest_node);
get_closest_point_from_node_neighbourhood(ogr_point, closest_way, ind_closest_node, closest_point);
m_geometry_helper.mercator2wgs({&ogr_point, closest_way.get(), closest_point.get()});
// TODO: could this be parallelized?
mp_nearest_points_writer->write_point(closest_point, closest_way_id);
if (is_area) {
mp_nearest_areas_writer->write_area(closest_way, closest_way_id, addrstreet, lastchange);
} else {
mp_nearest_roads_writer->write_road(closest_way, closest_way_id, addrstreet, lastchange);
}
mp_connection_line_writer->write_line(ogr_point, closest_point, objectid, the_object_type);
road_id = "1"; // TODO: need to write the actual road_id
}
}
// return value: was a closest place found/written
bool get_closest_place(
const OGRPoint& ogr_point,
std::unique_ptr<OGRPoint>& closest_point, // out
bool& is_nody, // out
osmium::unsigned_object_id_type& closest_obj_id,
std::string& lastchange) {
double best_dist = MAXDIST;
double cur_dist = std::numeric_limits<double>::max();
bool is_assigned = false;
std::pair<name2place_type::iterator, name2place_type::iterator> name2place_it_pair_nody;
std::pair<name2place_type::iterator, name2place_type::iterator> name2place_it_pair_wayy;
name2place_it_pair_nody = m_name2place_nody.equal_range(std::string(addrplace));
name2place_it_pair_wayy = m_name2place_wayy.equal_range(std::string(addrplace));
for (name2place_type::iterator it = name2place_it_pair_nody.first; it!=name2place_it_pair_nody.second; ++it) {
cur_dist = it->second.ogrpoint->Distance(&ogr_point);
if (cur_dist < best_dist) {
closest_point.reset(static_cast<OGRPoint*>(it->second.ogrpoint.get()->clone()));
is_nody = true;
is_assigned = true;
// TODO: extract more info from struct
}
}
for (name2place_type::iterator it = name2place_it_pair_wayy.first; it!=name2place_it_pair_wayy.second; ++it) {
cur_dist = it->second.ogrpoint->Distance(&ogr_point);
if (cur_dist < best_dist) { // TODO: add check for minimum distance to prevent long connection lines
closest_point.reset(static_cast<OGRPoint*>(it->second.ogrpoint.get()->clone()));
is_nody = false;
is_assigned = true;
// TODO: extract more info from struct
}
}
return is_assigned;
}
/* look up the closest way with the given name in the name2highway structs for ways and areas */
/* return: was a way found/assigned to closest_way */
bool get_closest_way(
const OGRPoint& ogr_point, // in
std::unique_ptr<OGRLineString>& closest_way, // out
bool& is_area, // out
osmium::unsigned_object_id_type& closest_way_id, // out
std::string& lastchange) // out
{
double best_dist = std::numeric_limits<double>::max();
bool is_assigned = false;
std::pair<name2highways_type::iterator, name2highways_type::iterator> name2highw_it_pair;
name2highw_it_pair = mp_name2highways_area.equal_range(std::string(addrstreet));
if (get_closest_way_from_argument(ogr_point, best_dist, closest_way, closest_way_id, lastchange, name2highw_it_pair)) {
is_area = true;
is_assigned = true;
}
name2highw_it_pair = mp_name2highways_nonarea.equal_range(std::string(addrstreet));
if (get_closest_way_from_argument(ogr_point, best_dist, closest_way, closest_way_id, lastchange, name2highw_it_pair)) {
is_area = false;
is_assigned = true;
}
return is_assigned;
}
/* look up the closest way in the given name2highway struct that is closer than best_dist using bbox
* return true if found */
bool get_closest_way_from_argument(
const OGRPoint& ogr_point, // in
double& best_dist, // in,out
std::unique_ptr<OGRLineString>& closest_way, // out
osmium::unsigned_object_id_type& closest_way_id, // out
std::string& lastchange, // out
const std::pair<name2highways_type::iterator, name2highways_type::iterator> name2highw_it_pair) { // in
double cur_dist;
bool assigned = false;
for (name2highways_type::iterator it = name2highw_it_pair.first; it!=name2highw_it_pair.second; ++it) {
if (m_geometry_helper.is_point_near_bbox(
it->second.bbox_n,
it->second.bbox_e,
it->second.bbox_s,
it->second.bbox_w,
ogr_point,
MAXDIST)) {
std::unique_ptr<OGRLineString> linestring = it->second.compr_way.get()->uncompress();
cur_dist = linestring->Distance(&ogr_point);
// note: distance calculation involves nodes, but not the points between the nodes on the line segments
if (cur_dist < best_dist) {
closest_way.reset(linestring.release());
closest_way_id = it->second.way_id;
lastchange = it->second.lastchange;
best_dist = cur_dist;
assigned = true;
}
}
}
return assigned;
}
/* get the node of closest_way that is most close ogr_point */
void get_closest_node(
const OGRPoint& ogr_point,
const std::unique_ptr<OGRLineString>& closest_way,
std::unique_ptr<OGRPoint>& closest_node,
int& ind_closest_node) {
double min_dist = std::numeric_limits<double>::max();
double dist;
OGRPoint closest_node_candidate;
// iterate over all points of the closest way
for (int i=0; i<closest_way->getNumPoints(); i++){
closest_way->getPoint(i, &closest_node_candidate);
dist = ogr_point.Distance(&closest_node_candidate);
if (dist < min_dist) {
min_dist = dist;
ind_closest_node = i;
}
}
closest_way->getPoint(ind_closest_node, closest_node.get());
}
/* given the linestring closest_way, return the point on it that is closest to ogr_point */
void get_closest_point_from_node_neighbourhood(
const OGRPoint& ogr_point,
const std::unique_ptr<OGRLineString>& closest_way,
const int& ind_closest_node,
std::unique_ptr<OGRPoint>& closest_point) // out
{
OGRPoint neighbour_node;
OGRPoint closest_point_candidate;
OGRPoint closest_node;
closest_way.get()->getPoint(ind_closest_node, &closest_node);
closest_point.reset(static_cast<OGRPoint*>(closest_node.clone()));
if (ind_closest_node > 0) {
closest_way->getPoint(ind_closest_node-1, &neighbour_node);
get_closest_point_from_segment(closest_node, neighbour_node, ogr_point, *closest_point.get());
// no if condition necessary here, because get_closest_point_from_segment()
// will return a point, that is at least as close as closest_node
}
if (ind_closest_node < closest_way->getNumPoints()-1) {
closest_way->getPoint(ind_closest_node+1, &neighbour_node);
get_closest_point_from_segment(closest_node, neighbour_node, ogr_point, closest_point_candidate);
if (ogr_point.Distance(&closest_point_candidate) < ogr_point.Distance(closest_point.get())) {
closest_point.reset(static_cast<OGRPoint*>(closest_point_candidate.clone()));
}
}
}
// based on: http://postgis.refractions.net/documentation/postgis-doxygen/da/de7/liblwgeom_8h_84b0e41df157ca1201ccae4da3e3ef7d.html#84b0e41df157ca1201ccae4da3e3ef7d
// see also: http://femto.cs.illinois.edu/faqs/cga-faq.html#S1.02
/* given a single line segment from a to b, return the point on it that is closest to p */
void get_closest_point_from_segment(
const OGRPoint& a,
const OGRPoint& b,
const OGRPoint& p,
OGRPoint& ret) {
double r;
r = ((p.getX()-a.getX()) * (b.getX()-a.getX()) + (p.getY()-a.getY()) * (b.getY()-a.getY())) / (pow(b.getX()-a.getX(),2)+pow(b.getY()-a.getY(),2));
if (r<0) {
ret = a;
} else if (r>1) {
ret = b;
} else {
OGRLineString linestring;
linestring.addPoint(a.getX(), a.getY());
linestring.addPoint(b.getX(), b.getY());
linestring.Value(r*linestring.get_Length(), &ret);
}
}
bool has_entry_in_name2highways(const osmium::OSMObject& object) {
return has_entry_in_name2highways(std::string(object.tags().get_value_by_key("addr:street")));
}
bool has_entry_in_name2highways(const std::string& addrstreet) {
if (mp_name2highways_nonarea.find(std::string(addrstreet)) != mp_name2highways_nonarea.end() || // TODO: use result directly
(mp_name2highways_area.find(std::string(addrstreet)) != mp_name2highways_area.end())) {
return true;
} else {
return false;
}
}
bool has_entry_in_name2place(const osmium::OSMObject& object) {
return has_entry_in_name2place(std::string(object.tags().get_value_by_key("addr:place")));
}
bool has_entry_in_name2place(const std::string& addrplace) {
if (m_name2place_nody.find(std::string(addrplace)) != m_name2place_nody.end() || // TODO: use result directly
(m_name2place_wayy.find(std::string(addrplace)) != m_name2place_wayy.end())) {
return true;
} else {
return false;
}
}
name2highways_type& mp_name2highways_area;
name2highways_type& mp_name2highways_nonarea;
name2place_type& m_name2place_nody;
name2place_type& m_name2place_wayy;
const char* addrstreet;
const char* addrplace;
osmium::geom::OGRFactory<> m_factory {};
NearestPointsWriter* mp_nearest_points_writer;
NearestRoadsWriter* mp_nearest_roads_writer;
NearestAreasWriter* mp_nearest_areas_writer;
ConnectionLineWriter* mp_connection_line_writer;
GeometryHelper m_geometry_helper;
};
#endif /* CONNECTIONLINEPREPROCESSOR_HPP_ */
| 36.690307
| 165
| 0.712436
|
johsin18
|
e7b3c87f107652f570bf0e8cced87e2e713d55c6
| 3,357
|
cpp
|
C++
|
test/gl/test_context.cpp
|
galaxysoftware/galaxy
|
b05af4aa071e32a0b0b067bfb80a236a90c87dde
|
[
"MIT"
] | null | null | null |
test/gl/test_context.cpp
|
galaxysoftware/galaxy
|
b05af4aa071e32a0b0b067bfb80a236a90c87dde
|
[
"MIT"
] | null | null | null |
test/gl/test_context.cpp
|
galaxysoftware/galaxy
|
b05af4aa071e32a0b0b067bfb80a236a90c87dde
|
[
"MIT"
] | null | null | null |
#include "gl/context.h"
#include "gl/environment.h"
#include "gl/mockglfw.h"
#include "gl/mockglxw.h"
#include <gmock/gmock.h>
using namespace gxy;
using testing::_;
using testing::InSequence;
using testing::NiceMock;
using testing::Return;
struct Fixture : public testing::Test
{
const int width{42};
const int height{89};
const std::string title{"badger"};
NiceMock<gl::mockglfw> mockglfw{};
NiceMock<gl::mockglxw> mockglxw{};
::GLFWwindow window{};
Fixture()
{
ON_CALL(mockglfw, Init())
.WillByDefault(Return(GL_TRUE));
ON_CALL(mockglxw, Init())
.WillByDefault(Return(0));
ON_CALL(mockglfw, CreateWindow(_, _, _, _, _))
.WillByDefault(Return(&window));
}
};
struct EnvironmentFixture : public Fixture
{
gl::environment env{};
};
TEST_F(EnvironmentFixture, CreateContext_CreatesWindow)
{
EXPECT_CALL(mockglfw, CreateWindow(width, height, title.c_str(), nullptr, nullptr))
.Times(1);
gl::context ctx{env, width, height, title.c_str()};
}
TEST_F(EnvironmentFixture, CreateContext_SetsWindowHintsBefore)
{
InSequence s;
EXPECT_CALL(mockglfw, WindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4))
.Times(1);
EXPECT_CALL(mockglfw, WindowHint(GLFW_CONTEXT_VERSION_MINOR, 1))
.Times(1);
EXPECT_CALL(mockglfw, WindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE))
.Times(1);
EXPECT_CALL(mockglfw, WindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE))
.Times(1);
EXPECT_CALL(mockglfw, CreateWindow(_, _, _, _, _))
.Times(1);
gl::context ctx{env, width, height, title.c_str()};
}
TEST_F(EnvironmentFixture, CreateContext_ResetWindowHintsAfter)
{
InSequence s;
EXPECT_CALL(mockglfw, CreateWindow(_, _, _, _, _))
.Times(1);
EXPECT_CALL(mockglfw, DefaultWindowHints())
.Times(1);
gl::context ctx{env, width, height, title.c_str()};
}
TEST_F(EnvironmentFixture, CreateContext_MakesContextCurrent)
{
EXPECT_CALL(mockglfw, MakeContextCurrent(&window))
.Times(1);
gl::context ctx{env, width, height, title.c_str()};
}
TEST_F(EnvironmentFixture, DestructContext_CallsDestroyWindow)
{
gl::context ctx{env, width, height, title.c_str()};
EXPECT_CALL(mockglfw, DestroyWindow(&window))
.Times(1);
}
using EnvironmentFixtureDeathTest = EnvironmentFixture;
TEST_F(EnvironmentFixtureDeathTest, CreateWindowReturnsNullptr_Death)
{
ASSERT_DEATH({
ON_CALL(mockglfw, CreateWindow(_, _, _, _, _))
.WillByDefault(Return(nullptr));
gl::context ctx(env, width, height, title.c_str());
}, "");
}
struct ContextFixture : public EnvironmentFixture
{
gl::context uut{env, width, height, title.c_str()};
};
TEST_F(ContextFixture, RunOneWindowShouldCloseTrue_ReturnsFalse)
{
EXPECT_CALL(mockglfw, WindowShouldClose(&window))
.WillOnce(Return(true));
ASSERT_FALSE(uut.run_one());
}
struct ContextFixtureWindowShouldntClose : public ContextFixture
{
ContextFixtureWindowShouldntClose()
{
ON_CALL(mockglfw, WindowShouldClose(&window))
.WillByDefault(Return(false));
}
};
TEST_F(ContextFixtureWindowShouldntClose, RunOne_ReturnsTrue)
{
ASSERT_TRUE(uut.run_one());
}
TEST_F(ContextFixtureWindowShouldntClose, RunOne_CallsSwapBuffersThenPollEvents)
{
InSequence s;
EXPECT_CALL(mockglfw, SwapBuffers(&window))
.Times(1);
EXPECT_CALL(mockglfw, PollEvents())
.Times(1);
uut.run_one();
}
| 21.519231
| 85
| 0.725052
|
galaxysoftware
|
e7b4b2d5aab6e9ec84745e940accc37779f2f3d5
| 5,904
|
cpp
|
C++
|
examples/machine_learning/logistic_regression.cpp
|
JuliaComputing/arrayfire
|
93427f09ff928f97df29c0e358c3fcf6b478bec6
|
[
"BSD-3-Clause"
] | 1
|
2018-06-14T23:49:18.000Z
|
2018-06-14T23:49:18.000Z
|
examples/machine_learning/logistic_regression.cpp
|
JuliaComputing/arrayfire
|
93427f09ff928f97df29c0e358c3fcf6b478bec6
|
[
"BSD-3-Clause"
] | 1
|
2015-07-02T15:53:02.000Z
|
2015-07-02T15:53:02.000Z
|
examples/machine_learning/logistic_regression.cpp
|
JuliaComputing/arrayfire
|
93427f09ff928f97df29c0e358c3fcf6b478bec6
|
[
"BSD-3-Clause"
] | 1
|
2018-02-26T17:11:03.000Z
|
2018-02-26T17:11:03.000Z
|
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <arrayfire.h>
#include <stdio.h>
#include <vector>
#include <string>
#include <af/util.h>
#include <math.h>
#include "mnist_common.h"
using namespace af;
float accuracy(const array& predicted, const array& target)
{
array val, plabels, tlabels;
max(val, tlabels, target, 1);
max(val, plabels, predicted, 1);
return 100 * count<float>(plabels == tlabels) / tlabels.elements();
}
float abserr(const array& predicted, const array& target)
{
return 100 * sum<float>(abs(predicted - target)) / predicted.elements();
}
// Activation function
array sigmoid(const array &val)
{
return 1 / (1 + exp(-val));
}
// Predict based on given parameters
array predict(const array &X, const array &Weights)
{
array Z = matmul(X, Weights);
return sigmoid(Z);
}
void cost(array &J, array &dJ, const array &Weights,
const array &X, const array &Y, double lambda = 1.0)
{
// Number of samples
int m = Y.dims(0);
// Make the lambda corresponding to Weights(0) == 0
array lambdat = constant(lambda, Weights.dims());
// No regularization for bias weights
lambdat(0, span) = 0;
// Get the prediction
array H = predict(X, Weights);
// Cost of misprediction
array Jerr = -sum(Y * log(H) + (1 - Y) * log(1 - H));
// Regularization cost
array Jreg = 0.5 * sum(lambdat * Weights * Weights);
// Total cost
J = (Jerr + Jreg) / m;
// Find the gradient of cost
array D = (H - Y);
dJ = (matmulTN(X, D) + lambdat * Weights) / m;
}
array train(const array &X, const array &Y,
double alpha = 0.1,
double lambda = 1.0,
double maxerr = 0.01,
int maxiter = 1000,
bool verbose = false)
{
// Initialize parameters to 0
array Weights = constant(0, X.dims(1), Y.dims(1));
array J, dJ;
float err = 0;
for (int i = 0; i < maxiter; i++) {
// Get the cost and gradient
cost(J, dJ, Weights, X, Y, lambda);
err = max<float>(abs(J));
if (err < maxerr) {
printf("Iteration %4d Err: %.4f\n", i + 1, err);
printf("Training converged\n");
return Weights;
}
if (verbose && ((i + 1) % 10 == 0)) {
printf("Iteration %4d Err: %.4f\n", i + 1, err);
}
// Update the parameters via gradient descent
Weights = Weights - alpha * dJ;
}
printf("Training stopped after %d iterations\n", maxiter);
return Weights;
}
void benchmark_logistic_regression(const array &train_feats,
const array &train_targets,
const array test_feats)
{
timer::start();
array Weights = train(train_feats, train_targets, 0.1, 1.0, 0.01, 1000);
af::sync();
printf("Training time: %4.4lf s\n", timer::stop());
timer::start();
const int iter = 100;
for (int i = 0; i < iter; i++) {
array test_outputs = predict(test_feats , Weights);
test_outputs.eval();
}
af::sync();
printf("Prediction time: %4.4lf s\n", timer::stop() / iter);
}
// Demo of one vs all logistic regression
int logit_demo(bool console, int perc)
{
array train_images, train_targets;
array test_images, test_targets;
int num_train, num_test, num_classes;
// Load mnist data
float frac = (float)(perc) / 100.0;
setup_mnist<true>(&num_classes, &num_train, &num_test,
train_images, test_images,
train_targets, test_targets, frac);
// Reshape images into feature vectors
int feature_length = train_images.elements() / num_train;
array train_feats = moddims(train_images, feature_length, num_train).T();
array test_feats = moddims(test_images , feature_length, num_test ).T();
train_targets = train_targets.T();
test_targets = test_targets.T();
// Add a bias that is always 1
train_feats = join(1, constant(1, num_train, 1), train_feats);
test_feats = join(1, constant(1, num_test , 1), test_feats );
// Train logistic regression parameters
array Weights = train(train_feats, train_targets,
0.1, // learning rate (aka alpha)
1.0, // regularization constant (aka weight decay, aka lamdba)
0.01, // maximum error
1000, // maximum iterations
true);// verbose
// Predict the results
array train_outputs = predict(train_feats, Weights);
array test_outputs = predict(test_feats , Weights);
printf("Accuracy on training data: %2.2f\n",
accuracy(train_outputs, train_targets ));
printf("Accuracy on testing data: %2.2f\n",
accuracy(test_outputs , test_targets ));
printf("Maximum error on testing data: %2.2f\n",
abserr(test_outputs , test_targets ));
benchmark_logistic_regression(train_feats, train_targets, test_feats);
if (!console) {
test_outputs = test_outputs.T();
// Get 20 random test images.
display_results<true>(test_images, test_outputs, test_targets.T(), 20);
}
return 0;
}
int main(int argc, char** argv)
{
int device = argc > 1 ? atoi(argv[1]) : 0;
bool console = argc > 2 ? argv[2][0] == '-' : false;
int perc = argc > 3 ? atoi(argv[3]) : 60;
try {
af::setDevice(device);
af::info();
return logit_demo(console, perc);
} catch (af::exception &ae) {
std::cerr << ae.what() << std::endl;
}
}
| 28.521739
| 89
| 0.581809
|
JuliaComputing
|
e7b6bace6b9662be476cf3b3c48f18776742bf57
| 325
|
cpp
|
C++
|
Arrays/staticdynamic.cpp
|
sans712/SDE-Interview-Questions
|
44f5bda60b9ed301b93a944e1c333d833c9b054b
|
[
"MIT"
] | null | null | null |
Arrays/staticdynamic.cpp
|
sans712/SDE-Interview-Questions
|
44f5bda60b9ed301b93a944e1c333d833c9b054b
|
[
"MIT"
] | null | null | null |
Arrays/staticdynamic.cpp
|
sans712/SDE-Interview-Questions
|
44f5bda60b9ed301b93a944e1c333d833c9b054b
|
[
"MIT"
] | null | null | null |
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int b[100]; //static
cout<<sizeof(b)<<endl;
cout<<b<<endl; //symbol table
int * a=new int[n]; //dynamic
cout<<sizeof(a)<<endl;
cout<<a<<endl;
for(int i=0;i<n;i++){
cin>>a[i];
cout<<a[i]<<" ";
}
cout<<endl;
delete [] a;
}
| 18.055556
| 41
| 0.535385
|
sans712
|
e7b7ddf12ac03a01ce7a57b655968d326ddc4310
| 7,355
|
cpp
|
C++
|
lib/src/AMRTools/CoarseAverageFace.cpp
|
rmrsk/Chombo-3.3
|
f2119e396460c1bb19638effd55eb71c2b35119e
|
[
"BSD-3-Clause-LBNL"
] | 10
|
2018-02-01T20:57:36.000Z
|
2022-03-17T02:57:49.000Z
|
lib/src/AMRTools/CoarseAverageFace.cpp
|
rmrsk/Chombo-3.3
|
f2119e396460c1bb19638effd55eb71c2b35119e
|
[
"BSD-3-Clause-LBNL"
] | 19
|
2018-10-04T21:37:18.000Z
|
2022-02-25T16:20:11.000Z
|
lib/src/AMRTools/CoarseAverageFace.cpp
|
rmrsk/Chombo-3.3
|
f2119e396460c1bb19638effd55eb71c2b35119e
|
[
"BSD-3-Clause-LBNL"
] | 11
|
2019-01-12T23:33:32.000Z
|
2021-08-09T15:19:50.000Z
|
#ifdef CH_LANG_CC
/*
* _______ __
* / ___/ / ___ __ _ / / ___
* / /__/ _ \/ _ \/ V \/ _ \/ _ \
* \___/_//_/\___/_/_/_/_.__/\___/
* Please refer to Copyright.txt, in Chombo's root directory.
*/
#endif
#include "CoarseAverageFace.H"
#include "AverageFaceF_F.H"
#include "NamespaceHeader.H"
// ----------------------------------------------------------
CoarseAverageFace::CoarseAverageFace() :
m_isDefined(false),
m_isAveraged(false)
{
}
// ----------------------------------------------------------
CoarseAverageFace::~CoarseAverageFace()
{
}
// ----------------------------------------------------------
CoarseAverageFace::CoarseAverageFace(const DisjointBoxLayout& a_fineGrids,
int a_nComp, int a_nRef)
:
m_isDefined(false),
m_isAveraged(false)
{
define(a_fineGrids, a_nComp, a_nRef);
}
// ----------------------------------------------------------
void
CoarseAverageFace::define(const DisjointBoxLayout& a_fineGrids,
int a_nComp, int a_nRef)
{
m_nRef = a_nRef;
DisjointBoxLayout coarsened_fine_domain;
coarsen(coarsened_fine_domain, a_fineGrids, m_nRef);
m_coarsenedFineData.define(coarsened_fine_domain, a_nComp);
m_isDefined = true;
m_isAveraged = false;
}
// ----------------------------------------------------------
bool
CoarseAverageFace::isDefined() const
{
return m_isDefined;
}
// ----------------------------------------------------------
void
CoarseAverageFace::average(const LevelData<FluxBox>& a_fineData)
{
average(a_fineData, arithmetic, m_nRef);
}
// ----------------------------------------------------------
void
CoarseAverageFace::averageHarmonic(const LevelData<FluxBox>& a_fineData)
{
average(a_fineData, harmonic, m_nRef);
}
// ----------------------------------------------------------
/** \param[in] a_refFactor
* Sum of fine values is divided by
* a_refFactor^(CH_SPACEDIM-1). For
* sums this should be set to one
* (default).
*/
void
CoarseAverageFace::sum(const LevelData<FluxBox>& a_fineData,
const int a_refFactor)
{
average(a_fineData, arithmetic, a_refFactor);
}
// ----------------------------------------------------------
void
CoarseAverageFace::copyTo(LevelData<FluxBox>& a_coarseData)
{
CH_assert(m_isAveraged);
// if coarseData's DisjointBoxLayout is not a simple coarsenening of
// the fine one, then it needs to have at least one ghost cell in
// order to ensure that this copyTo is done correctly. In
// particular, this is required in order to ensure that we handle
// the case where the coarse-fine interface is coincident with a
// coarse-coarse boundary. The other solution to this would be to
// build a specialized Copier for LevelData<FluxBox>, but we're
// hoping to avoid that for now...
if ((a_coarseData.ghostVect() == IntVect::Zero) && !(a_coarseData.getBoxes().compatible(m_coarsenedFineData.getBoxes())))
{
MayDay::Error("CoarseAverageFace requires that coarse data which is not a coarsenening of the fine grids have at least one ghost cell");
}
m_coarsenedFineData.copyTo(m_coarsenedFineData.interval(),
a_coarseData, a_coarseData.interval());
}
// ----------------------------------------------------------
// this function is shamelessly based on the ANAG CoarseAverage
// (cell-centered) version
void
CoarseAverageFace::averageToCoarse(LevelData<FluxBox>& a_coarseData,
const LevelData<FluxBox>& a_fineData)
{
computeAverages(a_coarseData, a_fineData, arithmetic);
}
// ----------------------------------------------------------
// this function is shamelessly based on the ANAG CoarseAverage
// (cell-centered) version
void
CoarseAverageFace::averageToCoarseHarmonic(LevelData<FluxBox>& a_coarseData,
const LevelData<FluxBox>& a_fineData)
{
computeAverages(a_coarseData, a_fineData, harmonic);
}
// ----------------------------------------------------------
void
CoarseAverageFace::computeAverages(LevelData<FluxBox>& a_coarseData,
const LevelData<FluxBox>& a_fineData,
int a_averageType)
{
average(a_fineData, a_averageType, m_nRef);
copyTo(a_coarseData);
}
// ----------------------------------------------------------
/** \param[in] a_refFactor
* Sum of fine values is divided by
* a_refFactor^(CH_SPACEDIM-1).
* Normally this is the refinement ratio
*/
void
CoarseAverageFace::average(const LevelData<FluxBox>& a_fineData,
const int a_averageType,
const int a_refFactor)
{
CH_assert(isDefined());
DataIterator dit = a_fineData.dataIterator();
for (dit.reset(); dit.ok(); ++dit)
{
FluxBox& coarsenedFine = m_coarsenedFineData[dit()];
const FluxBox& fine = a_fineData[dit()];
// coarsen from the entire fine grid onto the entire coarse grid
averageGridData(coarsenedFine, fine, a_averageType, a_refFactor);
}
m_isAveraged = true;
}
// ----------------------------------------------------------
/** \param[in] a_refFactor
* Sum of fine values is divided by
* a_refFactor^(CH_SPACEDIM-1).
* Normally this is the refinement ratio
*/
void
CoarseAverageFace::averageGridData(FluxBox& a_coarsenedFine,
const FluxBox& a_fine,
int a_averageType,
const int a_refFactor) const
{
for (int dir=0; dir<SpaceDim; dir++)
{
FArrayBox& coarseFab = a_coarsenedFine[dir];
const FArrayBox& fineFab = a_fine[dir];
const Box& coarseBox = coarseFab.box();
// set up refinement box
int boxHi = m_nRef-1;
IntVect hiVect(D_DECL6(boxHi,boxHi,boxHi,
boxHi,boxHi,boxHi));
// don't want to index at all in dir direction --
// instead, want to just march along face.
hiVect.setVal(dir,0);
IntVect loVect(D_DECL6(0,0,0,0,0,0));
Box refBox(loVect, hiVect);
if (a_averageType == arithmetic)
{
FORT_AVERAGEFACE( CHF_FRA(coarseFab),
CHF_CONST_FRA(fineFab),
CHF_BOX(coarseBox),
CHF_CONST_INT(dir),
CHF_CONST_INT(m_nRef),
CHF_CONST_INT(a_refFactor),
CHF_BOX(refBox));
}
else if (a_averageType == harmonic)
{
FORT_AVERAGEFACEHARMONIC( CHF_FRA(coarseFab),
CHF_CONST_FRA(fineFab),
CHF_BOX(coarseBox),
CHF_CONST_INT(dir),
CHF_CONST_INT(m_nRef),
CHF_CONST_INT(a_refFactor),
CHF_BOX(refBox));
}
else
{
MayDay::Error("CoarseAverageFace::averageGridData -- bad averageType");
}
}
}
#include "NamespaceFooter.H"
| 31.978261
| 142
| 0.531883
|
rmrsk
|
e7bb392669b2859123df05d58f95d1cdbd470862
| 3,420
|
cpp
|
C++
|
test/TestSpecializationConstant.cpp
|
dSandley20/KomputeParticles
|
099073c6db4b5345e80eaaebe97d97e0f8256849
|
[
"Apache-2.0"
] | 389
|
2021-07-23T23:24:18.000Z
|
2022-03-31T12:16:47.000Z
|
test/TestSpecializationConstant.cpp
|
dSandley20/KomputeParticles
|
099073c6db4b5345e80eaaebe97d97e0f8256849
|
[
"Apache-2.0"
] | 54
|
2020-08-28T14:33:52.000Z
|
2020-09-13T10:59:42.000Z
|
test/TestSpecializationConstant.cpp
|
dSandley20/KomputeParticles
|
099073c6db4b5345e80eaaebe97d97e0f8256849
|
[
"Apache-2.0"
] | 31
|
2021-07-27T14:32:24.000Z
|
2022-03-19T07:57:01.000Z
|
// SPDX-License-Identifier: Apache-2.0
#include "gtest/gtest.h"
#include "kompute/Kompute.hpp"
#include "kompute_test/Shader.hpp"
TEST(TestSpecializationConstants, TestTwoConstants)
{
{
std::string shader(R"(
#version 450
layout (constant_id = 0) const float cOne = 1;
layout (constant_id = 1) const float cTwo = 1;
layout (local_size_x = 1) in;
layout(set = 0, binding = 0) buffer a { float pa[]; };
layout(set = 0, binding = 1) buffer b { float pb[]; };
void main() {
uint index = gl_GlobalInvocationID.x;
pa[index] = cOne;
pb[index] = cTwo;
})");
std::vector<uint32_t> spirv = compileSource(shader);
std::shared_ptr<kp::Sequence> sq = nullptr;
{
kp::Manager mgr;
std::shared_ptr<kp::TensorT<float>> tensorA =
mgr.tensor({ 0, 0, 0 });
std::shared_ptr<kp::TensorT<float>> tensorB =
mgr.tensor({ 0, 0, 0 });
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorA,
tensorB };
std::vector<float> spec = std::vector<float>({ 5.0, 0.3 });
std::shared_ptr<kp::Algorithm> algo =
mgr.algorithm(params, spirv, {}, spec);
sq = mgr.sequence()
->record<kp::OpTensorSyncDevice>(params)
->record<kp::OpAlgoDispatch>(algo)
->record<kp::OpTensorSyncLocal>(params)
->eval();
EXPECT_EQ(tensorA->vector(), std::vector<float>({ 5, 5, 5 }));
EXPECT_EQ(tensorB->vector(), std::vector<float>({ 0.3, 0.3, 0.3 }));
}
}
}
TEST(TestSpecializationConstants, TestConstantsInt)
{
{
std::string shader(R"(
#version 450
layout (constant_id = 0) const int cOne = 1;
layout (constant_id = 1) const int cTwo = 1;
layout (local_size_x = 1) in;
layout(set = 0, binding = 0) buffer a { int pa[]; };
layout(set = 0, binding = 1) buffer b { int pb[]; };
void main() {
uint index = gl_GlobalInvocationID.x;
pa[index] = cOne;
pb[index] = cTwo;
})");
std::vector<uint32_t> spirv = compileSource(shader);
std::shared_ptr<kp::Sequence> sq = nullptr;
{
kp::Manager mgr;
std::shared_ptr<kp::TensorT<int32_t>> tensorA =
mgr.tensorT<int32_t>({ 0, 0, 0 });
std::shared_ptr<kp::TensorT<int32_t>> tensorB =
mgr.tensorT<int32_t>({ 0, 0, 0 });
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorA,
tensorB };
std::vector<int32_t> spec({ -1, -2 });
std::shared_ptr<kp::Algorithm> algo =
mgr.algorithm(params, spirv, {}, spec, {});
sq = mgr.sequence()
->record<kp::OpTensorSyncDevice>(params)
->record<kp::OpAlgoDispatch>(algo)
->record<kp::OpTensorSyncLocal>(params)
->eval();
EXPECT_EQ(tensorA->vector(), std::vector<int32_t>({ -1, -1, -1 }));
EXPECT_EQ(tensorB->vector(), std::vector<int32_t>({ -2, -2, -2 }));
}
}
}
| 32.884615
| 80
| 0.490643
|
dSandley20
|
e7bc27d00fa4fafc791cc685ff02c186e5c0c86a
| 4,859
|
hpp
|
C++
|
Source/KEngine/include/KEngine/Common/JSONReader.hpp
|
yxbh/KEngine
|
04d2aced738984f53bf1b2b84b49fbbabfbe6587
|
[
"Zlib"
] | 1
|
2020-05-29T03:30:08.000Z
|
2020-05-29T03:30:08.000Z
|
Source/KEngine/include/KEngine/Common/JSONReader.hpp
|
yxbh/KEngine
|
04d2aced738984f53bf1b2b84b49fbbabfbe6587
|
[
"Zlib"
] | null | null | null |
Source/KEngine/include/KEngine/Common/JSONReader.hpp
|
yxbh/KEngine
|
04d2aced738984f53bf1b2b84b49fbbabfbe6587
|
[
"Zlib"
] | null | null | null |
#pragma once
// libJSON lib
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100) // unreferenced formal parameter.
#pragma warning(disable : 4127) // conditional expression is constant.
#endif
#include "libjson_7.6.1/libjson.h"
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include <string>
#include <stack>
#include "IJSONReader.hpp"
namespace ke
{
/** \class JSONReader
A IJSONReader implementation which itself wraps around libjson.
*/
class JSONReader
: public IJSONReader
{
public:
using JSONResourceType = JSONNode;
using ArrayType = JSONResourceType;
using NodeType = JSONResourceType;
/** \class tree_record
A record of a parent JSON member & child JSON member relationship.
*/
struct tree_record
{
const JSONResourceType & parent_member;
JSONNode::const_iterator iterator;
tree_record(const JSONResourceType & p_rParentNode, JSONNode::const_iterator p_It)
: parent_member(p_rParentNode), iterator(p_It) {};
tree_record(const tree_record & p_rRecord)
: tree_record(p_rRecord.parent_member, p_rRecord.iterator) {};
JSONReader & operator = (const tree_record & p_rRecord) = delete;
}; // tree_record struct
private:
bool m_Loaded = false; // loaded json code.
JSONResourceType m_Node;
bool m_AtRoot = true;
std::stack<tree_record> m_TreeITStack;
public:
// omit ctor & dtor declaration because default versions will work.
/** load & parse json file at path.
@return false if failure. */
virtual bool load(const std::string & p_rPath) final;
/** load string with json code int it.
@return false if failure. */
virtual bool parse(const std::string & p_rJSONDoc) final;
/** @return a string dump of all the contents from the json doc.*/
virtual std::string dumpToString(void) final;
/** @return true if current pointered to member value is a string. */
virtual bool isTypeString(void) final;
/** @return true if current pointered to member value is a number. */
virtual bool isTypeNumber(void) final;
/** @return true if current pointered to member value is a boolean. */
virtual bool isTypeBoolean(void) final;
/** @return true if current pointered to member value is an array. */
virtual bool isTypeArray(void) final;
/** @return true if current pointered to member value is a JSON node. */
virtual bool isTypeNode(void) final;
/** @return true if current pointered to member value is null/blank. */
virtual bool isTypeNull(void) final;
/** @return the number of child elements the current element has. */
virtual SizeType getChildrenCount(void) const final;
/** @return true if the current pointed to element has any children elements. */
virtual bool hasChildren(void) const final;
/** @return current pointed to json node as a string. */
virtual StringType getValueAsString(void) const final;
/** @return current pointed to json node as a number. */
virtual NumberType getValueAsNumber(void) const final;
/** @return current pointed to json node as an integer. */
virtual IntegerType getValueAsInt(void) const final;
/** @return current pointed to json node as a double. */
virtual FloatType getValueAsDouble(void) const final;
/** @return current pointed to json node as a boolean. */
virtual BooleanType getValueAsBoolean(void) const final;
/** @return true if cursor is point to the root object. */
virtual bool atRoot(void) const final;
/** point cursor to the first Member/child of this member.
@return true if this member contains multiple members or the value is an non-empty array. */
virtual bool traverseThisMember(void) final;
/** point cursor to the parent member's next child member from this member if the parent is an array or member.
@return false if there's no more. */
virtual bool pointToNextMember(void) final;
/** point cursor to the parent member's previous child member from this member if the parent is an array or member.
@return false if there's no more. */
virtual bool pointToPreviousMember(void) final;
/** point cursor to the parent node of the currently pointed to json member.
@return false if current pointed to node is the parent. */
virtual bool pointToParentMember(void) final;
/** find the child element with the specified key name, and point the cursor to it.
@return true if found.*/
virtual bool pointToChildElement(const std::string p_NameKey) final;
/** @return name of the current element. */
virtual StringType getElementName(void) const final;
}; // JSONReader class
} // KE ns
| 42.622807
| 119
| 0.685326
|
yxbh
|
e7bffcd83db49941b0963aaf988354586bba3f38
| 1,005
|
cpp
|
C++
|
src/grbl/parsers/response_message/ResponseMessageParser.test.cpp
|
jgert/grblController
|
e5026b1e5d972f3e67b07c3fb80dad276bae2c17
|
[
"MIT"
] | 2
|
2021-12-19T19:15:28.000Z
|
2022-01-03T10:29:32.000Z
|
src/grbl/parsers/response_message/ResponseMessageParser.test.cpp
|
jgert/grblController
|
e5026b1e5d972f3e67b07c3fb80dad276bae2c17
|
[
"MIT"
] | 12
|
2020-06-09T21:10:10.000Z
|
2022-02-25T14:11:17.000Z
|
src/grbl/parsers/response_message/ResponseMessageParser.test.cpp
|
jgert/grblController
|
e5026b1e5d972f3e67b07c3fb80dad276bae2c17
|
[
"MIT"
] | 1
|
2020-08-13T04:00:55.000Z
|
2020-08-13T04:00:55.000Z
|
//
// Created by Jakub Gert on 20/06/2020.
//
#include <QObject>
#include <QTest>
#include "tests/TestSuite.h"
#include "ResponseMessageParser.h"
class ResponseMessageParserTests : public TestSuite {
Q_OBJECT
private slots:
void testInvalid() {
ResponseMessageParser parser;
auto result = parser.parse("o");
QCOMPARE(result, false);
result = parser.parse("error");
QCOMPARE(result, false);
result = parser.parse("error:");
QCOMPARE(result, false);
result = parser.parse("error:a");
QCOMPARE(result, false);
}
void testValid() {
ResponseMessageParser parser;
auto result = parser.parse("ok");
QCOMPARE(result, true);
QCOMPARE(parser.getError(), 0);
result = parser.parse("error:0");
QCOMPARE(result, true);
QCOMPARE(parser.getError(), 0);
}
};
static ResponseMessageParserTests T_ResponseMessageParserTests;
#include "ResponseMessageParser.test.moc"
| 21.847826
| 63
| 0.637811
|
jgert
|
e7c1f1f9191098c0b0f356bbe11abb8af4409b7a
| 619
|
hpp
|
C++
|
source/native/encoder.hpp
|
giovannicalo/node-webp
|
d841ccd4316bb73d58c2d5e3a5f844d7435fb088
|
[
"MIT"
] | null | null | null |
source/native/encoder.hpp
|
giovannicalo/node-webp
|
d841ccd4316bb73d58c2d5e3a5f844d7435fb088
|
[
"MIT"
] | null | null | null |
source/native/encoder.hpp
|
giovannicalo/node-webp
|
d841ccd4316bb73d58c2d5e3a5f844d7435fb088
|
[
"MIT"
] | null | null | null |
#pragma once
#include <math.h>
#include <napi.h>
#include <webp/encode.h>
#include "format.hpp"
#include "image.hpp"
namespace nodeWebp {
class Encoder : public Napi::AsyncWorker {
private:
uint8_t* buffer = nullptr;
Napi::Promise::Deferred promise;
float_t quality = 0;
uint64_t size = 0;
Image* image = nullptr;
public:
Encoder(
Napi::Env environment,
Napi::Object source,
float_t quality
);
~Encoder() override;
void Execute() override;
void OnError(const Napi::Error& error) override;
void OnOK() override;
Napi::Promise getPromise();
};
}
| 12.632653
| 51
| 0.647819
|
giovannicalo
|
b10f837bda4759c001e18beff0616cb05865e361
| 3,252
|
hpp
|
C++
|
plugins/EstimationPlugin/src/base/measurement/TDRSSTwoWayRange.hpp
|
Randl/GMAT
|
d6a5b1fed68c33b0c4b1cfbd1e25a71cdfb8f8f5
|
[
"Apache-2.0"
] | 2
|
2020-01-01T13:14:57.000Z
|
2020-12-09T07:05:07.000Z
|
plugins/EstimationPlugin/src/base/measurement/TDRSSTwoWayRange.hpp
|
rdadan/GMAT-R2016a
|
d6a5b1fed68c33b0c4b1cfbd1e25a71cdfb8f8f5
|
[
"Apache-2.0"
] | 1
|
2018-03-15T08:58:37.000Z
|
2018-03-20T20:11:26.000Z
|
plugins/EstimationPlugin/src/base/measurement/TDRSSTwoWayRange.hpp
|
rdadan/GMAT-R2016a
|
d6a5b1fed68c33b0c4b1cfbd1e25a71cdfb8f8f5
|
[
"Apache-2.0"
] | 3
|
2019-10-13T10:26:49.000Z
|
2020-12-09T07:06:55.000Z
|
//$Id: TDRSSTwoWayRange.hpp 1398 2011-04-21 20:39:37Z $
//------------------------------------------------------------------------------
// TDRSSTwoWayRange
//------------------------------------------------------------------------------
// GMAT: General Mission Analysis Tool
//
// Copyright (c) 2002 - 2015 United States Government as represented by the
// Administrator of The National Aeronautics and Space Administration.
// All Other Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.apache.org/licenses/LICENSE-2.0.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language
// governing permissions and limitations under the License.
//
// Developed jointly by NASA/GSFC and Thinking Systems, Inc. under FDSS Task 28
//
// Author: Darrel J. Conway, Thinking Systems, Inc.
// Created: 2010/05/10
//
/**
* The TDRSS 2-way range core measurement model.
*/
//------------------------------------------------------------------------------
#ifndef TDRSSTwoWayRange_hpp
#define TDRSSTwoWayRange_hpp
#include "estimation_defs.hpp"
#include "TwoWayRange.hpp"
/**
* TDRSS 2-Way Range Measurement Model
*/
class ESTIMATION_API TDRSSTwoWayRange: public TwoWayRange
{
public:
TDRSSTwoWayRange(const std::string nomme = "");
virtual ~TDRSSTwoWayRange();
TDRSSTwoWayRange(const TDRSSTwoWayRange& usn);
TDRSSTwoWayRange& operator=(const TDRSSTwoWayRange& usn);
virtual GmatBase* Clone() const;
bool SetRefObject(GmatBase *obj, const Gmat::ObjectType type,
const std::string &name);
bool SetRefObject(GmatBase *obj, const Gmat::ObjectType type,
const std::string &name, const Integer index);
virtual bool Initialize();
virtual const std::vector<RealArray>& CalculateMeasurementDerivatives(
GmatBase *obj, Integer id);
virtual Event* GetEvent(UnsignedInt whichOne);
virtual bool SetEventData(Event *locatedEvent);
protected:
/// Turnaround time at the TDRSS (aka transponder delay) on way to the s/c
Real tdrssUplinkDelay;
/// Turnaround time at the TDRSS (aka transponder delay) on way to the ground
Real tdrssDownlinkDelay;
/// Light transit time for the forward link
Real forwardlinkTime;
/// Light transit time for the return link
Real backlinkTime;
/// The event used to model the uplink
LightTimeCorrection forwardlinkLeg;
/// The event used to model the downlink
LightTimeCorrection backlinkLeg;
/// The distance covered during the uplink
Real forwardlinkRange;
/// The distance covered during the downlink
Real backlinkRange;
virtual bool Evaluate(bool withEvents = false);
void SetHardwareDelays(bool loadEvents);
virtual void InitializeMeasurement();
};
#endif /* TDRSSTwoWayRange_hpp */
| 34.967742
| 80
| 0.646986
|
Randl
|
b10fd8ec331ec6aa27ddc9f37789e1e88583a0b3
| 14,017
|
cc
|
C++
|
ee/group.cc
|
flipfrog/xee
|
2586ed5bc0b9f99d8b314e363e0e8f76f46575ba
|
[
"MIT"
] | null | null | null |
ee/group.cc
|
flipfrog/xee
|
2586ed5bc0b9f99d8b314e363e0e8f76f46575ba
|
[
"MIT"
] | null | null | null |
ee/group.cc
|
flipfrog/xee
|
2586ed5bc0b9f99d8b314e363e0e8f76f46575ba
|
[
"MIT"
] | null | null | null |
//
// group.cc:
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <X11/Xlib.h>
#include <local_types.h>
#include <list.h>
#include <eedefs.h>
#include <shape.h>
#include <shapeset.h>
#include <frame.h>
#include <xcontext.h>
#include <board.h>
#include <group.h>
#include <misc.h>
#include <geometry.h>
#include <xfig.h>
//
// コンストラクタ
//
Group::Group( Board* board ): Shape( board )
{
shape_type = ST_GROUP;
_x = _y = _w = _h = 0;
}
//
// コピーコンストラクタ
//
Group::Group( Group* group ): Shape( group )
{
_x = group->_x, _y = group->_y;
_w = group->_w, _h = group->_h;
for( int i = 0 ; i < group->shape_slot.count() ; i++ )
shape_slot.append( group->shape_slot.get(i)->duplicate() );
}
//
// draw():
//
void Group::draw( Window window, int x, int y )
{
Display* dpy = board->xcontext->get_dpy();
GC gc = board->gc;
int save_gp_draw_f = board->grip_disp;
board->grip_disp = False;
for( int i = 0 ; i < shape_slot.count() ; i++ )
shape_slot.get(i)->draw( window, ROUND(_x)+x, ROUND(_y)+y );
board->grip_disp = save_gp_draw_f;
int left = ROUND(_x) + x - 3;
int right = ROUND(_x) + ROUND(_w) + x - 3;
int up = ROUND(_y) + y - 3;
int down = ROUND(_y) + ROUND(_h) + y - 3;
XDrawRectangle( dpy, window, gc, left, up, 5, 5 );
XDrawRectangle( dpy, window, gc, right, up, 5, 5 );
XDrawRectangle( dpy, window, gc, left, down, 5, 5 );
XDrawRectangle( dpy, window, gc, right, down, 5, 5 );
}
//
// hit():
//
Boolean Group::hit( int x, int y, int hw )
{
int left = ROUND(_x);
int right = ROUND(_x) + ROUND(_w);
int up = ROUND(_y);
int down = ROUND(_y) + ROUND(_h);
if( contain_chk( left, up, x, y, hw ) )
return True;
if( contain_chk( right, up, x, y, hw ) )
return True;
if(contain_chk( right, down, x, y, hw ) )
return True;
if( contain_chk( left, down, x, y, hw ) )
return True;
return False;
}
//
// layout():
//
EditResult Group::layout( XEvent* event )
{
Display* dpy = event->xany.display;
XSetFunction( dpy, board->gc, GXset );
XSetPlaneMask( dpy, board->gc, board->layout_mask );
static int last_x = -1, last_y;
if( event->type == MotionNotify && proc_phase > 0 ){
int mx = event->xmotion.x, my = event->xmotion.y;
board->quontize( mx, my );
if( last_x != mx || last_y != my ){
if( last_x >= 0 ){
XSetFunction( dpy, board->gc, GXclear );
int x1 = ROUND(_x), y1 = ROUND(_y), x2 = last_x, y2 = last_y;
normal_rect( x1, y1, x2, y2 );
XDrawRectangle( dpy, event->xmotion.window, board->gc,
x1, y1, x2-x1, y2-y1 );
XSetFunction( dpy, board->gc, GXset );
}
int x1 = ROUND(_x), y1 = ROUND(_y), x2 = mx, y2 = my;
normal_rect( x1, y1, x2, y2 );
XDrawRectangle( dpy, event->xmotion.window, board->gc,
x1, y1, x2-x1, y2-y1 );
last_x = mx, last_y = my;
}
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CONTINUE;
}
switch( proc_phase ){
case 0: // 一回目のクリック。
if( event->type != ButtonPress && event->xbutton.button != 1 )
return EDIT_CONTINUE;
Window window = event->xbutton.window;
int mx = event->xbutton.x, my = event->xbutton.y;
board->quontize( mx, my );
_x = (double)mx, _y = (double)my;
last_x = -1;
proc_phase = 1;
return EDIT_CONTINUE;
break;
case 1: // 二回目のクリック。
if( event->type != ButtonPress )
return EDIT_CONTINUE;
window = event->xbutton.window;
switch( event->xbutton.button ){
case 1: // 左ボタン矩形の確定。
mx = event->xbutton.x, my = event->xbutton.y;
board->quontize( mx, my );
if( ROUND(_x) == mx && ROUND(_y) == my ){
XBell( dpy, 0 );
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CONTINUE;
}
if( last_x >= 0 ){
XSetFunction( dpy, board->gc, GXclear );
int x1 = ROUND(_x), y1 = ROUND(_y), x2 = last_x, y2 = last_y;
normal_rect( x1, y1, x2, y2 );
XDrawRectangle( dpy, event->xmotion.window, board->gc,
x1, y1, x2-x1, y2-y1 );
XSetFunction( dpy, board->gc, GXset );
}
int x1, x2, y1, y2;
x1 = ROUND(_x), y1 = ROUND(_y), x2 = mx, y2 = my;
normal_rect( x1, y1, x2, y2 );
_x = x1, _y = y1, _w = x2 - x1 - 1, _h = y2 - y1 - 1;
for( int i = board->shapeset.count_shape()-1 ; i >= 0 ; i-- ){
Shape* shape = board->shapeset.get_shape(i);
if( shape->contain( ROUND(_x), ROUND(_y), ROUND(_w), ROUND(_h) ) ){
shape_slot.append( shape->duplicate() );
XSetFunction( dpy, board->gc, GXclear );
XSetPlaneMask( dpy, board->gc, board->shape_mask );
shape->draw( event->xbutton.window, 0, 0 );
board->shapeset.unlink_shape( LIST_TOP, i, 1 );
}
}
if( shape_slot.count() == 0 ){
last_x = -1;
proc_phase = 0;
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CANCEL;
}
double min_x=INT_MAX, min_y=INT_MAX, max_x=INT_MIN, max_y=INT_MIN;
for( i = 0 ; i < shape_slot.count() ; i++ ){
Shape* shape = shape_slot.get(i);
double x, y, w, h;
shape->bound( x, y, w, h );
if( x < min_x ) min_x = x;
if( x+w > max_x ) max_x = x+w;
if( y < min_y ) min_y = y;
if( y+h > max_y ) max_y = y+h;
}
_x = min_x, _y = min_y, _w = max_x - min_x, _h = max_y - min_y;
for( i = 0 ; i < shape_slot.count() ; i++ )
shape_slot.get(i)->translate( -_x, -_y );
XSetFunction( dpy, board->gc, GXset );
XSetPlaneMask( dpy, board->gc, board->shape_mask );
draw( window, 0, 0 );
last_x = -1;
proc_phase = 0;
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_COMPLETE;
break;
case 3: // 右ボタン(キャンセル)
if( last_x >= 0 ){
XSetFunction( dpy, board->gc, GXclear );
XSetPlaneMask( dpy, board->gc, board->layout_mask );
int x1 = ROUND(_x), y1 = ROUND(_y), x2 = last_x, y2 = last_y;
normal_rect( x1, y1, x2, y2 );
XDrawRectangle( dpy, event->xmotion.window, board->gc,
x1, y1, x2-x1, y2-y1 );
}
last_x = -1;
proc_phase = 0;
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CANCEL;
break;
}
break;
}
return EDIT_CONTINUE;
}
//
// save():
//
void Group::save( FILE* fp )
{
fprintf( fp, "group{\n" );
fprintf( fp, " geom = (%g,%g,%g,%g);\n", _x, _y, _w, _h );
for( int i = 0 ; i < shape_slot.count() ; i++ )
shape_slot.get(i)->save( fp );
fprintf( fp, "}\n" );
}
//
// tex():
//
void Group::tex( FILE* fp, double h, double x, double y )
{
for( int i = 0 ; i < shape_slot.count() ; i++ )
shape_slot.get(i)->tex( fp, h, _x+x, _y+y );
}
//
// bound():
//
void Group::bound( double& x, double& y, double& w, double& h )
{
double min_x = INT_MAX, min_y = INT_MAX, max_x = INT_MIN, max_y = INT_MIN;
for( int i = 0 ; i < shape_slot.count() ; i++ ){
Shape* shape = shape_slot.get(i);
double x, y, w, h;
shape->bound( x, y, w, h );
if( x < min_x ) min_x = x;
if( x+w > max_x ) max_x = x+w;
if( y < min_y ) min_y = y;
if( y+h > max_y ) max_y = y+h;
}
_w = max_x - min_x, _h = max_y - min_y;
x = _x, y = _y;
w = _w, h = _h;
}
//
// translate():
//
void Group::translate( double x, double y )
{
_x += x, _y += y;
}
//
// duplicate():
//
Shape* Group::duplicate()
{
return new Group( this );
}
//
// contain():
//
Boolean Group::contain( int x, int y, int w, int h )
{
if( ROUND(_x) < x || ROUND(_x+_w) >= x+w )
return False;
if( ROUND(_y) < y || ROUND(_y+_h) >= y+h )
return False;
return True;
}
//
// scale():
//
void Group::scale( double rx, double ry )
{
_x *= rx, _y *= ry;
_w *= rx, _h *= ry;
for( int i = 0 ; i < shape_slot.count() ; i++ )
shape_slot.get(i)->scale( rx, ry );
}
//
// リサイズ
//
EditResult Group::resize( XEvent* event )
{
Display* dpy = event->xany.display;
XSetFunction( dpy, board->gc, GXset );
XSetPlaneMask( dpy, board->gc, board->layout_mask );
static int last_x = -1, last_y;
static int xx, yy;
if( proc_phase == 1 && event->type == MotionNotify ){
int mx = event->xmotion.x, my = event->xmotion.y;
board->quontize( mx, my );
if( last_x == mx && last_y == my ){
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CONTINUE;
}
int x1 = xx, y1 = yy, x2 = last_x, y2 = last_y;
normal_rect( x1, y1, x2, y2 );
if( last_x > 0 ){
XSetFunction( dpy, board->gc, GXclear );
XDrawRectangle( dpy, event->xbutton.window, board->gc,
x1, y1, x2-x1-1, y2-y1-1 );
XSetFunction( dpy, board->gc, GXset );
}
x1 = xx, y1 = yy, x2 = mx, y2 = my;
normal_rect( x1, y1, x2, y2 );
XDrawRectangle( dpy, event->xbutton.window, board->gc,
x1, y1, x2-x1-1, y2-y1-1 );
last_x = mx, last_y = my;
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CONTINUE;
}
switch( proc_phase ){
case 0:
int mx = event->xbutton.x, my = event->xbutton.y;
board->quontize( mx, my );
xx = ROUND(_x), yy = ROUND(_y+_h)-1;
if( contain_chk( ROUND(_x+_w)-1, ROUND(_y+_h)-1, mx, my, 4 ) )
xx = ROUND(_x), yy = ROUND(_y);
if( contain_chk( ROUND(_x), ROUND(_y+_h)-1, mx, my, 4 ) )
xx = ROUND(_x+_w)-1, yy = ROUND(_y);
if( contain_chk( ROUND(_x), ROUND(_y), mx, my, 4 ) )
xx = ROUND(_x+_w)-1, yy = ROUND(_y+_h)-1;
last_x = -1;
proc_phase = 1;
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CONTINUE;
break;
case 1:
if( event->type != ButtonPress ){
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CONTINUE;
}
mx = event->xbutton.x, my = event->xbutton.y;
board->quontize( mx, my );
switch( event->xbutton.button ){
case 1: // 左ボタン(決定)
if( last_x < 0 || ( xx == last_x && yy == last_y ) ){
XBell( dpy, 0 );
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CONTINUE;
}
int x1 = xx, y1 = yy, x2 = last_x, y2 = last_y;
normal_rect( x1, y1, x2, y2 );
XSetFunction( dpy, board->gc, GXclear );
XDrawRectangle( dpy, event->xbutton.window, board->gc,
x1, y1, x2-x1-1, y2-y1-1 );
XSetPlaneMask( dpy, board->gc, board->shape_mask );
draw( event->xbutton.window, 0, 0 );
scale( (double)(x2-x1-1)/_w, (double)(y2-y1-1)/_h );
_x = (double)x1, _y = (double)y1;
XSetFunction( dpy, board->gc, GXset );
draw( event->xbutton.window, 0, 0 );
proc_phase = 0;
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_COMPLETE;
break;
case 3: // 右ボタン(キャンセル)
if( last_x > 0 ){
XSetFunction( dpy, board->gc, GXxor );
x1 = xx, y1 = yy, x2 = last_x, y2 = last_y;
normal_rect( x1, y1, x2, y2 );
XSetFunction( dpy, board->gc, GXclear );
XDrawRectangle( dpy, event->xbutton.window, board->gc,
x1, y1, x2-x1-1, y2-y1-1 );
}
proc_phase = 0;
XSetFunction( dpy, board->gc, GXcopy );
XSetPlaneMask( dpy, board->gc, ~0 );
return EDIT_CANCEL;
break;
}
}
return EDIT_CONTINUE;
}
//
// reversx():
//
void Group::reversx()
{
double bx, by, bw, bh;
bound( bx, by, bw, bh );
for( int i = 0 ; i < shape_slot.count() ; i++ ){
double sx, sy, sw, sh;
Shape* shape = shape_slot.get(i);
shape->bound( sx, sy, sw, sh );
shape->translate( -sx, 0 );
shape->translate( bw, 0 );
shape->translate( -(sx+sw), 0 );
shape->reversx();
}
}
//
// reversy():
//
void Group::reversy()
{
double bx, by, bw, bh;
bound( bx, by, bw, bh );
for( int i = 0 ; i < shape_slot.count() ; i++ ){
double sx, sy, sw, sh;
Shape* shape = shape_slot.get(i);
shape->bound( sx, sy, sw, sh );
shape->translate( 0, -sy );
shape->translate( 0, bh );
shape->translate( 0, -(sy+sh) );
shape->reversy();
}
}
//
// update():
//
void Group::update()
{
for( int i = 0 ; i < shape_slot.count() ; i++ )
shape_slot.get(i)->update();
double x, y, w, h;
bound( x, y, w, h );
_w = w, _h = h;
}
//
// xfig():
//
void Group::xfig( FILE* fp, double x, double y )
{
fprintf( fp, "%d %d %d %d %d\n", O_COMPOUND,
ROUND(XFS(_x+x)), ROUND(XFS(_y+y)),
ROUND(XFS(_x+_w+x)), ROUND(XFS(_y+_h+y)) );
for( int i = 0 ; i < shape_slot.count() ; i++ )
shape_slot.get(i)->xfig( fp, _x+x, _y+y );
fprintf( fp, "%d\n", O_END_COMPOUND );
}
//
// ungroup():
//
void Group::ungroup( Window window )
{
XSetPlaneMask( board->xcontext->get_dpy(), board->gc, board->shape_mask );
XSetFunction( board->xcontext->get_dpy(), board->gc, GXclear );
draw( window, 0, 0 );
XSetFunction( board->xcontext->get_dpy(), board->gc, GXset );
for( int j = 0 ; j < shape_slot.count() ; j++ ){
Shape* dup_shape = shape_slot.get(j)->duplicate();
dup_shape->translate( _x, _y );
dup_shape->draw( window, 0, 0 );
board->shapeset.append_shape( dup_shape );
}
XSetFunction( board->xcontext->get_dpy(), board->gc, GXcopy );
XSetPlaneMask( board->xcontext->get_dpy(), board->gc, ~0 );
}
//
// rotate():
//
void Group::rotate( XEvent* event )
{
for( int i = 0 ; i < shape_slot.count() ; i++ ){
Shape* shape = shape_slot.get(i);
shape->translate( _x, _y );
shape->rotate( event );
shape->translate( -_x, -_y );
}
double min_x = INT_MAX, min_y = INT_MAX, max_x = INT_MIN, max_y = INT_MIN;
for( i = 0 ; i < shape_slot.count() ; i++ ){
Shape* shape = shape_slot.get(i);
double x, y, w, h;
shape->bound( x, y, w, h );
if( x < min_x ) min_x = x;
if( x+w > max_x ) max_x = x+w;
if( y < min_y ) min_y = y;
if( y+h > max_y ) max_y = y+h;
}
_x += min_x, _y += min_y;
_w = max_x-min_x, _h = max_y-min_y;
if( min_x != 0 || min_y != 0 )
for( i = 0 ; i < shape_slot.count() ; i++ )
shape_slot.get(i)->translate( -min_x, -min_y );
}
| 27.323587
| 76
| 0.565528
|
flipfrog
|
b117206c49426f5c8b2342a2d5174b9b4f49ee5b
| 14,895
|
cpp
|
C++
|
src/ADBSCEditDLL/src/WinClass/ToolBar/ToolBar.cpp
|
ClnViewer/ADB-Android-Viewer
|
c619fe626ab390b656893974700a0b6379159c03
|
[
"MIT"
] | 9
|
2019-05-20T12:06:36.000Z
|
2022-03-24T19:11:06.000Z
|
src/ADBSCEditDLL/src/WinClass/ToolBar/ToolBar.cpp
|
ClnViewer/ADB-Android-Viewer
|
c619fe626ab390b656893974700a0b6379159c03
|
[
"MIT"
] | null | null | null |
src/ADBSCEditDLL/src/WinClass/ToolBar/ToolBar.cpp
|
ClnViewer/ADB-Android-Viewer
|
c619fe626ab390b656893974700a0b6379159c03
|
[
"MIT"
] | 3
|
2020-07-06T04:51:33.000Z
|
2021-07-26T20:08:02.000Z
|
/*
MIT License
Android remote Viewer, GUI ADB tools
Android Viewer developed to view and control your android device from a PC.
ADB exchange Android Viewer, support scale view, input tap from mouse,
input swipe from keyboard, save/copy screenshot, etc..
Copyright (c) 2016-2019 PS
GitHub: https://github.com/ClnViewer/ADB-Android-Viewer
GitHub: https://github.com/ClnViewer/ADB-Android-Viewer/ADBSCEditDLL/ADBSCEdit
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub license, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "../../SCEditInternal.h"
#include <commctrl.h>
namespace Editor
{
struct TBChangeButton
{
int32_t btnidx, cmdcur, cmdnew, imgidx, state;
};
ToolBar::ToolBar()
{
Base::m_data = data();
}
void ToolBar::show()
{
if (!Base::m_data.window)
return;
//
Base::refresh(m_rebar.gethandle());
Base::refresh(Base::m_data.window);
}
MDIWin::WinData ToolBar::data()
{
MDIWin::WinData d(
MDIWin::BaseData::MDIWinType::MWTYPE_TOOLBAR, // MDIWinType group
MDIWin::BaseData::MDIWinType::MWTYPE_TOOLBAR, // MDIWinType type
MDIWin::BaseData::MDIWinStyle::MWSTYLE_NONE, // MDIWinStyle
std::string(), // Class name
std::string(), // Title
0, 0
);
d.irdefault.set<int32_t>(0, 0, 0, 0); // % from main widow
return d;
}
bool ToolBar::event_sizeinitBegin(ImageLite::IRECT<int32_t> const & ir)
{
do
{
if ((!Base::m_data.window) || (ir.w <= 0))
break;
Base::m_data.irsize.set<int32_t>(
0,
0,
ir.w - 150,
(getsizebtn_() + 4)
);
if (Base::m_data.irsize.empty())
break;
Base::refresh(SWP_NOMOVE);
}
while (0);
return true;
}
void ToolBar::event_size(ImageLite::IRECT<int32_t> const & irc, ImageLite::IRECT<int32_t> const &)
{
Base::m_data.irsize.set<int32_t>(
0,
0,
((irc.w <= 0) ? Base::m_data.irsize.w : irc.w),
Base::m_data.irsize.h
);
Base::resize();
}
void ToolBar::event_resize()
{
RECT rc{};
HWND hwnd = m_rebar.gethandle();
if (!hwnd)
hwnd = Base::m_data.window;
if (!::GetClientRect(hwnd, &rc))
return;
Base::m_data.irsize.set<int32_t>(
0,
0,
rc.right,
rc.bottom
);
}
std::tuple<bool, bool> ToolBar::event_initBegin()
{
try
{
Base::m_data.irsize = {};
do
{
if (!m_rebar.init(Base::m_data.wparent))
break;
if (!m_search.init(
m_rebar.gethandle(),
Base::m_data.wparent
))
break;
if (!m_menu.init(
m_rebar.gethandle(),
Base::m_data.wparent
))
break;
Base::m_data.window = ::CreateWindowExA(
WS_EX_COMPOSITED,
TOOLBARCLASSNAME, "",
WS_VISIBLE |
WS_CHILD |
WS_CLIPCHILDREN |
WS_CLIPSIBLINGS |
TBSTYLE_FLAT |
TBSTYLE_WRAPABLE |
TBSTYLE_TRANSPARENT |
CCS_NORESIZE |
CCS_NODIVIDER |
CCS_NOPARENTALIGN,
0, 0, 1, 1,
Base::m_data.wparent,
(HMENU)ID_REBAR_TOOLBAR,
MDIWin::Config::instance().gethinstance(),
nullptr
);
if (!Base::m_data.window)
break;
if (!setup_())
break;
m_rebar.addband(Base::m_data.window, getsizebtn_() + 4);
m_rebar.addband(m_search.gethandle(), 0);
m_rebar.addband(m_menu.gethandle(), 0);
m_rebar.showband(0);
//
MDIWin::Config::instance()
.setclass<MDIWin::Config::HandleType::CLASS_TBAR>(this);
//
return { true, true };
}
while (0);
}
catch (...) {}
return { true, false };
}
int32_t ToolBar::getsizebtn_()
{
if (!Base::m_data.window)
return -1;
LRESULT ret = ::SendMessage(Base::m_data.window, TB_GETBUTTONSIZE, 0, 0);
auto p = MAKEPOINTS(ret);
if (p.x != p.y)
return -1;
return p.y;
}
bool ToolBar::setup_()
{
::SetLastError(0);
const TBBUTTON tbb[] =
{
# define TB_ITEM(A,B,C,...) TB_ITEM_ ## B (A,B,C)
# define TB_ITEM_TBSTYLE_BUTTON(A,B,C) \
{ .iBitmap = __COUNTER__, .idCommand = C, .fsState = A, .fsStyle = B, .bReserved = {}, .dwData = 0, .iString = 0 },
# define TB_ITEM_TBSTYLE_SEP(A,B,C) \
{ .iBitmap = 0, .idCommand = C, .fsState = A, .fsStyle = B, .bReserved = {}, .dwData = 0, .iString = 0 },
# define TB_CHANGE(...)
# include "ToolBarItems.h"
};
//int32_t imgcnt = (__COUNTER__ + 3);
ImageLite::IPOINT<int32_t> ip{};
MDIWin::Config::instance().getiml(
MDIWin::Config::ImageButtonList::IMLBTN_TITLEBAR_CTRL, ip
);
if (ip.empty())
return false;
ip.x += 2;
ip.y += 2;
::SendMessage(Base::m_data.window, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
::SendMessage(Base::m_data.window, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
::SendMessage(Base::m_data.window, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)
MDIWin::Config::instance().getiml(MDIWin::Config::ImageButtonList::IMLBTN_TOOLBAR_CTRL)
);
::SendMessage(Base::m_data.window, TB_SETBUTTONSIZE, 0, MAKELPARAM(ip.x, ip.y));
::SendMessage(Base::m_data.window, TB_ADDBUTTONS, __NELE(tbb), (LPARAM)&tbb);
::SendMessage(Base::m_data.window, TB_SETPADDING, 0, MAKELPARAM(0, 0));
::SendMessage(Base::m_data.window, TB_AUTOSIZE, 0, 0);
::SendMessage(Base::m_data.window, WM_SETFONT, (WPARAM)MDIWin::Config::instance().getfont(), (LPARAM)1);
//
return true;
}
// get search text
std::string ToolBar::event()
{
return m_search.gettext();
}
// change button
void ToolBar::event(int32_t bidx, int32_t bcmd, int32_t bset, int32_t bimg)
{
static const TBChangeButton l_chbtn[] =
{
# define TB_CHANGE(A,B,C,D,E) \
{ .btnidx = A, .cmdcur = B, .cmdnew = C, .imgidx = D, .state = E },
# define TB_ITEM(...)
# include "ToolBarItems.h"
};
do
{
if (bidx > ::SendMessage(Base::m_data.window, TB_BUTTONCOUNT, 0, 0))
break;
TBBUTTON tbb{};
if (!::SendMessage(Base::m_data.window, TB_GETBUTTON, bidx, reinterpret_cast<LPARAM>(&tbb)))
break;
if (tbb.fsStyle == TBSTYLE_SEP)
break;
for (uint32_t i = 0U; i < __NELE(l_chbtn); i++)
{
if ((l_chbtn[i].btnidx == bidx) &&
(
((bcmd == -1) && (l_chbtn[i].cmdcur == tbb.idCommand)) ||
((bcmd != -1) && (l_chbtn[i].cmdnew == bcmd))
))
{
//
TBChangeButton btn{};
btn.cmdcur = tbb.idCommand;
btn.cmdnew = ((bcmd == -1) ? l_chbtn[i].cmdnew : bcmd);
btn.state = ((bset == -1) ? l_chbtn[i].state : bset);
btn.imgidx = ((bimg == -1) ? l_chbtn[i].imgidx : bimg);
//
if ((btn.state != -1) && (btn.state != tbb.fsState))
::SendMessage(Base::m_data.window, TB_SETSTATE, btn.cmdcur, (LPARAM)btn.state);
//
if ((btn.imgidx != -1) && (btn.imgidx != tbb.iBitmap))
::SendMessage(Base::m_data.window, TB_CHANGEBITMAP, btn.cmdcur, btn.imgidx);
//
if ((btn.cmdnew != -1) && (btn.cmdnew != tbb.idCommand))
::SendMessage(Base::m_data.window, TB_SETCMDID, btn.cmdcur, btn.cmdnew);
//
break;
}
}
}
while (0);
}
// set plugins toolBar menu
void ToolBar::event(uint32_t mid, uint32_t off, std::vector<MDIWin::BaseData::dataMap> & v)
{
m_menu.add(
static_cast<MenuBar::MainMenuId>(mid),
off,
v
);
}
// set style toolBar button (image/enable/disable)
void ToolBar::event(int32_t id, bool isenable)
{
switch (id)
{
case IDM_EVENT_SCRUN_START:
{
event(TB_BTN_CHECK, -1, 0);
event(TB_BTN_START, -1, 0);
event(TB_BTN_EXIT, -1, 0);
event(TB_BTN_STOP, -1, TBSTATE_ENABLED);
m_menu.setenable(IDM_BTN_SCRUN_TEST, false);
m_menu.setenable(IDM_BTN_SCRUN_START, false);
m_menu.setenable(IDM_BTN_EXIT, false);
m_menu.setenable(IDM_BTN_SCRUN_STOP, true);
if (isenable)
{
event(TB_BTN_MODE, IDM_BTN_DBGDUMP);
event(TB_BTN_NAVIGATTE, IDM_EDIT_SHOW_NAVIGATE, -1, 21);
//
m_menu.setcheck(IDM_BTN_DBGSTEP, true);
m_menu.setcheck(IDM_BTN_DBGCYCLE, false);
//
m_menu.setenable(IDM_BTN_DBGDUMP, true);
m_menu.setenable(IDM_BTN_DBGNEXT, true);
}
else
{
m_menu.setcheck(IDM_BTN_DBGSTEP, false);
m_menu.setcheck(IDM_BTN_DBGCYCLE, true);
//
m_menu.setenable(IDM_BTN_DBGDUMP, false);
m_menu.setenable(IDM_BTN_DBGNEXT, false);
}
break;
}
case IDM_EVENT_SCRUN_STOP:
{
event(TB_BTN_MODE, IDM_BTN_DBGCYCLE);
event(TB_BTN_CHECK, -1, TBSTATE_ENABLED);
event(TB_BTN_START, -1, TBSTATE_ENABLED);
event(TB_BTN_EXIT, -1, TBSTATE_ENABLED);
event(TB_BTN_STOP, -1, 0);
event(TB_BTN_NAVIGATTE, IDM_EDIT_SHOW_NAVIGATE);
//
m_menu.setenable(IDM_BTN_SCRUN_TEST, true);
m_menu.setenable(IDM_BTN_SCRUN_START, true);
m_menu.setenable(IDM_BTN_EXIT, true);
m_menu.setenable(IDM_BTN_SCRUN_STOP, false);
//
m_menu.setenable(IDM_BTN_DBGDUMP, false);
m_menu.setenable(IDM_BTN_DBGNEXT, false);
//
m_menu.setcheck(IDM_BTN_DBGSTEP, false);
m_menu.setcheck(IDM_BTN_DBGCYCLE, true);
break;
}
case IDM_BTN_DBGMODE:
{
event(TB_BTN_MODE,
((isenable) ? IDM_BTN_DBGSTEP : IDM_BTN_DBGCYCLE)
);
m_menu.setcheck(IDM_BTN_DBGSTEP, isenable);
m_menu.setcheck(IDM_BTN_DBGCYCLE, !isenable);
break;
}
case IDM_BTN_DBGSTEP:
{
event(TB_BTN_MODE, IDM_BTN_DBGSTEP);
m_menu.setcheck(IDM_BTN_DBGSTEP, true);
m_menu.setcheck(IDM_BTN_DBGCYCLE, false);
break;
}
case IDM_BTN_DBGCYCLE:
{
event(TB_BTN_MODE, IDM_BTN_DBGCYCLE);
m_menu.setcheck(IDM_BTN_DBGSTEP, false);
m_menu.setcheck(IDM_BTN_DBGCYCLE, true);
break;
}
case IDM_EVENT_EDIT_FINDTEXT:
{
if (isenable)
event(TB_BTN_NAVIGATTE, IDM_EDIT_SHOW_NAVIGATE, -1, 21);
else
event(TB_BTN_NAVIGATTE, IDM_EDIT_SHOW_NAVIGATE);
break;
}
case IDM_BTN_WINTOP:
case IDM_BTN_EXTDBGV:
case IDM_BTN_DBGMUTE:
case IDM_EDIT_SHOW_ENDLINE:
case IDM_EDIT_SHOW_INDENTG:
{
m_menu.setcheck(id, isenable);
break;
}
default:
break;
}
}
};
| 35.891566
| 131
| 0.471031
|
ClnViewer
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.