Skip to content

Commit 839bfab

Browse files
committed
[1.3.34] 2025-06-15
- Added .clang-format file for consistent code formatting across IDEs and agents. - Added AGENTS.md to give some basic instructions for AI agents. *Context* - Reworked Context::cleanDeletedUUIDs() and Context::cleanDeletedObjectIDs() to erase invalid IDs using iterators, preventing unsigned underflow issues when vectors are empty. - Fixed a loop in Context::loadMTL() that could cause unsigned underflow. - Context::writeOBJ() can now maintain object groups based on the value of the primitive data "object_label". - Context::writeOBJ() was defining normals (if enabled), but they were not being assigned to faces. This has been fixed. - Improved stability of Tube::appendTubeSegment(), Context::addConeObject(), Context::addTubeObject(), and helios::rotatePointAboutLine() to prevent dividing by nearly zero when the vector length is very small. - Added helios::powi() function to calculate integer powers of a number, which is more efficient than using std::pow() for integer exponents and avoids having to do "a = b*b*b*b", for example. - Added methods Context::scaleObjectAboutOrigin() and Context::rotateObjectAboutOrigin() to scale and rotate an object about its origin, which can be set with Context::setObjectOrigin(). *Radiation* - Added many new camera response spectra to the spectral library (spectral_data/camera_spectral_library.xml). - The spectral labels were not correct for the default DGK colorboard (CameraCalibration::addDefaultColorboard()). - Added the ability to create the Calibrite ColorChecker Classic in the scene. Accordingly added explicit functions CameraCalibration::addDGKColorboard() and CameraCalibration::addCalibriteColorboard() to add the two available color boards. - Added RadiationModel::applyImageProcessingPipeline() to apply a digital camera-like processing pipeline to an image. *Plant Architecture* - Added capability to scale petioles of the same internode independently.
1 parent 4db2e19 commit 839bfab

File tree

439 files changed

+40502
-41546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

439 files changed

+40502
-41546
lines changed

.clang-format

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignConsecutiveAssignments: false
6+
AlignConsecutiveDeclarations: false
7+
AlignOperands: true
8+
AlignTrailingComments: false
9+
AlwaysBreakTemplateDeclarations: Yes
10+
BraceWrapping:
11+
AfterCaseLabel: false
12+
AfterClass: false
13+
AfterControlStatement: false
14+
AfterEnum: false
15+
AfterFunction: false
16+
AfterNamespace: false
17+
AfterStruct: false
18+
AfterUnion: false
19+
AfterExternBlock: false
20+
BeforeCatch: false
21+
BeforeElse: false
22+
BeforeLambdaBody: false
23+
BeforeWhile: false
24+
SplitEmptyFunction: true
25+
SplitEmptyRecord: true
26+
SplitEmptyNamespace: true
27+
BreakBeforeBraces: Custom
28+
BreakConstructorInitializers: AfterColon
29+
BreakConstructorInitializersBeforeComma: false
30+
ColumnLimit: 250
31+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
32+
ContinuationIndentWidth: 8
33+
IncludeCategories:
34+
- Regex: '^<.*'
35+
Priority: 1
36+
- Regex: '^".*'
37+
Priority: 2
38+
- Regex: '.*'
39+
Priority: 3
40+
IncludeIsMainRegex: '([-_](test|unittest))?$'
41+
IndentCaseLabels: true
42+
IndentWidth: 4
43+
InsertNewlineAtEOF: true
44+
MacroBlockBegin: ''
45+
MacroBlockEnd: ''
46+
MaxEmptyLinesToKeep: 2
47+
NamespaceIndentation: All
48+
SpaceAfterCStyleCast: true
49+
SpaceAfterTemplateKeyword: false
50+
SpaceBeforeRangeBasedForLoopColon: false
51+
SpaceInEmptyParentheses: false
52+
SpacesInAngles: false
53+
SpacesInConditionalStatement: false
54+
SpacesInCStyleCastParentheses: false
55+
SpacesInParentheses: false
56+
TabWidth: 4
57+
...
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build and Run on Linux EC2 GPU Instance
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11+
BUILD_TYPE: Release
12+
13+
permissions:
14+
id-token: write
15+
contents: read
16+
17+
jobs:
18+
19+
start-gpu:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: aws-actions/configure-aws-credentials@v2
23+
with:
24+
role-to-assume: ${{ secrets.OIDC_ROLE_ARN }}
25+
aws-region: us-west-2
26+
- run: |
27+
aws ec2 start-instances --instance-ids ${{ secrets.EC2_INSTANCE_ID }}
28+
aws ec2 wait instance-running --instance-ids ${{ secrets.EC2_INSTANCE_ID }}
29+
30+
run_samples_linux:
31+
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
32+
# You can convert this to a matrix build if you need cross-platform coverage.
33+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
34+
runs-on: [self-hosted]
35+
needs: start-gpu
36+
steps:
37+
- uses: actions/checkout@v3
38+
#- uses: openrndr/[email protected]
39+
- name: Checkout OPENRNDR repository
40+
uses: actions/checkout@v3
41+
with:
42+
fetch-depth: 0
43+
repository: openrndr/openrndr
44+
path: ./openrndr
45+
ref: master
46+
47+
- name: Test glxinfo
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y mesa-utils xvfb
51+
xvfb-run glxinfo
52+
53+
- name: Install dependent packages for visualizer
54+
run: |
55+
sudo apt-get update -y
56+
sudo apt-get install -y libx11-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev
57+
58+
- name: Bash script
59+
run: |
60+
cd utilities
61+
./run_samples.sh --visbuildonly
62+
63+
64+
stop-gpu:
65+
needs: run_samples_linux
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: aws-actions/configure-aws-credentials@v2
69+
with:
70+
role-to-assume: ${{ secrets.OIDC_ROLE_ARN }}
71+
aws-region: us-west-2
72+
- run: |
73+
aws ec2 stop-instances --instance-ids ${{ secrets.EC2_INSTANCE_ID }}
74+
aws ec2 wait instance-stopped --instance-ids ${{ secrets.EC2_INSTANCE_ID }}

AGENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Code Style
2+
- Code style should follow the style given in .clang-format.
3+
4+
## Testing
5+
- Do not try to run utilities/run_samples.sh. It will time out.
6+
- If changes are made to docstrings or function signatures, build the documentation file `doc/Doxyfile` using doxygen. Some notes on this are given below:
7+
- Run `doxygen doc/Doxyfile` to generate the documentation from the root directory not the `doc` directory.
8+
- Check doxygen output for warnings. It is ok to ignore warnings of the form " warning: Member XXX is not documented."
9+
- The main concern when changing docstrings or function signatures is the potential for breaking \ref references, which produces a warning like: warning: unable to resolve reference to XXX for \ref command".
10+
When fixing these, don't just remove the funciton signature or use markdown `` ticks to suppress the warning. It is important to keep the signature in the reference for overloaded functions/methods. Figure out why the function signature is not matching and thus causing Doxygen to treat it as plain text.
11+
- You tend to flag hash symbols in code blocks as erroneous and propose to add a double hash (e.g., '##include "Context.h"'). This is not needed and ends up rendering the double hash.

core/CMake_project.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE STRING "" )
3434
add_executable( ${EXECUTABLE_NAME} ${SOURCE_FILES} )
3535
add_subdirectory( "${BASE_DIRECTORY}/core" "lib" )
3636
target_link_libraries( ${EXECUTABLE_NAME} helios)
37+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
38+
target_link_libraries(${EXECUTABLE_NAME} stdc++fs)
39+
endif()
3740
if(APPLE) #get rid of annoying duplicate library warning on Mac
3841
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_warn_duplicate_libraries")
3942
endif()
@@ -48,13 +51,14 @@ foreach(PLUGIN ${PLUGINS})
4851
target_link_libraries( ${EXECUTABLE_NAME} ${PLUGIN} )
4952
if( NOT APPLE )
5053
target_link_libraries( ${PLUGIN} helios )
54+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
55+
target_link_libraries(${PLUGIN} stdc++fs)
56+
endif()
5157
endif()
5258
endforeach(PLUGIN)
5359
include_directories( "${PLUGIN_INCLUDE_PATHS};${CMAKE_CURRENT_SOURCE_DIRECTORY}" )
5460

55-
if( CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" )
56-
target_compile_definitions(helios PRIVATE HELIOS_DEBUG)
57-
endif()
61+
target_compile_definitions(helios PUBLIC $<$<CONFIG:Debug>:HELIOS_DEBUG> $<$<CONFIG:RelWithDebInfo>:HELIOS_DEBUG> )
5862

5963
if( ENABLE_OPENMP )
6064
find_package(OpenMP)

core/include/Context.h

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,11 @@ class CompoundObject{
579579

580580
//! Affine transformation matrix
581581
float transform[16];
582+
583+
//! Origin position of the object about which it can be scaled and rotated
584+
helios::vec3 object_origin;
582585

583-
//! Flag to indicate whether all object primitives are in tact. If any primitives have been deleted, this flag will be set to false.
586+
//! Flag to indicate whether all object primitives are intact. If any primitives have been deleted, this flag will be set to false.
584587
bool primitivesarecomplete = true;
585588

586589
std::map<std::string,HeliosDataType > object_data_types;
@@ -3567,6 +3570,15 @@ class Context{
35673570
*/
35683571
void setObjectAverageNormal(uint ObjID, const vec3& origin, const vec3& new_normal) const;
35693572

3573+
//! Set the origin position of the object about which it can be rotated and scaled
3574+
/**
3575+
* Note that this does not change the position of the object in the scene, but rather sets the origin point about which the object can later be rotated and scaled.
3576+
*
3577+
* \param[in] ObjID Identifier of the object.
3578+
* \param[in] origin (x,y,z) Coordinates of the new origin point.
3579+
*/
3580+
void setObjectOrigin( uint ObjID, const vec3& origin ) const;
3581+
35703582
//! Method to check whether an Object has texture data
35713583
/**
35723584
* \param[in] ObjID Identifier of the object.
@@ -4868,6 +4880,22 @@ class Context{
48684880
*/
48694881
void rotateObject(const std::vector<uint>& ObjIDs, float rotation_radians, const vec3& rotation_origin, const vec3& rotation_axis_vector ) const;
48704882

4883+
//! Rotate a single compound object about an arbitrary line passing through the objects origin point
4884+
/**
4885+
* \param[in] ObjID Object ID to rotate
4886+
* \param[in] rotation_radians Rotation angle in radians
4887+
* \param[in] rotation_axis_vector Vector describing axis about which to rotate
4888+
*/
4889+
void rotateObjectAboutOrigin(uint ObjID, float rotation_radians, const vec3& rotation_axis_vector ) const;
4890+
4891+
//! Rotate multiple compound objects about an arbitrary line passing through the objects origin point
4892+
/**
4893+
* \param[in] ObjIDs Vector of object IDs to translate
4894+
* \param[in] rotation_radians Rotation angle in radians
4895+
* \param[in] rotation_axis_vector Vector describing axis about which to rotate
4896+
*/
4897+
void rotateObjectAboutOrigin(const std::vector<uint>& ObjIDs, float rotation_radians, const vec3& rotation_axis_vector ) const;
4898+
48714899
//! Method to scale a compound object in the x-, y- and z-directions
48724900
/**
48734901
* \param[in] ObjID Object ID to scale
@@ -4896,22 +4924,38 @@ class Context{
48964924
*/
48974925
void scaleObjectAboutCenter( const std::vector<uint>& ObjIDs, const helios::vec3 &scalefact ) const;
48984926

4899-
//! Method to scale a compound object in the x-, y- and z-directions
4927+
//! Method to scale a compound object in the x-, y- and z-directions about an arbitrary point
49004928
/**
49014929
* \param[in] ObjID Object ID to scale
49024930
* \param[in] scalefact Scaling factor to apply in the x-, y- and z-directions
49034931
* \param[in] point Cartesian coordinate of the point about which to scale
49044932
*/
49054933
void scaleObjectAboutPoint( uint ObjID, const helios::vec3 &scalefact, const helios::vec3 &point ) const;
49064934

4907-
//! Method to scale a compound object in the x-, y- and z-directions
4935+
//! Method to scale a compound object in the x-, y- and z-directions about an arbitrary point
49084936
/**
49094937
* \param[in] ObjIDs Vector of object IDs to scale
49104938
* \param[in] scalefact Scaling factor to apply in the x-, y- and z-directions
49114939
* \param[in] point Cartesian coordinate of the point about which to scale
49124940
*/
49134941
void scaleObjectAboutPoint( const std::vector<uint>& ObjIDs, const helios::vec3 &scalefact, const helios::vec3 &point ) const;
49144942

4943+
//! Method to scale a compound object in the x-, y- and z-directions about its origin point
4944+
/**
4945+
* \param[in] ObjID Object ID to scale
4946+
* \param[in] scalefact Scaling factor to apply in the x-, y- and z-directions
4947+
* \note By default the object origin is its center. This can be changed by setting the object origin using the setObjectOrigin method
4948+
*/
4949+
void scaleObjectAboutOrigin( uint ObjID, const helios::vec3 &scalefact ) const;
4950+
4951+
//! Method to scale a compound object in the x-, y- and z-directions about its origin point
4952+
/**
4953+
* \param[in] ObjIDs Vector of object IDs to scale
4954+
* \param[in] scalefact Scaling factor to apply in the x-, y- and z-directions
4955+
* \note By default the object origin is its center. This can be changed by setting the object origin using the setObjectOrigin method
4956+
*/
4957+
void scaleObjectAboutOrigin( const std::vector<uint>& ObjIDs, const helios::vec3 &scalefact ) const;
4958+
49154959
//! Get primitive UUIDs associated with compound object (single object ID input)
49164960
/**
49174961
* \param[in] ObjID object ID to retrieve primitive UUIDs for

core/include/global.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,14 @@ namespace helios {
650650
*/
651651
[[nodiscard]] float asin_safe(float x);
652652

653+
//! Exponentiation function for integer powers
654+
/**
655+
* \param[in] base Base to be raised to a power
656+
* \param[in] exp Exponent to which the base is raised (must be a non-negative integer)
657+
*/
658+
template<typename T>
659+
T powi(T base, std::size_t exp);
660+
653661
//!Determine if two line segments intersect. The lines segments are defined by vertices (p1,q1) and (p2,q2)
654662
/**
655663
* \ingroup functions

0 commit comments

Comments
 (0)