-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A set of files which I hope are usable by others using ESP-IDF v5.3.0
- Loading branch information
Showing
57 changed files
with
12,049 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
project(i80_controller) |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
dependencies: | ||
idf: | ||
source: | ||
type: idf | ||
version: 5.3.0 | ||
direct_dependencies: | ||
- idf | ||
manifest_hash: 620bb73887c520f756e6770a2a31cc1ad0837429534c5bc6dd432791ad7c3df6 | ||
target: esp32s3 | ||
version: 2.0.0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
idf_component_register( | ||
SRCS | ||
"i80_lcd_main.cpp" | ||
"ShowWorld.cpp" | ||
"ClipBound.cpp" | ||
"CameraWork.cpp" | ||
"CheckTriangles.cpp" | ||
"ShowError.cpp" | ||
"TriangleQueues.cpp" | ||
"wr_gpio.cpp" | ||
"ChunkChooser.cpp" | ||
"RasteriseBox.cpp" | ||
"lcd_setup.c" | ||
"ParseWorld.cpp" | ||
"FindHitFace.cpp" | ||
"TimeTracker.cpp" | ||
"EventManager.cpp" | ||
|
||
INCLUDE_DIRS | ||
"." | ||
"includes" | ||
"World" | ||
REQUIRES esp_partition esp_lcd esp_mm esp_timer | ||
) | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include <math.h> | ||
|
||
#include "geometry.h" | ||
#include "CameraWork.h" | ||
|
||
|
||
void make_camera(const Vec3f direction, const Vec3f cameraPosition, Matrix44f& worldToCamera) | ||
{ | ||
// Build the view matrix as per https://medium.com/@carmencincotti/lets-look-at-magic-lookat-matrices-c77e53ebdf78 | ||
// This has worked with basic geometry functions but converted to glm to ensure that it works with the rest of 3D code | ||
|
||
Vec3f forwardvector = (-direction).normalize(); | ||
|
||
const Vec3f tempup = { 0,1,0 }; | ||
Vec3f rightvector = (tempup.crossProduct(forwardvector)).normalize(); | ||
|
||
Vec3f upvector = (forwardvector.crossProduct(rightvector)).normalize(); | ||
|
||
Vec3f translate; | ||
translate.x = rightvector.dotProduct(cameraPosition); | ||
translate.y = upvector.dotProduct(cameraPosition); | ||
translate.z = forwardvector.dotProduct(cameraPosition); | ||
|
||
Matrix44f LookAt = { | ||
rightvector.x,rightvector.y,rightvector.z,-translate.x, | ||
upvector.x,upvector.y,upvector.z,-translate.y, | ||
forwardvector.x,forwardvector.y,forwardvector.z,-translate.z, | ||
0,0,0,1 }; | ||
|
||
worldToCamera = LookAt.transposed(); | ||
} // End of make_camera() | ||
|
||
// Make a perspective projection matrix, simplified from glm opensource library | ||
// so that can be used without glm library | ||
void make_perspective( | ||
float const fovy, // must be in radians | ||
float const aspect, | ||
float const zNear, | ||
float const zFar, | ||
Matrix44f& Result | ||
) | ||
{ | ||
float tanHalfFovy = tan(fovy / 2.0f); | ||
|
||
Result[0][0] = 1.0f / (aspect * tanHalfFovy); | ||
Result[1][1] = 1.0f / (tanHalfFovy); | ||
Result[2][2] = -(zFar + zNear) / (zFar - zNear); | ||
Result[2][3] = -1.0f; | ||
Result[3][2] = -(2.0f * zFar * zNear) / (zFar - zNear); | ||
} // End of make_perspective | ||
|
Oops, something went wrong.