Skip to content

Commit

Permalink
Refactor: Add commentaries
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpellegrini committed Jan 21, 2023
1 parent f9f747b commit 6fea65a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Raylib_BaseProject/examples/core/My3DPrimitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void MyDrawSphere(Sphere sphere, int nMeridians, int nParallels, bool drawPolygo
if (drawWireframe) MyDrawWireframeSphere(sphere, nMeridians, nParallels, wireframeColor);
}

// Fonctions Potion Sphère
/********************* Fonctions Portion de primitive Sphère *********************/
void MyDrawPolygonSpherePortion(Sphere sphere, int nMeridians, int nParallels, float startTheta, float endTheta, float startPhi, float endPhi, Color color)
{
int numVertex = nMeridians * nParallels * 4;
Expand Down Expand Up @@ -598,14 +598,15 @@ void MyDrawInfiniteCylinder(InfiniteCylinder infiniteCylinder, int nSectors, boo
if (drawWireframe) MyDrawWireframeCylinder(inf_cylinder, nSectors, false, wireframeColor);
}

// Fonctions Potion Cylindre
/******************** Fonctions Portion de primitive Cylinder *********************/
void MyDrawPolygonCylinderPortion(Cylinder cylinder, int nSectors, float startTheta, float endTheta, Color color)
{
int numVertex = nSectors * 4;
rlPushMatrix();
rlTranslatef(cylinder.ref.origin.x, cylinder.ref.origin.y, cylinder.ref.origin.z);
Vector3 vect;
float angle;
float angle;
QuaternionToAxisAngle(cylinder.ref.q, &vect, &angle);
rlRotatef(angle * RAD2DEG, vect.x, vect.y, vect.z);
rlScalef(cylinder.radius, cylinder.halfHeight, cylinder.radius);
Expand Down
21 changes: 19 additions & 2 deletions Raylib_BaseProject/examples/core/My3DPrimitives.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ void MyDrawPlane(Plane plane, bool drawPolygon = true, bool drawWireframe = true
/************************************************
* Disk *
*************************************************/
// nSectors -> Nombre de sections dessinées qui vont permettre de former la primitive Disk
// Plus on augmente ce paramètre et plus la primitive Disk sera ronde et précise
void MyDrawPolygonDisk(Disk disk, int nSectors, Color color = LIGHTGRAY);
void MyDrawWireframeDisk(Disk disk, int nSectors, Color color = DARKGRAY);
void MyDrawDisk(Disk disk, int nSectors, bool drawPolygon = true, bool drawWireframe = true, Color polygonColor = LIGHTGRAY, Color wireframeColor = DARKGRAY);
Expand All @@ -147,39 +149,54 @@ void MyDrawBox(Box box, bool drawPolygon = true, bool drawWireframe = true, Colo
/************************************************
* Sphere *
*************************************************/
// nMeridians -> nombre de lignes verticales qui composent la primitive Sphere
// nParralels -> nombre de lignes horizontales qui composent la primitive Sphere
void MyDrawPolygonSphere(Sphere sphere, int nMeridians, int nParallels, Color color = LIGHTGRAY);
void MyDrawWireframeSphere(Sphere sphere, int nMeridians, int nParallels, Color color = DARKGRAY);
void MyDrawSphere(Sphere sphere, int nMeridians, int nParallels, bool drawPolygon = true, bool drawWireframe = true, Color polygonColor = LIGHTGRAY, Color wireframeColor = DARKGRAY);

// Fonctions Potion Sphère
/********************* Fonctions Portion de primitive Sphère *********************/
// startTheta -> Angle de départ (en radians) pour le dessin des parallèles
// endTheta -> Angle final (en radians) pour le dessin des parallèles
// startPhi -> Angle de départ (en radians) pour le dessin des méridians
// endPhi -> Angle final (en radians) pour le dessin des méridians
void MyDrawPolygonSpherePortion(Sphere sphere, int nMeridians, int nParallels, float startTheta, float endTheta, float startPhi, float endPhi, Color color = LIGHTGRAY);
void MyDrawWireframeSpherePortion(Sphere sphere, int nMeridians, int nParallels, float startTheta, float endTheta, float startPhi, float endPhi, Color color = LIGHTGRAY);
void MyDrawSpherePortion(Sphere sphere, int nMeridians, int nParallels, float startTheta, float endTheta, float startPhi, float endPhi, bool drawPolygon = true, bool drawWireframe = true, Color polygonColor = LIGHTGRAY, Color wireframeColor = DARKGRAY);

/************************************************
* Cylinder *
*************************************************/
// nSectors -> Nombre de sections dessinées qui vont permettre de former la primitive Cylinder
void MyDrawInfiniteCylinder(InfiniteCylinder infiniteCylinder, int nSectors, bool drawPolygon = true, bool drawWireframe = true, Color polygonColor = LIGHTGRAY, Color wireframeColor = DARKGRAY);

// drawCaps -> Indique s'il faut dessiner les disques supérieur et inférieur de la primitive Cylinder
void MyDrawPolygonCylinder(Cylinder cylinder, int nSectors, bool drawCaps = false, Color color = LIGHTGRAY);
void MyDrawWireframeCylinder(Cylinder cylinder, int nSectors, bool drawCaps = false, Color color = LIGHTGRAY);
void MyDrawCylinder(Cylinder cylinder, int nSectors, bool drawCaps = false, bool drawPolygon = true, bool drawWireframe = true, Color polygonColor = LIGHTGRAY, Color wireframeColor = DARKGRAY);

// Fonctions Potion Cylindre
/******************** Fonctions Portion de primitive Cylinder *********************/
// startTheta -> Angle de départ (en radians) pour le dessin de la primitive Cylinder
// endTheta -> Angle final (en radians) pour le dessin de la primitive Cylinder
void MyDrawPolygonCylinderPortion(Cylinder cylinder, int nSectors, float startTheta, float endTheta, Color color = LIGHTGRAY);
void MyDrawWireframeCylinderPortion(Cylinder cylinder, int nSectors, float startTheta, float endTheta, Color color = LIGHTGRAY);
void MyDrawCylinderPortion(Cylinder cylinder, int nSectors, float startTheta, float endTheta, bool drawPolygon = true, bool drawWireframe = true, Color polygonColor = LIGHTGRAY, Color wireframeColor = DARKGRAY);

/************************************************
* Capsule *
*************************************************/
// nSectors -> Nombre de sections dessinées qui vont permettre de former la primitive Cylinder qui compose la Capsule
// Permet aussi de déterminer le nombre de méridians qui vont former les portions de Sphere
// nParallels -> Nombre de parallèles qui vont former les portions de Sphere
void MyDrawPolygonCapsule(Capsule capsule, int nSectors, int nParallels, Color color = LIGHTGRAY);
void MyDrawWireframeCapsule(Capsule capsule, int nSectors, int nParallels, Color color = LIGHTGRAY);
void MyDrawCapsule(Capsule capsule, int nSectors, int nParallels, bool drawPolygon = true, bool drawWireframe = true, Color polygonColor = LIGHTGRAY, Color wireframeColor = DARKGRAY);

/************************************************
* RoundedBox *
*************************************************/
// nSectors -> Nombre de sections dessinées qui vont permettre de former les portions de Cylinder qui composent la RoundedBox
// Pour les portions de Sphere : nSectors <==> nMeridians <==> nParrallels
void MyDrawPolygonRoundedBox(RoundedBox roundedBox, int nSectors, Color color = LIGHTGRAY);
void MyDrawWireframeRoundedBox(RoundedBox roundedBox, int nSectors, Color color = LIGHTGRAY);
void MyDrawRoundedBox(RoundedBox roundedBox, int nSectors, bool drawPolygon = true, bool drawWireframe = true, Color polygonColor = LIGHTGRAY, Color wireframeColor = DARKGRAY);

0 comments on commit 6fea65a

Please sign in to comment.