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
# Computer needs to generate a secret number | |
secret_number = rand(5) + 1 | |
# initialize a variable called trys that equals 0 | |
# begin the loop | |
# Tell the user to guess a number between 1 and 10 | |
puts "guess a number between 1 and 5" | |
# User guesses a number | |
user_guess = gets.to_i |
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
#include "cinder/app/AppNative.h" | |
#include "cinder/app/RendererGl.h" | |
#include "cinder/gl/gl.h" | |
#include "cinder/qtime/QuickTimeGl.h" | |
#include "cinder/gl/Texture.h" | |
using namespace ci; | |
using namespace ci::app; | |
using namespace std; |
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
namespace osc { | |
template<typename ReceiveProtocol> | |
class Server { | |
public: | |
Server( asio::io_server &io = app::App::get()->io_service() ); | |
Server( const Server &server ) = delete; | |
Server& operator=( const Server &server ) = delete; | |
Server( Server &&server ); | |
Server& operator=( Server &&server ); |
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
#include <chrono> | |
namespace cinder { | |
// nanoseconds Alias | |
using nanoseconds = std::chrono::nanoseconds; | |
/** \brief A high-resolution timer class **/ | |
class Timer { | |
using clock = std::chrono::high_resolution_clock; |
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
ocl::printSupportedImageFormats( mClContext, CL_MEM_OBJECT_IMAGE2D ); | |
auto imageSource = loadImage( loadAsset( "sunset.jpg" ) ); | |
mClImage = ocl::createImage2D( imageSource, mClContext ); | |
mClBuffer = ocl::createBuffer( imageSource, mClContext ); | |
auto source = ocl::createSource( mClImage ); | |
mGlTexture = gl::Texture2d::create( source ); | |
writeImage( getAppPath(), source, ImageTarget::Options(), "png" ); |
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
// just give it a path getAssetPath( "MyEnormous.obj" ) and it'll do the rest. | |
// the first time through will be very long. :) | |
geom::SourceRef getGeometry( const ci::fs::path &geomPath ) | |
{ | |
auto tri = TriMesh::create( TriMesh::Format().positions().normals().texCoords() ); | |
if( geomPath.extension() == ".obj" ) { | |
auto binPath = geomPath; | |
binPath.replace_extension( "bin" ); | |
if( !fs::exists( binPath ) ) { |
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
#include "cinder/app/App.h" | |
#include "cinder/app/RendererGl.h" | |
#include "cinder/gl/gl.h" | |
using namespace ci; | |
using namespace ci::app; | |
using namespace std; | |
class HelloTriangleApp : public App { | |
public: |
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
GLTFAnimationFlattener(COLLADAFW::Node *node) { | |
this->_transformsOrder = std::shared_ptr <std::vector<std::string> > (new std::vector<std::string>); | |
const COLLADAFW::TransformationPointerArray& transformations = node->getTransformations(); | |
size_t transformationsCount = transformations.getCount(); | |
int index = 0; | |
std::cout << "--------------------------------------------------------------------------------------" << std::endl; | |
this->_hasAnimatedScale = this->_hasAnimatedTranslation = this->_hasAnimatedRotation = false; | |
this->_targetUID = node->getOriginalId(); | |
std::cout << "Target UID; " << this->_targetUID << " name: " << node->getName() << " trans count: " << transformationsCount << std::endl; |
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
<animation id="Cube_location_X"> | |
<source id="Cube_location_X-input"> | |
<float_array id="Cube_location_X-input-array" count="4">0.04166662 0.5416667 1.083333 1.666667</float_array> | |
<technique_common> | |
<accessor source="#Cube_location_X-input-array" count="4" stride="1"> | |
<param name="TIME" type="float"/> | |
</accessor> | |
</technique_common> | |
</source> | |
<source id="Cube_location_X-output"> |
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
std::vector<SdfText::InstanceVertex> SdfText::getGlyphVertices( const SdfText::Font::GlyphMeasures &glyphMeasures, const DrawOptions &options, const std::vector<ColorA8u> &colors ) | |
{ | |
const auto& textures = mTextureAtlases->mTextures; | |
const auto& glyphMap = mTextureAtlases->mGlyphInfo; | |
const auto& sdfScale = mTextureAtlases->mSdfScale; | |
const auto& sdfPadding = mTextureAtlases->mSdfPadding; | |
if( textures.empty() ) { | |
return std::vector<SdfText::InstanceVertex>(); | |
} |
OlderNewer