MultiDrawIndirect::MultiDrawIndirect(NvPlatformContext* platform) : NvSampleApp(platform)
{
    // Required in all subclasses to avoid silent link issues
    forceLinkHack();

    m_SkyBoxTextureID = m_WindmillTextureID = 0;

    m_SceneShader = NULL;
    m_SceneShaderMDI = NULL;

    m_SkyboxShader = NULL;

    m_Model = NULL;

    m_transformer->setMotionMode(NvCameraMotionType::FIRST_PERSON);

    m_ProjectionMatrixChanged = true;

    m_VertexArrayObject = 0;

    m_IndirectDrawBuffer = 0;

    m_DrawInstanceMode = USE_MULTIDRAWINDIRECT;

    m_statsFrames = 0;

    m_MaxGridSize = m_MaxModelInstances = 0;

    m_Model = NULL;
}
NormalBlendedDecal::NormalBlendedDecal(NvPlatformContext* platform)
    : NvSampleApp(platform, "NormalBlendedDecal")
    , mLock(LOCK_NONE)
    , mViewOption(VIEW_DEFAULT)
    , mBlitProgram(0)
    , mDecalProgram(0)
    , mGbufferProgram(0)
    , mCombinerProgram(0)
    , mNumDecals(20)
    , mSqrtNumModels(3)
    , mGbufferFBO(0)
    , mGbufferDecalFBO(0)
    , mModelDistance(2.f)
    , mDecalDistance(1.f)
    , mDecalSize(1.0f)
    , mBlendWeight(0.5f)
{
    for (int idx = 0; idx < NUM_GBUFFER_TEXTURES; idx++) {
        mGbufferTextures[idx] = 0;
    }
    m_transformer->setTranslationVec(nv::vec3f(0.0f, 0.0f, -3.0f));
    m_transformer->setRotationVec(nv::vec3f(-0.0376263112f, -0.859024048f, 0.0f));
    m_transformer->setScale(0.232210547f);

    mDecalPos = new nv::vec2f[mNumDecals];

    for (uint32_t i = 0; i < mNumDecals; i++)
    {
        mDecalPos[i] = nv::vec2f(rand() / (float)RAND_MAX - 0.5f, 
            rand() / (float)RAND_MAX - 0.5f);
    }

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
Beispiel #3
0
MotionBlur::MotionBlur(NvPlatformContext* platform) :
    NvSampleApp(platform, "Motion Blur ES2 Sample"),
    mRboID(0U),
    mFboID(0U),
    mTargetTexID(0U),
    mSkyBoxTexID(0U),
    mHouseTexID(0U),
    mSceneColorShader(NULL),
    mSkyboxColorShader(NULL),
    mMotionBlurShader(NULL),
    mHouseModel(NULL),
    mSailsModel(NULL),
    mModelColor(0.992f, 0.817f, 0.090f),
    mCurrSailAngle(0),
    mLastSailAngle(0),
    mSailSpeed(350),
    mStretch(1.0f),
    mLastDt(0.0f),
    mDoMotionBlur(true),
    mAnimPaused(false),
    mDrawSky(true)
{
    m_transformer->setTranslationVec(nv::vec3f(0.0f, 0.0f, -15.0f));

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
ComputeBasicGLSL::ComputeBasicGLSL(NvPlatformContext* platform) : NvSampleApp(platform, "Compute Basic GLSL Sample")
{
    m_framerate = new NvFramerateCounter(this);
    m_aspectRatio = 1.0f;
    m_enableFilter = true;

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
ComputeBasicGLSL::ComputeBasicGLSL()
{
    m_framerate = new NvFramerateCounter(this);
    m_aspectRatio = 1.0f;
    m_enableFilter = true;

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
CascadedShadowMapping::CascadedShadowMapping(NvPlatformContext* platform)
    : NvSampleApp(platform, "Cascaded Shadow Mapping")
    , m_renderer(new CascadedShadowMappingRenderer(*this, *m_transformer))
    , m_method(ShadowMapMethod::GsNoCull)
    , m_frustumSegmentCount(4)
{
    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
    m_renderer->setShadowMapMethod(static_cast<ShadowMapMethod::Enum>(m_method));
    m_renderer->setFrustumSegmentCount(m_frustumSegmentCount);
}
Beispiel #7
0
TopazSample::TopazSample(NvPlatformContext* platform) : NvSampleApp(platform, "Topaz Sample"), drawMode(DRAW_STANDARD)
{
	oit = std::unique_ptr<WeightedBlendedOIT>(new WeightedBlendedOIT);
	brushStyle = std::unique_ptr<BrushStyles>(new BrushStyles);

	isTokenInternalsInited = false;

	sceneBackgroundColor = nv::vec4f(0.2f, 0.2f, 0.2f, 0.0f);
	m_transformer->setTranslationVec(nv::vec3f(0.f, -0.1f, -2.5f));
	forceLinkHack();
}
Beispiel #8
0
Mercury::Mercury() 
	: mAnimate(true),
	mPolygonize(true),
    mReset(true),
    mTime(0.0f),
	mScreenQuadPos(NULL)
{
    m_transformer->setTranslationVec(nv::vec3f(0.0f, 0.0f, -3.0f));

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
OptimizationApp::OptimizationApp(NvPlatformContext* platform) :
    NvSampleApp(platform, "Optimization Sample"),
    m_lightDirection(0.0f),
    m_center(0.0f),
    m_pausedByPerfHUD(false)
{
    // Required in all subclasses to avoid silent link issues
    forceLinkHack();

    m_transformer->setRotationVec(nv::vec3f(11.405f * TO_RADIANS, 231.978f * TO_RADIANS, 0.0f));
    m_transformer->setTranslationVec(nv::vec3f(0.0f, -50.0f, 100.0f));
    m_transformer->setMaxTranslationVel(100.0f);
    m_transformer->setMotionMode(NvCameraMotionType::FIRST_PERSON);
}
SkinningAppVk::SkinningAppVk()
	: mPipeline(VK_NULL_HANDLE)
	, mSingleBoneSkinning(false)
	, mPauseTime(false)
	, mTime(0.0f)
	, mRenderMode(0)        // 0: Render Color   1: Render Normals    2: Render Weights
{
	m_transformer->setRotationVec(nv::vec3f(0.0f, NV_PI*0.25f, 0.0f));
	m_transformer->setTranslationVec(nv::vec3f(0.0f, 0.0f, -25.0f));
	m_transformer->setMaxTranslationVel(50.0f); // seems to work decently.

	// Required in all subclasses to avoid silent link issues
	forceLinkHack();
}
DeferredShadingMSAA::DeferredShadingMSAA() :
    m_modelID(0),
    m_queryId(0),
    m_imageWidth(0),
    m_imageHeight(0),
    m_iMSAACount(4),
    m_approach(APPROACH_COVERAGEMASK),
    m_brdf(BRDF_LAMBERT),
    m_currentRTMode(RTMODE_NONE),
    m_bAdaptiveShading(false),
    m_bMarkComplexPixels(false),
    m_bSeparateComplexPass(true),
    m_bUsePerSamplePixelShader(false),
    m_bUseExtendedModelLoader(true),
    m_backgroundColor(g_sky),
    m_shaderFillGBuffer(NULL),
    m_shaderFillGBuffer_NoMSAA(NULL),
    m_shaderMaskGeneration(NULL),
    m_shaderLighting(NULL),
    m_shaderLightingPerSample(NULL),
    m_shaderLightingMarkComplex(NULL),
    m_shaderLighting_NoMSAA(NULL),
    m_texGBufferFboId(0),
    m_texGBufResolved2(0),
    m_texGBufResolved2FboId(0),
    m_texDepthStencilBuffer(0),
    m_texOffscreenMSAA(0),
    m_texOffscreenMSAAFboId(0),
    m_lightingAccumulationBufferFboId(0),
    m_statsText(NULL),
    m_pUIApproachVar(NULL),
    m_pUIBRDFVar(NULL),
    m_pUIAdaptiveShadingVar(NULL),
    m_pUIMarkComplexPixelsVar(NULL),
    m_pUISeparateComplexPassVar(NULL),
    m_pUIPerSampleShadingVar(NULL)
{
    m_texGBuffer[0] = 0;
    m_texGBuffer[1] = 0;
    m_texGBuffer[2] = 0;
    m_transformer->setTranslationVec(nv::vec3f(15.0f, 0.0f, 0.0f));
    m_transformer->setRotationVec(nv::vec3f(0.0, 1.57, 0.0));
    m_transformer->setMotionMode(NvCameraMotionType::FIRST_PERSON);

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
InstancedTessellation::InstancedTessellation(NvPlatformContext* platform) : NvSampleApp(platform, "Instanced Tessellation Sample"),
    m_wireframe(true)
{
    m_lightAmbient   = 0.1f;  //ambient component
    m_lightDiffuse   = 0.7f;  //diffuse component
   m_time           = 0.0f;

    m_lightPosition = nv::vec3f(1.0f, 1.0f, 1.0f);
    m_lightType       = 0.0f; //1.0f = point light / 0.0f = directional light

    m_modelColor.x  = 1.0f;
    m_modelColor.y  = 1.0f;
    m_modelColor.z  = 1.0f;
    m_tessFactor     = 3;

    m_hwInstancing = false;
    m_pausedByPerfHUD = false;
    m_instancing = false;
    m_modelIndex = eBuddha;
    m_tessMode   = eFirstTessellationMode;

    for( int i = 0; i < eNumModels; ++ i )
    {
        m_pModel[ i ] = 0;
        m_pTriangleData[ i ] = 0;
        m_perTriangleDataVboID[ i ] = INVALID_ID;
      m_ModelMatrix[i] = nv::matrix4f();
    }

   m_ModelMatrix[ eBuddha ] =  nv::rotationYawPitchRoll( m_ModelMatrix[ eBuddha ], 11.0f/7.0f, 11.0f/7.0f, 0.0f );
   m_ModelMatrix[ eArmadillo ] =  nv::rotationYawPitchRoll( m_ModelMatrix[ eArmadillo ], -11.0f/7.0f, 33.0f/7.0f, 0.0f );

    for( int i = 0; i < MAX_TESS_LEVEL; ++ i )
    {
        m_tessVboID[ i ] = INVALID_ID;
        m_tessIboID[ i ] = INVALID_ID;
        m_wireframeTessIboID[ i ] = INVALID_ID;

    }

    m_transformer->setTranslationVec(nv::vec3f(0.0f, 0.0f, -25.0f));

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
Beispiel #13
0
////////////////////////////////////////////////////////////////////////////////
//
//  Method: SkinningApp::SkinningApp()
//
////////////////////////////////////////////////////////////////////////////////
SkinningApp::SkinningApp()
    : m_skinningProgram(NULL)
    , m_singleBoneSkinning(false)
    , m_pauseTime(false)
    , m_pausedByPerfHUD(false)
    , m_time(0.0f)
    , m_renderMode(0)        // 0: Render Color   1: Render Normals    2: Render Weights
    , m_ModelViewProjectionLocation(0)
    , m_BonesLocation(0)
    , m_RenderModeLocation(0)
    , m_LightDir0Location(0)
    , m_LightDir1Location(0)
    , m_iPositionLocation(0)
    , m_iNormalLocation(0)
    , m_iWeightsLocation(0)
{
    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
TerrainTessellation::TerrainTessellation(NvPlatformContext* platform) 
    : NvSampleApp(platform, "Terrain Tessellation Sample"),
    mTerrainVertexProg(0),
    mTerrainTessControlProg(0),
    mTerrainTessEvalProg(0),
    mTerrainGeometryProg(0),
    mTerrainFragmentProg(0),
    mTerrainPipeline(0),
    mGPUQuery(0),
    mNumPrimitives(0),
    mSkyProg(NULL),
    mGenerateTerrainProg(NULL),
    mUBO(0),
    mVBO(0),
    mRandTex(0),
    mRandTex3D(0),
    mTerrainFbo(NULL),
    mLightDir(-1.0f, -0.25f, 1.0f),
    mTerrainVbo(0),
    mTerrainIbo(0),
    mQuality(0),
    mCull(true),
    mLod(true),
    mSmoothNormals(true),
    mWireframe(false),
    mAnimate(true),
    mHeightScale(0.1f),
    mReload(false),
    mTime(0.0f),
    mStatsText(NULL)
{
    mLightDir = normalize(mLightDir);

    // set view
    m_transformer->setMotionMode(NvCameraMotionType::FIRST_PERSON);
    m_transformer->setTranslationVec(nv::vec3f(0.0f, -1.0f, 0.0f));
    m_transformer->setRotationVec(nv::vec3f(0.0f, 0.7f, 0.0f));

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
ComputeWaterSimulation::ComputeWaterSimulation(NvPlatformContext* platform) 
	: NvSampleApp(platform, "Compute Water Surface"),
	mReset(false),
	mTouchDown(false),
	mJoystickDown(false),
	mRainFrame(0),
	mTime(0.0f),
	mWaves(NULL),
	m_hackMemoryBarrier(false)
{
	m_transformer->setMotionMode(NvCameraMotionType::FIRST_PERSON);
	m_transformer->setTranslationVec(nv::vec3f(0.0f, -0.5f, -3.0f));

	// Required in all subclasses to avoid silent link issues
	forceLinkHack();

	mPrevFrameUseComputeShader = mSettings.UseComputeShader;

	mPrevNumWaves = mNumWaves = WATER_NUM_THREADS[0].m_value;
	mPrevGridSize = mGridSize = WATER_GRID_SIZE[1].m_value;
	mWaterShaderType = WATER_SHADER_TYPE[0].m_value;
}
Beispiel #16
0
InstancingApp::InstancingApp()
    : m_sceneIndex(0)
    , m_instancingOptions(HARDWARE_INSTANCING)
    , m_instanceCount(MAX_OBJECTS)
{
    m_time = 0.0f;

    for( int32_t i = 0; i < NUMSCENES*2; ++i ) {
        m_shaders[ i ] = NULL;
        m_textureIDs[ i ] = INVALID_ID;
    }

    for( int32_t i = 0; i < NUMSCENES; ++i ) {
        m_pModel[i] = 0;
        m_vboID[ i ] = INVALID_ID;
        m_iboID[ i ] = INVALID_ID;
    }

    m_transformer->setRotationVec(nv::vec3f(PI*0.25f, 0.0f, 0.0f));
    m_transformer->setMaxTranslationVel(20.0f); // seems to work decently.

    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
Beispiel #17
0
FXAA::FXAA(NvPlatformContext* platform) :
    NvSampleApp(platform, "FXAA"),m_autoSpin(true),m_FXAALevel(2),m_lineWidth(2.0)
{
    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
Beispiel #18
0
FXAA::FXAA() :
    m_autoSpin(true),m_FXAALevel(2),m_lineWidth(2.0)
{
    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}
ParticleUpsampling::ParticleUpsampling(NvPlatformContext* platform) :
    NvSampleApp(platform, "Particle Upsampling Sample")
{
    // Required in all subclasses to avoid silent link issues
    forceLinkHack();
}