本文整理汇总了C++中setLight函数的典型用法代码示例。如果您正苦于以下问题:C++ setLight函数的具体用法?C++ setLight怎么用?C++ setLight使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLight函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main(void)
{
unsigned char light=0;
unsigned char lastkey=0; // Mark key to be off
P0=~0x00; // Light off
for (;;)
{
if (getSwitch() == 1)
{
if (lastkey == 0) // Switch is from Off to On
{
lastkey = 1; // Mark switch is on now
if (light == 0) // Light is Off
{
setLight(1); // Turn on the light now
light = 1; // Mark light to On
}
else // Light is on
{
setLight(0); // Turn off the light now
light = 0; // Mark light to Off
}
}
}
else
{
lastkey = 0; // Switch is off
}
// delay(30000); // for debug use
}
} /* main */
示例2: setColorSpace
void KisColorSelector::loadSettings()
{
KisConfig cfg;
setColorSpace(KisColor::Type(cfg.readEntry<qint32>("ArtColorSel.ColorSpace" , KisColor::HSY)));
setNumLightPieces(cfg.readEntry("ArtColorSel.LightPieces", 19));
m_selectedColor.setH(cfg.readEntry<float>("ArtColorSel.SelColorH", 0.0f));
m_selectedColor.setS(cfg.readEntry<float>("ArtColorSel.SelColorS", 0.0f));
m_selectedColor.setX(cfg.readEntry<float>("ArtColorSel.SelColorX", 0.0f));
m_selectedColor.setA(1.0f);
setInverseSaturation(cfg.readEntry<bool>("ArtColorSel.InversedSaturation", false));
setLight(cfg.readEntry<float>("ArtColorSel.Light", 0.5f), cfg.readEntry<bool>("ArtColorSel.RelativeLight", false));
recalculateRings(
cfg.readEntry("ArtColorSel.NumRings" , 11),
cfg.readEntry("ArtColorSel.RingPieces", 12)
);
QList<float> angles = cfg.readList<float>("ArtColorSel.RingAngles");
for (int i = 0; i < m_colorRings.size(); ++i) {
if (i < angles.size() && i < m_colorRings.size()) {
m_colorRings[i].angle = angles[i];
}
}
selectColor(m_selectedColor);
update();
}
示例3: init
void init(void)
{
//背景色
glClearColor(0.2, 0.2, 0.3, 1.0);
setCamera();//視点を求める
setLight(); //光源設定
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
printf("マウス/キー操作の説明には'h'キーをプッシュ \n");
glGenTextures(2, texName);//テクスチャオブジェクトの名前付け
//Terrainデータの作成
makeTerrainData();
Bitmap* bm0 = new Bitmap();
loadBitmap(bm0, "../../bmp/altgrad4.bmp");
makeTerrainImage(bm0);
setTerrainTexture(0);
//particle用テクスチャ
Bitmap* bm1 = new Bitmap();
loadBitmap(bm1, "../../bmp/snow1.bmp");
makeParticleImage(bm1);
setParticleTexture(1);
//時間計測
lastTime = timeGetTime();
elapseTime1 = 0.0;
elapseTime2 = 0.0;
countP = 0.0;
}
示例4: mapCoord
void KisColorSelector::mousePressEvent(QMouseEvent* event)
{
m_clickPos = mapCoord(event->posF(), m_renderArea);
m_mouseMoved = false;
m_pressedButtons = event->buttons();
m_clickedRing = getSaturationIndex(m_clickPos);
qint8 clickedLightPiece = getLightIndex(event->posF());
if (clickedLightPiece >= 0) {
setLight(getLight(event->posF()), m_relativeLight);
m_selectedLightPiece = clickedLightPiece;
setSelectedColor(m_selectedColor, !(m_pressedButtons & Qt::RightButton), true);
m_mouseMoved = true;
}
else if (m_clickedRing >= 0) {
if (getNumPieces() > 1) {
for(int i=0; i<getNumRings(); ++i)
m_colorRings[i].setTemporaries(m_selectedColor);
}
else {
Radian angle = std::atan2(m_clickPos.x(), m_clickPos.y()) - RAD_90;
m_selectedColor.setH(angle.scaled(0.0f, 1.0f));
m_selectedColor.setS(getSaturation(m_clickedRing));
m_selectedColor.setX(getLight(m_light, m_selectedColor.getH(), m_relativeLight));
setSelectedColor(m_selectedColor, !(m_pressedButtons & Qt::RightButton), true);
m_selectedRing = m_clickedRing;
m_mouseMoved = true;
update();
}
}
}
示例5: switch
void SceneView::inheritCullSettings(const osg::CullSettings& settings, unsigned int inheritanceMask)
{
if (_camera.valid() && _camera->getView())
{
if (inheritanceMask & osg::CullSettings::LIGHTING_MODE)
{
LightingMode newLightingMode = _lightingMode;
switch(_camera->getView()->getLightingMode())
{
case(osg::View::NO_LIGHT): newLightingMode = NO_SCENEVIEW_LIGHT; break;
case(osg::View::HEADLIGHT): newLightingMode = HEADLIGHT; break;
case(osg::View::SKY_LIGHT): newLightingMode = SKY_LIGHT; break;
}
if (newLightingMode != _lightingMode)
{
setLightingMode(newLightingMode);
}
}
if (inheritanceMask & osg::CullSettings::LIGHT)
{
setLight(_camera->getView()->getLight());
}
}
osg::CullSettings::inheritCullSettings(settings, inheritanceMask);
}
示例6: init
void init(void)
{
//背景色
glClearColor(0.2, 0.2, 0.3, 1.0);
setCamera();//視点を求める
setLight(); //光源設定
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
printf("マウス/キー操作の説明には'h'キーをプッシュ \n");
//テクスチャの設定
setCubeMap();
//pet robot アニメーション
pet.unitTime = 0.05;//1フレーム当たりの時間(最初は仮の値)
//フレームデータを作成
pet.numFrame0 = 0;
pet.vPos.x = 1.0;
pet.vPos.z = -1.0;
pet.vAng.y = -90.0;
pet.numFrame0 = 0;
frameCount = 0;
pet.walk(2.0, 0.2, 1.0);
pet.turn(180.0, 2.0);
pet.walk(2.0, 0.2, 1.0);
pet.turn(-180.0, 2.0);
pet.walk(2.0, 0.2, 1.0);
pet.turn(180, 2.0);
pet.walk(2.0, 0.2, 1.0);
pet.turn(-180.0, 2.0);
printf("numFrame0=%d \n", pet.numFrame0);
}
示例7: while
void Intervalometer::init()
{
Serial.begin(9600);
while(!Serial){}
pinMode (shuterPin,OUTPUT);
pinMode (displayPin,OUTPUT);
pinMode (brightnessPin, OUTPUT);
digitalWrite (shuterPin,LOW);
digitalWrite (displayPin,HIGH);
p_lcd-> init();
p_buttonLightUp-> init();
p_buttonLightDown-> init();
p_buttonUp-> init();
p_buttonDown-> init();
p_buttonOk-> init();
p_buttonBack-> init();
p_led-> init();
p_lcd-> createChar(2, kamera);
p_lcd -> createChar(1,PfeilDown);
p_lcd -> createChar(0,PfeilUp);
setLight();
intro();
p_lcd->clear();
Serial.println("SETUP DONE");
}
示例8: init
void init(void)
{
//背景色
glClearColor(0.2, 0.2, 0.3, 1.0);
setCamera();//視点を求める
setLight(); //光源設定
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
printf("マウス/キー操作の説明には'h'キーをプッシュ \n");
//Terrainデータの作成
makeTerrainData();
Bitmap* bm0 = new Bitmap();
loadBitmap(bm0, "../../bmp/altgrad4.bmp");
makeTerrainImage(bm0);
setTerrainTexture();
//particle
countP = 0;
fps = 0;
elapseTime1 = 0.0;//1sec間以内の経過時間
elapseTime2 = 0.0; //init()後の総経過時間
for(int i = 0; i < NUM_PARTICLE; i++) p[i] = CParticle();
for(int i = 0; i < NUM_PARTICLE2; i++) q[i] = CParticle2();
frameCount = 0;
}
示例9: Item
Spawn::Spawn(uint16_t id,
int16_t x, int16_t y, int16_t z,
int16_t deltaX, int16_t deltaY, int16_t deltaZ,
int8_t heading, int8_t deltaHeading,
uint8_t animation)
: Item(tSpawn, id)
{
// apply the unknown mob values
m_name = "unknown";
setNPC(SPAWN_NPC_UNKNOWN);
// set what is known
setPos(x, y, z);
setDeltas(deltaX, deltaY, deltaZ);
setHeading(heading, deltaHeading);
setAnimation(animation);
// initialize what isn't to 0
setPetOwnerID(0);
setLight(0);
setGender(0);
setDeity(0);
setRace(0);
setClassVal(0);
setHP(0);
setMaxHP(0);
setLevel(0);
for (int i = 0; i < tNumWearSlots; i++)
setEquipment(i, 0);
setTypeflag(0);
setConsidered(false);
// turn on auto delete for the track list
m_spawnTrackList.setAutoDelete(true);
}
示例10: pinMode
bool ClydeDev::init() {
// -- pins
pinMode(eye_r_pin, OUTPUT);
pinMode(eye_g_pin, OUTPUT);
pinMode(eye_b_pin, OUTPUT);
pinMode(eye_ir_pin, INPUT);
pinMode(white_pin, OUTPUT);
setLight(0);
if(LOG_LEVEL <= DEBUG) *debug_stream << "Beginning initialisation of Clyde" << endl;
current_colour[0] = 0;
current_colour[1] = 0;
current_colour[2] = 0;
current_hue = 0;
// -- eye / ir sample related
last_calibrated = 0;
last_sampled = 0;
sample_count = 0;
ir_total = 0;
ir_range_avg = 0;
done_calibration = false;
// the raw, un-averaged, ir vals from analog in
current_ir_raw = 0;
previous_ir_raw = 0;
ir_min_raw = 0;
ir_max_raw = 0;
// the averaged reading ir vals over time
current_ir_val = 0;
previous_ir_val = 0;
// eye button press related
press_thresh = 0;
press_start = 0;
is_pressed = false;
press_sample_count = 0;
last_press = 0;
initEye();
return true;
}
示例11: startLevel
/* Start a new level */
void startLevel(int newlev) {
int i,j,x;
light *p = board;
/* Set up variables */
moves = 0;
level = newlev;
memset(board,0,boardsize);
memset(solution,0,boardsize);
/* Make random moves */
for (x=level;x;x--) {
i = random() % boardwidth;
j = random() % boardheight;
invertLightNoupdate(i,j);
invertLightNoupdate(i-1,j);
invertLightNoupdate(i+1,j);
invertLightNoupdate(i,j-1);
invertLightNoupdate(i,j+1);
SOLUTION(i,j) ^= 1;
}
/* Set the gropnode states */
for (j=0;j<boardheight;j++)
for (i=0;i<boardwidth;i++)
setLight(i,j,*(p++));
pgWriteCmd(wCanvas,PGCANVAS_INCREMENTAL,0);
/* Update the status message and run pgUpdate() */
updateStatus();
}
示例12: init
void init(){
//codes for initialization
drawgrid=1;
drawaxes=1;
// cameraHeight=144.0;
// cameraAngle=1.0;
angle=0;
zRotation = 0.0;
//clear the screen
glClearColor(0,0,0,0);
setLight();
/************************
/ set-up projection here
************************/
//load the PROJECTION matrix
glMatrixMode(GL_PROJECTION);
//initialize the matrix
glLoadIdentity();
//give PERSPECTIVE parameters
gluPerspective(80, 1, 1, 10000.0);
//field of view in the Y (vertically)
//aspect ratio that determines the field of view in the X direction (horizontally)
//near distance
//far distance
}
示例13: glClearColor
void GameManager::setOpenGLStates() {
//Set clear color
glClearColor(0.0f,0.0f,0.0f,0.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
//Enable culling
glEnable(GL_CULL_FACE);
//glEnable(GL_NORMALIZE);
glShadeModel(GL_SMOOTH);
//AA
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
// Enable texturing
glEnable(GL_TEXTURE_2D);
//Fog
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogf(GL_FOG_DENSITY, 0.01f);
glHint(GL_FOG_HINT, GL_NICEST);
//Apply light
setLight();
ResizeWindow(window_width, window_height);
}
示例14: digitalWrite
void Intervalometer::displayOn()
{
displayStat = true;
digitalWrite(displayPin, HIGH);
p_lcd->init();
setLight();
}
示例15: setLight
/******************************************************************************
* Mouse move event handler
*
* @param e the event
******************************************************************************/
void SampleViewer::mouseMoveEvent( QMouseEvent* e )
{
//if (_light1->grabsMouse())
if ( _moveLight )
{
int mx = e->x();
int my = e->y();
_light[ 4 ] += ( _light[ 5 ] - e->x() ) / 100.0f;
_light[ 5 ] = e->x();
_light[ 3 ] += -( _light[ 6 ] - e->y() ) / 100.0f;
_light[ 6 ] = e->y();
if ( _light[ 3 ] < 0.0f )
{
_light[ 3 ] = 0.0f;
}
if ( _light[ 3 ] > (float)M_PI )
{
_light[3] = (float)M_PI;
}
setLight( _light[ 3 ], _light[ 4 ] );
}
else
{
QGLViewer::mouseMoveEvent( e );
}
}