示例#1
0
// -----------------------------------------------------------------------------
// Called when the mouse pointer is moved within the control
// -----------------------------------------------------------------------------
void SCallTip::onMouseMove(wxMouseEvent& e)
{
	if (rect_btn_down_.Contains(e.GetPosition()))
	{
		if (btn_mouse_over_ != 1)
		{
			btn_mouse_over_ = 1;
			updateBuffer();
			Refresh();
			Update();
		}
	}

	else if (rect_btn_up_.Contains(e.GetPosition()))
	{
		if (btn_mouse_over_ != 2)
		{
			btn_mouse_over_ = 2;
			updateBuffer();
			Refresh();
			Update();
		}
	}

	else if (btn_mouse_over_ != 0)
	{
		btn_mouse_over_ = 0;
		updateBuffer();
		Refresh();
		Update();
	}
}
示例#2
0
StreamedSound::StreamedSound(AudioStream* stream, ALuint source)
    :Sound(source),mStream(stream),mDone(false)
{
    alGenBuffers(2, mBuffers);
    if(updateBuffer(mBuffers[0]))
        alSourceQueueBuffers(mSource, 1, &mBuffers[0]);
    if(updateBuffer(mBuffers[1]))
        alSourceQueueBuffers(mSource, 1, &mBuffers[1]);
}
示例#3
0
void receiverMain() {
    int i;
    char offset;
    char status;

    //doCycle();
    //doOscillate();

    nrf_init();
    delay();

    nrf_rxmode();
    delay();

    Delay10KTCYx(100);

    offset = 0;
    STATUS_LED = 0;
    while(1) {
        //STATUS_LED =
        nrf_receive(&rx_buf);

        updateBuffer();
        updateLEDs();
    }
}
void LLAudioChannel::setSource(LLAudioSource *sourcep)
{
	//llinfos << this << ": setSource(" << sourcep << ")" << llendl;

	if (!sourcep)
	{
		// Clearing the source for this channel, don't need to do anything.
		LL_DEBUGS("AudioEngine") << "Clearing source for channel" << llendl;
		cleanup();
		return;
	}

	if (sourcep == mCurrentSourcep)
	{
		// Don't reallocate the channel, this will make FMOD goofy.
		LL_DEBUGS("AudioEngine") << "Calling setSource with same source!" << llendl;
	}

	cleanup();
	mCurrentSourcep = sourcep;
	mCurrentSourcep->setChannel(this);
	
	updateBuffer();
	update3DPosition();
}
示例#5
0
void DrawableManager::draw() {
	m_fbo.bind();
	m_fbo.draw({GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3});

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);

	for (const auto & drawablePair : m_drawables) {
		const auto & drawType = drawablePair.second;
		if (drawType.objects.size() == 0 || !drawType.visible) {
			continue;
		}
		if (drawType.dynamic) {
			updateBuffer(drawablePair.first);
		}
		const auto renderType = drawType.objects[0].lock()->renderType;
		m_renderTypes[renderType].preCall(m_renderTypes[renderType].prog, drawType, m_cam);
		m_renderTypes[renderType].drawCall(static_cast<GLsizei>(drawType.objects.size()));
	}

	m_fbo.unbind();

#ifdef LEGACY_MODE
	m_fbo.bind(GL_READ_FRAMEBUFFER);
	glDrawBuffer(GL_BACK);
#endif
	m_fbo.blitAttachment(GL_COLOR_ATTACHMENT3, {0, 0, m_screenSize.x, m_screenSize.y});
#ifdef LEGACY_MODE
	m_fbo.unbind();
#endif

}
示例#6
0
文件: GfxBuffer.cpp 项目: c6h8o7/Lime
lmBool lm::GfxBuffer::init(const lmU8* _buffer, lmU32 _size, GfxBufferType _type, GfxBufferUsage _usage)
{
	m_type = _type;
	m_usage = _usage;

	m_size = _size;
	m_buffer = new lmU8[m_size];

	sg_buffer_desc bufferDesc = { 0 };
	
	bufferDesc.type = (sg_buffer_type)_type;
	bufferDesc.usage = (sg_usage)_usage;

	if (m_usage == Immutable)
	{
		bufferDesc.content = _buffer;
		bufferDesc.size = _size;

		m_handle = sg_make_buffer(&bufferDesc);

		updateBuffer(_buffer, _size);
	}
	else
	{
		bufferDesc.content = nullptr;
		bufferDesc.size = _size;

		m_handle = sg_make_buffer(&bufferDesc);

		update(_buffer, _size);
	}

	return true;
}
示例#7
0
Texture::Texture(std::vector<GLfloat> c)
{
    _uvCoords = c;
    updateBuffer();

    _tex = 0;
}
示例#8
0
void LLAudioChannel::setSource(LLAudioSource *sourcep)
{
	//LL_INFOS() << this << ": setSource(" << sourcep << ")" << LL_ENDL;

	if (!sourcep)
	{
		// Clearing the source for this channel, don't need to do anything.
		//LL_INFOS() << "Clearing source for channel" << LL_ENDL;
		cleanup();
		mCurrentSourcep = NULL;
		mWaiting = false;
	}
	else
	{
		LL_DEBUGS("AudioEngine") << "( id: " << sourcep->getID() << ")" << LL_ENDL;

	if (sourcep == mCurrentSourcep)
	{
		// Don't reallocate the channel, this will make FMOD goofy.
		//LL_INFOS() << "Calling setSource with same source!" << LL_ENDL;
	}

	mCurrentSourcep = sourcep;

	updateBuffer();
	update3DPosition();
}
}
// Draw all the sprites in this buff
void ParticleBuff::renderAll()
{
	// ready the very buffer
	buildVerts();
	
	// Draw the parts
	glBindTexture( GL_TEXTURE_2D, m_texId );
	
	glBindBuffer(GL_ARRAY_BUFFER, this->vbo() );
	updateBuffer();
	
	glEnableClientState( GL_VERTEX_ARRAY );
	glVertexPointer( 2, GL_FLOAT, sizeof(PartiVert), 0 );
	
	glEnableClientState( GL_TEXTURE_COORD_ARRAY );	
	glTexCoordPointer( 2, GL_FLOAT, sizeof(PartiVert), (void*)(2*sizeof(GLfloat)) );
	
	glEnableClientState( GL_COLOR_ARRAY );
	glColorPointer( 4, GL_FLOAT, sizeof(PartiVert), (void*)(4*sizeof(GLfloat)) );
	
	glDrawArrays( GL_TRIANGLES, 0, this->size() );
	
	glDisableClientState( GL_TEXTURE_COORD_ARRAY );
	glDisableClientState( GL_COLOR_ARRAY );
	glDisableClientState( GL_VERTEX_ARRAY );
}
示例#10
0
void pumpRx(COM_Port_t port)
{
  if (checkValidPort(port) == false)
  {
    return;
  }
  // UART
  if ( (port == COM_USART0) || (port == COM_USART1) || (port == COM_USART2) )
  {
    uint8_t *buf;
    UARTDRV_Count_t xferred, remaining;
    INT_Disable();
    UARTDRV_GetReceiveStatus(comhandle[port]->uarthandle, &buf, &xferred, &remaining);
    updateBuffer(comhandle[port]->rxQueue, xferred, comhandle[port]->rxsize);
    INT_Enable();
  }
#ifdef COM_VCP_ENABLE
  if (port == COM_VCP)
  {
    //VCP functionality (VUART) on EFRs do not yet support Rx.
    return;
    //x uint8_t rxbyte;
    //x uint16_t xferred;
    //x BSP_vcpRead( &rxbyte, 1, 1, &xferred, false );
    //x if (xferred>0)
    //x {
    //x   INT_Disable();
    //x   FIFO_ENQUEUE(comhandle[port]->rxQueue, rxbyte, comhandle[port]->rxsize);
    //x   INT_Enable();
    //x }
  }
#endif
}
void veSphereRenderer::render(veNode *node, veRenderableObject *renderableObj, veCamera *camera, unsigned int contextID)
{
	updateBuffer(contextID);

	veRenderCommand rc;
	rc.mask = node->getMask();
	rc.worldMatrix = new veMat4Ptr(node->getNodeToWorldMatrix());
	//rc.attachedNode = node;
	rc.camera = camera;
	rc.sceneManager = camera->getSceneManager();
	rc.depthInCamera = (camera->viewMatrix() * rc.worldMatrix->value())[2][3];
	rc.renderer = this;
    rc.contextID = contextID;

    auto material = renderableObj->getMaterial();
    for (unsigned int i = 0; i < material->activeTechnique()->getPassNum(); ++i) {
        auto pass = material->activeTechnique()->getPass(i);
        if (camera->getMask() & pass->drawMask()) {
            bool isTransparent = pass->blendFunc() != veBlendFunc::DISABLE ? true : false;
            rc.pass = pass;
            pass->visit(rc);
            if (isTransparent)
                camera->getRenderQueue()->pushCommand(i, veRenderQueue::RENDER_QUEUE_TRANSPARENT, rc);
            else
                camera->getRenderQueue()->pushCommand(i, veRenderQueue::RENDER_QUEUE_ENTITY, rc);
        }
    }
}
void FileProcessor::getline(int ln) {
    if (!(fmode == r || fmode == rw)) {
        return;
    }
    updateBuffer();
    int i = 0;
    int ctr = 0;
    int lineCnt = 1;
    for (int j = 0; j < length; j++) {
        if (buffer[j] == '\n') {
            lineCnt++;
        }
    }
    if (ln > lineCnt) {
        ln = lineCnt-1;
    }
    for (i = 0; i < length; i++) {
        if (buffer[i] == '\n') {
            ctr++;
            if (ctr == ln-1) {
                break;
            }
        }
    }
    i++;
    while (buffer[i] != '\n') {
        printf("%c", buffer[i]);
        i++;
    }
}
void LLAudioChannel::setSource(LLAudioSource *sourcep)
{
	//llinfos << this << ": setSource(" << sourcep << ")" << llendl;

	if (!sourcep)
	{
		// Clearing the source for this channel, don't need to do anything.
		//llinfos << "Clearing source for channel" << llendl;
		cleanup();
		mCurrentSourcep = NULL;
		mWaiting = false;
		return;
	}

	if (sourcep == mCurrentSourcep)
	{
		// Don't reallocate the channel, this will make FMOD goofy.
		//llinfos << "Calling setSource with same source!" << llendl;
	}

	mCurrentSourcep = sourcep;


	updateBuffer();
	update3DPosition();
}
示例#14
0
void reGroup::updateShader( reShader* shader )
{
	if (bufferChanged)
	{
		updateBuffer();
	}	
	vertexBuffer->bindPointers(shader);
}
InteractivePointCloud::InteractivePointCloud(PointBufferPtr buffer)
{
	m_boundingBox = new BoundingBox<Vertex<float> >(
			Vertex<float>(-8, -8, -8),
			Vertex<float>(8, 8, 8)
			);

	updateBuffer(buffer);
}
/**
 * Read a value from the sensor, map it over the expected range, average it with the N previous readings and return the average.
 */
unsigned short BuddleiaSensor::read() {
  // The raw sensor reading is mapped from the actual range to the expected range.
  unsigned short reading = expand(analogRead(_pin));

  // Average the last N sensor readings to create a smoother effect.
  updateBuffer(reading);
  
  return bufferAverage();
}
示例#17
0
Texture::Texture(GLfloat *c, unsigned int n)
{
    for(unsigned int i = 0; i < n; ++i)
    {
        _uvCoords.push_back(c[i]);
    }

    updateBuffer();
    _tex = 0;
}
示例#18
0
文件: Delay.cpp 项目: jonas-lj/Synth
//TODO: Make this work...
void Delay::getOutput(double *signal, int length) {
	input->getOutput(signal, length);
	updateBuffer(signal, length);
	for (int i = 0; i < length; i++) {
		for (int r = 1; r < repetitions; r++) {
			double delay_contribution = repetition_volumes[r] * buffer[i + r*delay_time];
			signal[i] += delay_contribution;
		}
	}
}
示例#19
0
文件: Arrow.cpp 项目: mexelout/gq41
Arrow* Arrow::init() {
	auto device = ShaderDevise::device();
	_start = D3DXVECTOR3(0, 2,  0);
	_end = D3DXVECTOR3( 0, -2,  0);

	if(vbuf == NULL) device->CreateVertexBuffer(sizeof(CUSTOMVERTEX)*4, D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &vbuf, NULL);
	updateBuffer();

	return this;
}
示例#20
0
cl::Buffer Skeleton::getTransformBuffer(cl::CommandQueue _queue) const
{
	if (!bufferUpdated)
	{
		updateBuffer(_queue);
		bufferUpdated = true;
	}

	return transformBuffer;
}
示例#21
0
文件: main.cpp 项目: forevermzm/s096
void NBodyWindow::display() {
  updateBuffer();

	glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

  drawBuffer();

  glutSwapBuffers();
	glutPostRedisplay();
}
示例#22
0
文件: GfxBuffer.cpp 项目: c6h8o7/Lime
lmBool lm::GfxBuffer::update(const lmU8* _buffer, lmU32 _size)
{
	if (m_buffer != nullptr && _size <= m_size)
	{
		updateBuffer(_buffer, _size);
		sg_update_buffer(m_handle, (const void*)m_buffer, (lm32)_size);
		return true;
	}

	return false;
}
void LLAudioChannel::setSource(LLAudioSource *sourcep)
{
	llassert_always(sourcep);
	llassert_always(!mCurrentSourcep);

	mCurrentSourcep = sourcep;
	mCurrentSourcep->setChannel(this);
	
	updateBuffer();
	update3DPosition();
}
示例#24
0
void SysTick_Handler(void){
  gpioTogglePin(GPIOD,12);
  sendBuffer();

  count += dir;
  uint32_t i = 0;
  for (i = 0; i < numLEDs; i ++){
    leds[i] = hsvtorgb((2 * i + offset + count)%255,255,25);
    // leds[i] = hsvtorgb((offset + count)%255,255,25);
  }

  updateBuffer();

}
void TreeLand::renderAll()
{
	//glBindTexture( GL_TEXTURE_2D, m_texId );		
	

	//glEnable( GL_TEXTURE );
	//glBindTexture( GL_TEXTURE_2D, texId );		
	

	glBindBuffer(GL_ARRAY_BUFFER, this->vbo() );
	updateBuffer();
	
	//glEnableClientState( GL_VERTEX_ARRAY );
	//glVertexPointer( 2, GL_FLOAT, sizeof(TreeVert), 0 );
	
	//glEnableClientState( GL_TEXTURE_COORD_ARRAY );	
	//glTexCoordPointer( 2, GL_FLOAT, sizeof(TreeVert), (void*)(2*sizeof(GLfloat)) );
	
	//glEnableClientState( GL_COLOR_ARRAY );
	//glColorPointer( 4, GL_FLOAT, sizeof(TilemapVert), (void*)(4*sizeof(GLfloat)) );

	glEnableVertexAttribArray( Attrib_POSITION );    
	glVertexAttribPointer( Attrib_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(TreeVert), 0 );

    glEnableVertexAttribArray( Attrib_TEXCOORD );  
	glVertexAttribPointer( Attrib_TEXCOORD, 2, GL_FLOAT, GL_FALSE, sizeof(TreeVert), 
						  (void*)(3*sizeof(GLfloat)) );
	
	glDrawArrays( GL_TRIANGLES, 0, this->size() );
	
	glDisableVertexAttribArray( Attrib_POSITION );
    //glDisableVertexAttribArray( Attrib_NORMAL );
    glDisableVertexAttribArray( Attrib_TEXCOORD );

	glActiveTexture( GL_TEXTURE1 );
	glEnable( GL_TEXTURE_2D );

	glActiveTexture( GL_TEXTURE0 );
	glEnable( GL_TEXTURE_2D );	

	

	//glDisableClientState( GL_TEXTURE_COORD_ARRAY );
	//glDisableClientState( GL_COLOR_ARRAY );
	//glDisableClientState( GL_VERTEX_ARRAY );
}
/*
 * checks if the mode contains w, if not, nothing happens
 * writes current time and a specified val to file
 * updates the buffer
 */ 
void FileProcessor::write(double val) {
    if (!(fmode == w || fmode == rw)) {
        return;
    }
    time_t rawtime;
    struct tm * timeinfo;

    time ( &rawtime );
    timeinfo = localtime ( &rawtime );
    char output[100];
    char* curtime = asctime (timeinfo); 
    curtime[24] = '\0';
    snprintf(output, 100, "%s: %f\n", curtime, val);
    
    fprintf(file, output);
    updateBuffer();
}
示例#27
0
void DataThread::run()
{

    while (!threadShouldExit())
    {

        if (!updateBuffer())
        {

            const MessageManagerLock mmLock(Thread::getCurrentThread());

            std::cout << "Aquisition error...stopping thread." << std::endl;
            signalThreadShouldExit();
            std::cout << "Notifying source node to stop acqusition." << std::endl;
            sn->acquisitionStopped();
        }

    }
}
示例#28
0
void MusicPlayer::createWidgets()
{
    playButton = new QToolButton(this);
    playButton->setEnabled(false);
    playButton->setToolTip(tr("Play"));
    playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
    connect(playButton, SIGNAL(clicked()), this, SLOT(togglePlayback()));
    connect(playButton, SIGNAL(clicked()), this->parent(), SLOT(updateBuffer()));

    /*
    QAbstractButton *openButton = new QToolButton(this);
    openButton->setText(tr("..."));
    openButton->setToolTip(tr("Open a file..."));
    openButton->setFixedSize(playButton->sizeHint());
    connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
    */

    volumeButton = new VolumeButton(this);
    volumeButton->setToolTip(tr("Adjust volume"));
    volumeButton->setVolume(mediaPlayer.volume());
    connect(volumeButton, SIGNAL(volumeChanged(int)), &mediaPlayer, SLOT(setVolume(int)));

    positionSlider = new QSlider(Qt::Horizontal, this);
    positionSlider->setEnabled(false);
    positionSlider->setToolTip(tr("Seek"));
    connect(positionSlider, SIGNAL(valueChanged(int)), this, SLOT(setPosition(int)));

    infoLabel = new QLabel(this);
    positionLabel = new QLabel(tr("00:00"), this);
    positionLabel->setMinimumWidth(positionLabel->sizeHint().width());

    QBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    //controlLayout->addWidget(openButton);
    controlLayout->addWidget(playButton);
    controlLayout->addWidget(positionSlider);
    controlLayout->addWidget(positionLabel);
    controlLayout->addWidget(volumeButton);

    QBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(infoLabel);
    mainLayout->addLayout(controlLayout);
}
示例#29
0
void StreamedSound::update()
{
    // once it's all been streamed, it's just a matter of waiting for the
    // buffers to be finished off...
    if(!mDone)
    {
        int processed = 0;
        alGetSourcei(mSource, AL_BUFFERS_PROCESSED, &processed);

        // unqueue, stream to and requeue any processed buffers
        while(processed--)
        {
            ALuint buffer;
            alSourceUnqueueBuffers(mSource, 1, &buffer);

            if(updateBuffer(buffer))
                alSourceQueueBuffers(mSource, 1, &buffer);
        }
    }
}
示例#30
0
bool Particles::update(float dt){
	for(auto &it : data){
		it.lifetime -= dt;
		it.position += (it.velocity + wind*it.mass)*dt/1000.f;
		it.velocity -= it.velocity*drag;
		it.size += it.mass * dt/2000.f;
	}

	/// cleanup
	u32 last = data.size();
	for(u32 i=0; i<last; i++){
		if(data[i].lifetime <= 0.f){
			data[i].size = 0.f;
			data[i] = data[--last];
		}
	}
	data.resize(std::min(last, MAX_PARTICLES));

	updateBuffer();
	return false;
}