MCPcopy Create free account
hub / github.com/SpartanJ/eepp / draw

Method draw

src/modules/physics/src/eepp/physics/shapepoly.cpp:54–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void ShapePoly::draw( Space* space ) {
55#ifdef PHYSICS_RENDERER_ENABLED
56 cpPolyShape* poly = (cpPolyShape*)mShape;
57
58 BatchRenderer* BR = GlobalBatchRenderer::instance();
59
60 BR->setTexture( NULL );
61
62 Color Col = colorForShape( (cpShape*)poly, space->getSpace() );
63
64 if ( !poly->CP_PRIVATE( shape ).sensor ) {
65 if ( 4 != poly->CP_PRIVATE( numVerts ) ) {
66 BR->pointsBegin();
67 BR->polygonSetColor( Col );
68
69 for ( int i = 0; i < poly->CP_PRIVATE( numVerts ); i++ ) {
70 BR->batchPolygonByPoint( poly->CP_PRIVATE( tVerts )[i].x,
71 poly->CP_PRIVATE( tVerts )[i].y );
72 }
73 } else {
74 BR->quadsBegin();
75 BR->quadsSetColor( Col );
76
77 BR->batchQuadFreeEx( poly->CP_PRIVATE( tVerts )[0].x, poly->CP_PRIVATE( tVerts )[0].y,
78 poly->CP_PRIVATE( tVerts )[1].x, poly->CP_PRIVATE( tVerts )[1].y,
79 poly->CP_PRIVATE( tVerts )[2].x, poly->CP_PRIVATE( tVerts )[2].y,
80 poly->CP_PRIVATE( tVerts )[3].x, poly->CP_PRIVATE( tVerts )[3].y );
81 }
82
83 BR->drawOpt();
84 }
85
86#endif
87}
88
89void ShapePoly::drawBorder( Space* space ) {
90#ifdef PHYSICS_RENDERER_ENABLED

Callers 1

drawBorderMethod · 0.45

Calls 10

colorForShapeFunction · 0.85
getSpaceMethod · 0.80
pointsBeginMethod · 0.80
polygonSetColorMethod · 0.80
batchPolygonByPointMethod · 0.80
quadsBeginMethod · 0.80
quadsSetColorMethod · 0.80
batchQuadFreeExMethod · 0.80
drawOptMethod · 0.80
setTextureMethod · 0.45

Tested by

no test coverage detected