Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/Source Code/Environment/Sky/Sky.cpp

Diff revisions: vs.
  @@ -15,8 +15,6 @@
15 15 _skybox(NULL),
16 16 _skyGeom(NULL),
17 17 _init(false),
18 - _invert(false),
19 - _invertPlaneY(0),
20 18 _exclusionMask(0)
21 19 {
22 20 ///The sky doesn't cast shadows, doesn't need ambient occlusion and doesn't have real "depth"
  @@ -39,23 +37,32 @@
39 37 bool Sky::load() {
40 38 if(_init) return false;
41 39 std::string location = ParamHandler::getInstance().getParam<std::string>("assetsLocation")+"/misc_images/";
42 - ResourceDescriptor skybox("SkyBox");
43 - skybox.setFlag(true); //no default material;
44 - ResourceDescriptor sun("Sun");
45 - sun.setFlag(true);
46 - ResourceDescriptor skyShaderDescriptor("sky");
40 +
41 + SamplerDescriptor skyboxSampler;
42 + skyboxSampler.toggleMipMaps(false);
43 + skyboxSampler.setAnisotrophy(16);
44 + skyboxSampler.setWrapMode(TEXTURE_CLAMP_TO_EDGE);
45 +
47 46 ResourceDescriptor skyboxTextures("SkyboxTextures");
48 47 skyboxTextures.setResourceLocation(location+"skybox_2.jpg "+ location+"skybox_1.jpg "+
49 48 location+"skybox_5.jpg "+ location+"skybox_6.jpg "+
50 49 location+"skybox_3.jpg "+ location+"skybox_4.jpg");
51 50 skyboxTextures.setEnumValue(TEXTURE_CUBE_MAP);
52 - P32 mipMapMask; mipMapMask.i = 0; mipMapMask.b.b0 = 1;//<disable mipmaps;
53 - skyboxTextures.setBoolMask(mipMapMask);
54 - skyboxTextures.setId(16);
51 + skyboxTextures.setPropertyDescriptor<SamplerDescriptor>(skyboxSampler);
52 + _skybox = CreateResource<TextureCubemap>(skyboxTextures);
53 +
54 + ResourceDescriptor skybox("SkyBox");
55 + skybox.setFlag(true); //no default material;
55 56 _sky = CreateResource<Sphere3D>(skybox);
57 +
58 + ResourceDescriptor sun("Sun");
59 + sun.setFlag(true);
56 60 _sun = CreateResource<Sphere3D>(sun);
57 - _skybox = CreateResource<TextureCubemap>(skyboxTextures);
61 +
62 +
63 + ResourceDescriptor skyShaderDescriptor("sky");
58 64 _skyShader = CreateResource<ShaderProgram>(skyShaderDescriptor);
65 +
59 66 _skyShader->setMatrixMask(false,false,false,true);
60 67 assert(_skyShader);
61 68 _sky->setResolution(4);
  @@ -94,10 +101,6 @@
94 101 void Sky::render(SceneGraphNode* const sgn){
95 102 vec3<F32> eyeTemp(Frustum::getInstance().getEyePos());
96 103
97 - if(_invert){
98 - eyeTemp.y = _invertPlaneY - eyeTemp.y;
99 - }
100 -
101 104 sgn->getTransform()->setPosition(eyeTemp);
102 105
103 106 if (_drawSky){
  @@ -133,10 +136,6 @@
133 136 _skyShader->Uniform("sun_vector", _sunVect);
134 137 }
135 138
136 - void Sky::setInvertPlane(F32 invertPlaneY){
137 - _invertPlaneY = invertPlaneY;
138 - }
139 -
140 139 void Sky::removeFromDrawExclusionMask(I32 stageMask) {
141 140 assert((stageMask & ~(INVALID_STAGE-1)) == 0);
142 141 _exclusionMask &= ~stageMask;