add a textured sphere8.obj test with obj loader

fix shaders, so that shadowed and non-shadowed are matching
fix registerGraphicsUnitSphereShape API (level of detail), support textured sphere too
add support for textured cube
add start for a Tutorial.cpp
This commit is contained in:
erwin coumans
2015-08-05 19:03:27 -07:00
parent 250068d5eb
commit a5669d2ffd
29 changed files with 2138 additions and 105 deletions

View File

@@ -27,6 +27,14 @@ struct DrawGridData
}
};
enum EnumSphereLevelOfDetail
{
SPHERE_LOD_POINT_SPRITE=0,
SPHERE_LOD_LOW,
SPHERE_LOD_MEDIUM,
SPHERE_LOD_HIGH,
};
struct CommonGraphicsApp
{
class CommonWindowInterface* m_window;
@@ -111,8 +119,9 @@ struct CommonGraphicsApp
virtual void swapBuffer() = 0;
virtual void drawText( const char* txt, int posX, int posY) = 0;
virtual void drawText3D( const char* txt, float posX, float posZY, float posZ, float size)=0;
virtual int registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ)=0;
virtual int registerGraphicsSphereShape(float radius, bool usePointSprites=true, int largeSphereThreshold=100, int mediumSphereThreshold=10)=0;
virtual int registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ, int textureIndex = -1)=0;
virtual int registerGraphicsUnitSphereShape(EnumSphereLevelOfDetail lod, int textureId=-1) = 0;
virtual void registerGrid(int xres, int yres, float color0[4], float color1[4])=0;
void defaultMouseButtonCallback( int button, int state, float x, float y)

View File

@@ -43,7 +43,7 @@ struct CommonRenderInterface
virtual void drawPoint(const double* position, const double color[4], double pointDrawSize)=0;
virtual int registerShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType=B3_GL_TRIANGLES, int textureIndex=-1)=0;
virtual void updateShape(int shapeIndex, const float* vertices)=0;
virtual int registerTexture(const unsigned char* texels, int width, int height)=0;
virtual void writeSingleInstanceTransformToCPU(const float* position, const float* orientation, int srcIndex)=0;
virtual void writeSingleInstanceTransformToCPU(const double* position, const double* orientation, int srcIndex)=0;
virtual void writeSingleInstanceColorToCPU(float* color, int srcIndex)=0;

View File

@@ -209,9 +209,9 @@ struct CommonRigidBodyBase : public CommonExampleInterface
btVector3 hor;
hor = rayForward.cross(vertical);
hor.normalize();
hor.safeNormalize();
vertical = hor.cross(rayForward);
vertical.normalize();
vertical.safeNormalize();
float tanfov = tanf(0.5f*fov);