Exemplo n.º 1
0
 // Add light at end of light array
 void addLight(Light3ds l)
 {
     _lights.Add(l);
 }
Exemplo n.º 2
0
        private void readSpotChunk(Light3ds pLight, int chunk_len)
        {
            long chunk_end = filePos() + chunk_len;

            pLight.mTarget.X = ReadFloat();
            pLight.mTarget.Z = ReadFloat();
            pLight.mTarget.Y = ReadFloat();

            pLight.mHotspot = ReadFloat();
            pLight.mFalloff = ReadFloat();

            if (mDecode != null)
            {
                mDecode.println("Target: " + pLight.mTarget);
                mDecode.println("Hotspot: " + Utils3ds.floatToString(pLight.mHotspot, 12));
                mDecode.println("Falloff: " + Utils3ds.floatToString(pLight.mFalloff, 12));
            }

            while (filePos() < chunk_end)
            {
                Head head = read_HEAD();
                switch (head.id)
                {
                    case CHUNK_LIT_RAYSHAD:
                        //        pLight.mRayShadows = (readUnsignedShort() > 0);
                        pLight.mRayShadows = true;
                        break;
                    case CHUNK_LIT_SHADOWED:
                        //        pLight.mShadowed = (readUnsignedShort() > 0);
                        pLight.mShadowed = true;
                        break;
                    case CHUNK_LIT_LOCAL_SHADOW:
                        ReadFloat();
                        ReadFloat();
                        ReadFloat();
                        break;
                    case CHUNK_LIT_LOCAL_SHADOW2:
                        pLight.mShadowBias = ReadFloat();
                        pLight.mShadowFilter = ReadFloat();
                        pLight.mShadowSize = ReadFloat();
                        break;
                    case CHUNK_LIT_SEE_CONE:
                        //        pLight.mCone = (readUnsignedShort() > 0);
                        pLight.mCone = true;
                        break;
                    case CHUNK_LIT_SPOT_RECTANGULAR:
                        //        pLight.mRectangular = (readUnsignedShort() > 0);
                        pLight.mRectangular = true;
                        break;
                    case CHUNK_LIT_SPOT_OVERSHOOT:
                        //        pLight.mOvershoot = (readUnsignedShort() > 0);
                        pLight.mOvershoot = true;
                        break;
                    case CHUNK_LIT_SPOT_PROJECTOR:
                        //        pLight.mProjector = (readUnsignedShort() > 0);
                        pLight.mProjector = true;
                        pLight.mProjectorName = ReadName(64);
                        break;
                    case CHUNK_LIT_SPOT_RANGE:
                        ReadFloat();
                        break;
                    case CHUNK_LIT_SPOT_ROLL:
                        pLight.mRoll = ReadFloat();
                        break;
                    case CHUNK_LIT_SPOT_ASPECT:
                        pLight.mAspect = ReadFloat();
                        break;
                    case CHUNK_LIT_RAY_BIAS:
                        pLight.mRayBias = ReadFloat();
                        break;
                    default:
                        SkipChunk(head.length - 6);
                        break;
                }
            }

            if (mDecode != null)
            {
                mDecode.leave();
            }
        }
Exemplo n.º 3
0
        private void read_N_LIGHT(string name, int chunk_len)
        {
            long chunk_end = filePos() + chunk_len;

            Light3ds lit = new Light3ds();
            lit.mName = name;

            addLight(lit);

            lit.mPosition.X = ReadFloat();
            lit.mPosition.Z = ReadFloat();
            lit.mPosition.Y = ReadFloat();

            if (mDecode != null)
            {
                mDecode.enter();
                mDecode.println("Position: " + lit.mPosition);
            }

            while (filePos() < chunk_end)
            {
                Head head = read_HEAD();
                switch (head.id)
                {
                    case CHUNK_LIT_OFF:
                        lit.mOff = (ReadUnsignedShort() > 0);
                        break;
                    case CHUNK_LIT_SPOT:
                        readSpotChunk(lit, head.length - 6);
                        break;
                    case CHUNK_COL_RGB:
                    case CHUNK_COL_LINRGB:
                        lit.mColor = readRGBColor();
                        break;
                    case CHUNK_COL_TRU:
                    case CHUNK_COL_LINTRU:
                        lit.mColor = readTrueColor();
                        break;
                    case CHUNK_LIT_ATTENUATE:
                        lit.mAttenuation = ReadFloat();
                        break;
                    case CHUNK_LIT_INNER_RANGE:
                        lit.mInnerRange = ReadFloat();
                        break;
                    case CHUNK_LIT_OUTER_RANGE:
                        lit.mOuterRange = ReadFloat();
                        break;
                    case CHUNK_LIT_MULTIPLIER:
                        lit.mMultiplexer = ReadFloat();
                        break;
                    default:
                        SkipChunk(head.length - 6);
                        break;
                }
            }

            if (mDecode != null)
            {
                mDecode.leave();
            }
        }