<commit_before>#include "cinder/app/App.h"
#include "cinder/Camera.h"
#include "cinder/CameraUi.h"
#include "cinder/gl/gl.h"

#include "CinderPhysx.h"

#include "PxRigidDynamic.h"
#include "PxShape.h"

class BasicApp : public ci::app::App, public physx::PxBroadPhaseCallback
{
public:
	BasicApp();

	void				draw() override;
	void				keyDown( ci::app::KeyEvent event ) override;
	void				resize() override;
	void				update() override;
private:
	ci::CameraPersp		mCamera;
	ci::CameraUi		mCamUi;

	ci::gl::BatchRef	mBatchStockColorCapsule;
	ci::gl::BatchRef	mBatchStockColorCube;
	ci::gl::BatchRef	mBatchStockColorPlane;
	ci::gl::BatchRef	mBatchStockColorSphere;

	physx::PxMaterial*	mMaterial;
	PhysxRef			mPhysx;
	virtual void		onObjectOutOfBounds( physx::PxShape& shape, physx::PxActor& actor );
	virtual void		onObjectOutOfBounds( physx::PxAggregate& aggregate );
};

using namespace ci;
using namespace ci::app;
using namespace physx;
using namespace std;

#include "cinder/app/RendererGl.h"
#include "cinder/Log.h"
#include "cinder/Rand.h"

BasicApp::BasicApp()
{
	mCamera	= CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
	mCamera.lookAt( vec3( 0.0f, 3.0f, 20.0f ), vec3( 0.0f, 2.0f, 0.0f ) );
	mCamUi	= CameraUi( &mCamera, getWindow() );

	// Initialize Physx
	mPhysx = Physx::create();

	// Create a material for all actors
	mMaterial = mPhysx->getPhysics()->createMaterial( 0.5f, 0.5f, 1.0f );

	// Create a scene. Multiples scenes are allowed.
	mPhysx->createScene();

	// Connects onObjectOutOfBounds to scene. This lets us manage 
	// objects that have gone out of bounds.
	mPhysx->getScene()->setBroadPhaseCallback( this );

	// Add the plane to the scene.
	mPhysx->addActor( PxCreatePlane(
		*mPhysx->getPhysics(),
		PxPlane( Physx::to( vec3( 0.0f, 1.0f, 0.0f ) ), 0.0f ),
		*mMaterial
		), mPhysx->getScene() );

	// Create shader and geometry batches
	gl::GlslProgRef stockColor	= gl::getStockShader( gl::ShaderDef().color() );
	gl::VboMeshRef capsule		= gl::VboMesh::create( geom::Capsule()
													   .subdivisionsAxis( 16 )
													   .subdivisionsHeight( 16 ) );
	gl::VboMeshRef cube			= gl::VboMesh::create( geom::Cube().colors() );
	gl::VboMeshRef plane		= gl::VboMesh::create( geom::Plane()
													   .axes( vec3( 0.0f, 1.0f, 0.0f ), vec3( 0.0f, 0.0f, 1.0f ) )
													   .size( vec2( 100.0f ) )
													   .subdivisions( ivec2( 32 ) ) );
	gl::VboMeshRef sphere		= gl::VboMesh::create( geom::Sphere()
													   .colors()
													   .subdivisions( 32 ) );
	mBatchStockColorCapsule		= gl::Batch::create( capsule,	stockColor );
	mBatchStockColorCube		= gl::Batch::create( cube,		stockColor );
	mBatchStockColorPlane		= gl::Batch::create( plane,		stockColor );
	mBatchStockColorSphere		= gl::Batch::create( sphere,	stockColor );

	resize();

	gl::enableDepthRead();
	gl::enableDepthWrite();
	gl::enableVerticalSync();
	gl::polygonMode( GL_FRONT_AND_BACK, GL_LINE );
}

void BasicApp::draw()
{
	gl::clear();
	const gl::ScopedMatrices scopedMatrices;
	gl::setMatrices( mCamera );

	for ( const auto& iter : mPhysx->getActors() ) {

		// Cast to rigid actor.
		if ( iter.second->getType() == PxActorType::eRIGID_DYNAMIC || 
			 iter.second->getType() == PxActorType::eRIGID_STATIC ) {<commit_msg>Tilted plane<commit_after>#include "cinder/app/App.h"
#include "cinder/Camera.h"
#include "cinder/CameraUi.h"
#include "cinder/gl/gl.h"

#include "CinderPhysx.h"

#include "PxRigidDynamic.h"
#include "PxShape.h"

class BasicApp : public ci::app::App, public physx::PxBroadPhaseCallback
{
public:
	BasicApp();

	void				draw() override;
	void				keyDown( ci::app::KeyEvent event ) override;
	void				resize() override;
	void				update() override;
private:
	ci::CameraPersp		mCamera;
	ci::CameraUi		mCamUi;

	ci::gl::BatchRef	mBatchStockColorCapsule;
	ci::gl::BatchRef	mBatchStockColorCube;
	ci::gl::BatchRef	mBatchStockColorPlane;
	ci::gl::BatchRef	mBatchStockColorSphere;

	physx::PxMaterial*	mMaterial;
	PhysxRef			mPhysx;
	virtual void		onObjectOutOfBounds( physx::PxShape& shape, physx::PxActor& actor );
	virtual void		onObjectOutOfBounds( physx::PxAggregate& aggregate );
};

using namespace ci;
using namespace ci::app;
using namespace physx;
using namespace std;

#include "cinder/app/RendererGl.h"
#include "cinder/Log.h"
#include "cinder/Rand.h"

BasicApp::BasicApp()
{
	mCamera	= CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
	mCamera.lookAt( vec3( 0.0f, 0.0f, 30.0f ), vec3( 0.0f, 0.0f, 0.0f ) );
	mCamUi	= CameraUi( &mCamera, getWindow() );

	// Initialize Physx
	mPhysx = Physx::create();

	// Create a material for all actors
	mMaterial = mPhysx->getPhysics()->createMaterial( 0.5f, 0.5f, 0.5f );

	// Create a scene. Multiples scenes are allowed.
	mPhysx->createScene();

	// Connects onObjectOutOfBounds to scene. This lets us manage 
	// objects that have gone out of bounds.
	mPhysx->getScene()->setBroadPhaseCallback( this );

	// Add the plane to the scene
	mPhysx->addActor( PxCreatePlane(
		*mPhysx->getPhysics(),
		PxPlane( Physx::to( vec3( 0.0f, 1.0f, 0.0f ) ), 5.0f ),
		*mMaterial
		), mPhysx->getScene() );
	
	// Rotate plane so everything slides away
	PxRigidStatic* floor	= static_cast<PxRigidStatic*>( mPhysx->getActor() );
	mat4 m					= Physx::from( floor->getGlobalPose() );
	m						= glm::rotate( m, 0.5f, vec3( 0.0f, -1.0f, 1.0f ) );
	floor->setGlobalPose( PxTransform( Physx::to( m ) ) );

	// Create shader and geometry batches
	gl::GlslProgRef stockColor	= gl::getStockShader( gl::ShaderDef().color() );
	gl::VboMeshRef capsule		= gl::VboMesh::create( geom::Capsule()
													   .subdivisionsAxis( 16 )
													   .subdivisionsHeight( 16 ) );
	gl::VboMeshRef cube			= gl::VboMesh::create( geom::Cube().colors() );
	gl::VboMeshRef plane		= gl::VboMesh::create( geom::Plane()
													   .axes( vec3( 0.0f, 1.0f, 0.0f ), vec3( 0.0f, 0.0f, 1.0f ) )
													   .size( vec2( 200.0f ) )
													   .subdivisions( ivec2( 32 ) ) );
	gl::VboMeshRef sphere		= gl::VboMesh::create( geom::Sphere()
													   .colors()
													   .subdivisions( 32 ) );
	mBatchStockColorCapsule		= gl::Batch::create( capsule,	stockColor );
	mBatchStockColorCube		= gl::Batch::create( cube,		stockColor );
	mBatchStockColorPlane		= gl::Batch::create( plane,		stockColor );
	mBatchStockColorSphere		= gl::Batch::create( sphere,	stockColor );

	resize();

	gl::enableDepthRead();
	gl::enableDepthWrite();
	gl::enableVerticalSync();
	gl::polygonMode( GL_FRONT_AND_BACK, GL_LINE );
}

void BasicApp::draw()
{
	gl::clear();
	const gl::ScopedMatrices scopedMatrices;
	gl::setMatrices( mCamera );

	for ( const auto& iter : mPhysx->getActors() ) {

		// Cast to rigid actor.
		if ( iter.second->getType() == PxActorType::eRIGID_DYNAMIC || 
			 iter.second->getType() == PxActorType::eRIGID_STATIC ) {
{'fraction_non_alphanumeric': 0.1545773618016964, 'fraction_numerical': 0.021643755484059668, 'mean_word_length': 4.080980683506686, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1863075', 'n_tokens_mistral': 2959, 'n_tokens_neox': 2594, 'n_words': 535}