Exemplo n.º 1
0
	virtual void copyCameraImageData(const float viewMatrix[16], const float projectionMatrix[16], 
                                  unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels, 
                                  float* depthBuffer, int depthBufferSizeInPixels,
                                  int* segmentationMaskBuffer, int segmentationMaskBufferSizeInPixels,
                                  int startPixelIndex, int destinationWidth, 
                                  int destinationHeight, int* numPixelsCopied)
	{
	    m_cs->lock();
	    for (int i=0;i<16;i++)
        {
            m_viewMatrix[i] = viewMatrix[i];
            m_projectionMatrix[i] = projectionMatrix[i];
        }
	    m_pixelsRGBA = pixelsRGBA;
        m_rgbaBufferSizeInPixels = rgbaBufferSizeInPixels;
        m_depthBuffer = depthBuffer;
        m_depthBufferSizeInPixels = depthBufferSizeInPixels;
        m_segmentationMaskBuffer = segmentationMaskBuffer;
        m_segmentationMaskBufferSizeInPixels = segmentationMaskBufferSizeInPixels;
        m_startPixelIndex = startPixelIndex;
        m_destinationWidth = destinationWidth;
        m_destinationHeight = destinationHeight;
        m_numPixelsCopied = numPixelsCopied;
	    
		m_cs->setSharedParam(1,eGUIHelperCopyCameraImageData);
		m_cs->unlock();
		while (m_cs->getSharedParam(1)!=eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}
	}
Exemplo n.º 2
0
	virtual int		addUserDebugLine(const double	debugLineFromXYZ[3], const double	debugLineToXYZ[3], const double	debugLineColorRGB[3], double lineWidth, double lifeTime )
	{
		m_tmpLine.m_lifeTime = lifeTime;
		m_tmpLine.m_lineWidth = lineWidth;
		m_tmpLine.m_itemUniqueId = m_uidGenerator++;
		m_tmpLine.m_debugLineFromXYZ[0] = debugLineFromXYZ[0];
		m_tmpLine.m_debugLineFromXYZ[1] = debugLineFromXYZ[1];
		m_tmpLine.m_debugLineFromXYZ[2] = debugLineFromXYZ[2];

		m_tmpLine.m_debugLineToXYZ[0] = debugLineToXYZ[0];
		m_tmpLine.m_debugLineToXYZ[1] = debugLineToXYZ[1];
		m_tmpLine.m_debugLineToXYZ[2] = debugLineToXYZ[2];
		
		m_tmpLine.m_debugLineColorRGB[0] = debugLineColorRGB[0];
		m_tmpLine.m_debugLineColorRGB[1] = debugLineColorRGB[1];
		m_tmpLine.m_debugLineColorRGB[2] = debugLineColorRGB[2];
		
		m_cs->lock();
		m_cs->setSharedParam(1, eGUIUserDebugAddLine);
		m_cs->unlock();
		while (m_cs->getSharedParam(1) != eGUIHelperIdle)
		{
			b3Clock::usleep(150);
		}
		return m_userDebugLines[m_userDebugLines.size()-1].m_itemUniqueId;
	}
Exemplo n.º 3
0
	virtual int		addUserDebugText3D( const char* txt, const double positionXYZ[3], const double	textColorRGB[3], double size, double lifeTime)
	{
		
		m_tmpText.m_itemUniqueId = m_uidGenerator++;
		m_tmpText.m_lifeTime = lifeTime;
		m_tmpText.textSize = size;
		int len = strlen(txt);
		strcpy(m_tmpText.m_text,txt);
		m_tmpText.m_textPositionXYZ[0] = positionXYZ[0];
		m_tmpText.m_textPositionXYZ[1] = positionXYZ[1];
		m_tmpText.m_textPositionXYZ[2] = positionXYZ[2];
		m_tmpText.m_textColorRGB[0] = textColorRGB[0];
		m_tmpText.m_textColorRGB[1] = textColorRGB[1];
		m_tmpText.m_textColorRGB[2] = textColorRGB[2];

		m_cs->lock();
		m_cs->setSharedParam(1, eGUIUserDebugAddText);
		m_cs->unlock();
		while (m_cs->getSharedParam(1) != eGUIHelperIdle)
		{
			b3Clock::usleep(150);
		}

		return m_userDebugText[m_userDebugText.size()-1].m_itemUniqueId;
	}
Exemplo n.º 4
0
    virtual void removeAllGraphicsInstances()
    {
        m_cs->lock();
		m_cs->setSharedParam(1,eGUIHelperRemoveAllGraphicsInstances);
		m_cs->unlock();
		while (m_cs->getSharedParam(1)!=eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}
    }
Exemplo n.º 5
0
	virtual void	removeAllUserDebugItems( )
	{
		m_cs->lock();
		m_cs->setSharedParam(1, eGUIUserDebugRemoveAllItems);
		m_cs->unlock();
		while (m_cs->getSharedParam(1) != eGUIHelperIdle)
		{
			b3Clock::usleep(150);
		}
	
	}
Exemplo n.º 6
0
	virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld) 
	{
		m_dynamicsWorld = rbWorld;
		m_cs->lock();
		m_cs->setSharedParam(1, eGUIHelperAutogenerateGraphicsObjects);
		m_cs->unlock();
		while (m_cs->getSharedParam(1) != eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}
	}
Exemplo n.º 7
0
 void lockQueue()
 {
     if ( m_useSpinMutex )
     {
         m_mutex.lock();
     }
     else
     {
         m_queueLock->lock();
     }
 }
Exemplo n.º 8
0
	virtual void createCollisionShapeGraphicsObject(btCollisionShape* collisionShape)
	{
		m_colShape = collisionShape;
		m_cs->lock();
		m_cs->setSharedParam(1,eGUIHelperCreateCollisionShapeGraphicsObject);
		m_cs->unlock();
		while (m_cs->getSharedParam(1)!=eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}

	}
Exemplo n.º 9
0
	virtual void createRigidBodyGraphicsObject(btRigidBody* body,const btVector3& color)
	{
		m_body = body;
		m_color3 = color;
		m_cs->lock();
		m_cs->setSharedParam(1,eGUIHelperCreateRigidBodyGraphicsObject);
		m_cs->unlock();
		while (m_cs->getSharedParam(1)!=eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}
	}
Exemplo n.º 10
0
	virtual void	removeUserDebugItem( int debugItemUniqueId)
	{
		m_removeDebugItemUid = debugItemUniqueId;
		m_cs->lock();
		m_cs->setSharedParam(1, eGUIUserDebugRemoveItem);
		m_cs->unlock();
		while (m_cs->getSharedParam(1) != eGUIHelperIdle)
		{
			b3Clock::usleep(150);
		}

	}	
Exemplo n.º 11
0
	virtual void createCollisionObjectGraphicsObject(btCollisionObject* obj,const btVector3& color)
	{
		m_obj = obj;
		m_color2 = color;
		m_cs->lock();
		m_cs->setSharedParam(1,eGUIHelperCreateCollisionObjectGraphicsObject);
		m_cs->unlock();
		while (m_cs->getSharedParam(1)!=eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}

	}
Exemplo n.º 12
0
	SampleJobInterface* consumeJob()
	{
	    SampleJobInterface* job = 0;
	     m_cs->lock();
	     int sz = m_jobQueue.size();
	     if (sz)
         {
            job = m_jobQueue[sz-1];
            m_jobQueue.pop_back();
         }
         m_cs->unlock();
	    return job;
	}
Exemplo n.º 13
0
	virtual int	registerTexture(const unsigned char* texels, int width, int height)
	{
		m_texels = texels;
		m_textureWidth = width;
		m_textureHeight = height;

		m_cs->lock();
		m_cs->setSharedParam(1,eGUIHelperRegisterTexture);
		m_cs->unlock();
		while (m_cs->getSharedParam(1)!=eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}
		return m_textureId;
	}
Exemplo n.º 14
0
	virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling) 
	{
		m_shapeIndex = shapeIndex;
		m_position = position;
		m_quaternion = quaternion;
		m_color = color;
		m_scaling = scaling;

		m_cs->lock();
		m_cs->setSharedParam(1,eGUIHelperRegisterGraphicsInstance);
		m_cs->unlock();
		while (m_cs->getSharedParam(1)!=eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}
		return m_instanceId;
	}
Exemplo n.º 15
0
	virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType, int textureId)
	{
		m_vertices = vertices;
		m_numvertices = numvertices;
		m_indices = indices;
		m_numIndices = numIndices;
		m_primitiveType = primitiveType;
		m_textureId = textureId;

		m_cs->lock();
		m_cs->setSharedParam(1,eGUIHelperRegisterGraphicsShape);
		m_cs->unlock();
		while (m_cs->getSharedParam(1)!=eGUIHelperIdle)
		{
			b3Clock::usleep(1000);
		}
		return m_shapeIndex;
	}
Exemplo n.º 16
0
	void submitJob(SampleJobInterface* job)
	{
	     m_cs->lock();
         m_jobQueue.push_back(job);
         m_cs->unlock();
	}